diff --git a/.cspell.json b/.cspell.json index b8e07af4864..6f036d77516 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,6 +1,14 @@ { - "version": "0.1", + "version": "0.2", "language": "en", + "enableFiletypes": [ + "markdown", + "mdx", + "typescript", + "typescriptreact", + "javascript", + "javascriptreact" + ], "ignorePaths": [ ".cspell.json", ".github/workflows/**", @@ -44,6 +52,7 @@ "ambiently", "Armano", "astexplorer", + "Astro", "ASTs", "autofix", "autofixers", @@ -108,15 +117,16 @@ "rulesets", "serializers", "Sourcegraph", + "stringification", "superset", "thenables", "transpiled", "transpiles", "transpiling", "triaging", + "trpc", "tsconfigs", "tseslint", - "tsutils", "tsvfs", "typedef", "typedefs", diff --git a/.eslintignore b/.eslintignore index 1e5cc6e0083..431bc803029 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,12 +7,11 @@ __snapshots__ .docusaurus build -packages/eslint-plugin-tslint/tests - -packages/website/**/*.js -packages/website/**/*.d.ts -packages/website-eslint/**/*.js -packages/website-eslint/**/*.d.ts - # Files copied as part of the build packages/types/src/generated/**/*.ts + +# Playground types downloaded from the web +packages/website/src/vendor + +# see the file header in eslint-base.test.js for more info +packages/rule-tester/tests/eslint-base diff --git a/.eslintrc.js b/.eslintrc.js index ee9dba8c4d0..9795cfb5792 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,5 @@ +// @ts-check +/** @type {import('./packages/utils/src/ts-eslint/Linter').Linter.Config} */ module.exports = { root: true, plugins: [ @@ -12,21 +14,21 @@ module.exports = { 'unicorn', ], env: { - es6: true, + es2020: true, node: true, }, extends: [ 'eslint:recommended', 'plugin:eslint-plugin/recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:@typescript-eslint/recommended-type-checked', + 'plugin:@typescript-eslint/stylistic-type-checked', + // TODO: consider enabling strict-type-checked ], parserOptions: { sourceType: 'module', project: [ './tsconfig.eslint.json', './packages/*/tsconfig.json', - './tests/integration/tsconfig.json', /** * We are currently in the process of transitioning to nx's out of the box structure and * so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json @@ -51,6 +53,14 @@ module.exports = { // make sure we're not leveraging any deprecated APIs 'deprecation/deprecation': 'error', + // TODO(#7138): Investigate enabling these soon ✨ + '@typescript-eslint/consistent-indexed-object-style': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + + // TODO(#7130): Investigate changing these in or removing these from presets + '@typescript-eslint/no-confusing-void-expression': 'off', + '@typescript-eslint/prefer-string-starts-ends-with': 'off', + // // our plugin :D // @@ -65,25 +75,18 @@ module.exports = { minimumDescriptionLength: 5, }, ], - '@typescript-eslint/consistent-type-definitions': ['error', 'interface'], '@typescript-eslint/consistent-type-imports': [ 'error', { prefer: 'type-imports', disallowTypeAnnotations: true }, ], - '@typescript-eslint/explicit-function-return-type': 'error', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-empty-function': [ + '@typescript-eslint/explicit-function-return-type': [ 'error', - { allow: ['arrowFunctions'] }, + { allowIIFEs: true }, ], '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/prefer-for-of': 'error', - '@typescript-eslint/prefer-nullish-coalescing': 'error', - '@typescript-eslint/prefer-optional-chain': 'error', '@typescript-eslint/unbound-method': 'off', - '@typescript-eslint/prefer-as-const': 'error', '@typescript-eslint/restrict-template-expressions': [ 'error', { @@ -95,7 +98,7 @@ module.exports = { }, ], '@typescript-eslint/no-unused-vars': [ - 'warn', + 'error', { varsIgnorePattern: '^_', argsIgnorePattern: '^_' }, ], @@ -123,7 +126,7 @@ module.exports = { 'no-console': 'error', 'no-process-exit': 'error', 'no-fallthrough': [ - 'warn', + 'error', { commentPattern: '.*intentional fallthrough.*' }, ], @@ -157,6 +160,7 @@ module.exports = { 'eslint-disable-line', 'eslint-disable-next-line', 'eslint-enable', + 'global', ], }, ], @@ -205,6 +209,18 @@ module.exports = { 'unicorn/no-typeof-undefined': 'error', }, overrides: [ + { + files: ['*.js'], + extends: ['plugin:@typescript-eslint/disable-type-checked'], + rules: { + // turn off other type-aware rules + 'deprecation/deprecation': 'off', + '@typescript-eslint/internal/no-poorly-typed-ts-props': 'off', + + // turn off rules that don't apply to JS code + '@typescript-eslint/explicit-function-return-type': 'off', + }, + }, // all test files { files: [ @@ -213,20 +229,23 @@ module.exports = { './packages/*/tests/**/spec.ts', './packages/*/tests/**/test.ts', './packages/parser/tests/**/*.ts', - './tests/integration/**/*.test.ts', - './tests/integration/integration-test-base.ts', - './tests/integration/pack-packages.ts', + './packages/integration-tests/tools/integration-test-base.ts', + './packages/integration-tests/tools/pack-packages.ts', ], env: { 'jest/globals': true, }, rules: { + '@typescript-eslint/no-empty-function': [ + 'error', + { allow: ['arrowFunctions'] }, + ], '@typescript-eslint/no-unsafe-assignment': 'off', '@typescript-eslint/no-unsafe-call': 'off', '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-return': 'off', 'eslint-plugin/consistent-output': 'off', // Might eventually be removed from `eslint-plugin/recommended`: https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues/284 - 'jest/no-disabled-tests': 'warn', + 'jest/no-disabled-tests': 'error', 'jest/no-focused-tests': 'error', 'jest/no-alias-methods': 'error', 'jest/no-identical-title': 'error', @@ -234,9 +253,9 @@ module.exports = { 'jest/no-test-prefixes': 'error', 'jest/no-done-callback': 'error', 'jest/no-test-return-statement': 'error', - 'jest/prefer-to-be': 'warn', - 'jest/prefer-to-contain': 'warn', - 'jest/prefer-to-have-length': 'warn', + 'jest/prefer-to-be': 'error', + 'jest/prefer-to-contain': 'error', + 'jest/prefer-to-have-length': 'error', 'jest/prefer-spy-on': 'error', 'jest/valid-expect': 'error', 'jest/no-deprecated-functions': 'error', @@ -315,7 +334,12 @@ module.exports = { }, // tools and tests { - files: ['**/tools/**/*.ts', '**/tests/**/*.ts'], + files: [ + '**/tools/**/*.*t*', + '**/tests/**/*.ts', + './packages/repo-tools/**/*.*t*', + './packages/integration-tests/**/*.*t*', + ], rules: { // allow console logs in tools and tests 'no-console': 'off', @@ -342,6 +366,19 @@ module.exports = { '@typescript-eslint/sort-type-constituents': 'error', }, }, + { + files: ['./packages/ast-spec/**/*.ts'], + rules: { + 'no-restricted-imports': [ + 'error', + { + name: '@typescript-eslint/typescript-estree', + message: + 'To prevent nx build errors, all `typescript-estree` imports should be done via `packages/ast-spec/tests/util/parsers/typescript-estree-import.ts`.', + }, + ], + }, + }, { files: ['rollup.config.ts'], rules: { @@ -349,7 +386,7 @@ module.exports = { }, }, { - files: ['./packages/website/'], + files: ['./packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'], extends: [ 'plugin:jsx-a11y/recommended', 'plugin:react/recommended', @@ -357,10 +394,11 @@ module.exports = { ], plugins: ['jsx-a11y', 'react', 'react-hooks'], rules: { + '@typescript-eslint/internal/prefer-ast-types-enum': 'off', + 'import/no-default-export': 'off', 'react/jsx-no-target-blank': 'off', 'react/no-unescaped-entities': 'off', - '@typescript-eslint/internal/prefer-ast-types-enum': 'off', - 'react-hooks/exhaustive-deps': 'off', // TODO: enable it later + 'react-hooks/exhaustive-deps': 'warn', // TODO: enable it later }, settings: { react: { @@ -376,5 +414,12 @@ module.exports = { 'no-console': 'off', }, }, + { + files: ['./packages/website-eslint/src/mock/**/*.js', '*.d.ts'], + rules: { + // mocks and declaration files have to mirror their original package + 'import/no-default-export': 'off', + }, + }, ], }; diff --git a/.github/DISCUSSION_TEMPLATE/rfcs.yml b/.github/DISCUSSION_TEMPLATE/rfcs.yml index e9467392b44..446767111f6 100644 --- a/.github/DISCUSSION_TEMPLATE/rfcs.yml +++ b/.github/DISCUSSION_TEMPLATE/rfcs.yml @@ -14,11 +14,12 @@ body: - attributes: label: Before you submit your RFC, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you! options: + - label: I have [read the discussions guidelines](https://typescript-eslint.io/contributing/discussions) and per those guidelines, this fits a discussion category, _not_ a help request or standard issue. + required: true - label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal. required: true - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. required: true id: required-checks type: checkboxes -labels: ['rfc'] title: Your Title Here diff --git a/.github/DISCUSSION_TEMPLATE/technical-discussions.yml b/.github/DISCUSSION_TEMPLATE/technical-discussions.yml new file mode 100644 index 00000000000..7c8f96d2fca --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/technical-discussions.yml @@ -0,0 +1,25 @@ +body: + - attributes: + label: Body + value: | + Body of the technical discussion... + id: body + type: textarea + - attributes: + label: Additional Info + value: | + Any additional info... + id: additional + type: textarea + - attributes: + label: Before you submit your discussion, please confirm the following. If any of these required steps are not taken, we may not be able to review your RFC. Help us to help you! + options: + - label: I have [read the discussions guidelines](https://typescript-eslint.io/contributing/discussions) and per those guidelines, this fits a discussion category, _not_ a help request or standard issue. + required: true + - label: I have [searched for related discussions](https://github.com/typescript-eslint/typescript-eslint/discussions) and [searched for related issues](https://github.com/typescript-eslint/typescript-eslint/issues) and found none that match my proposal. + required: true + - label: I have [read the FAQ](https://typescript-eslint.io/linting/troubleshooting) and my problem is not listed. + required: true + id: required-checks + type: checkboxes +title: Your Title Here diff --git a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml index 91f2cf35fd3..3e3fc8aa137 100644 --- a/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml +++ b/.github/ISSUE_TEMPLATE/06-bug-report-other.yaml @@ -36,6 +36,7 @@ body: - ast-spec - eslint-plugin-tslint - parser + - rule-tester - scope-manager - typescript-estree - utils @@ -118,6 +119,7 @@ body: | -------------------------------------- | ------- | | `@typescript-eslint/eslint-plugin` | `X.Y.Z` | | `@typescript-eslint/parser` | `X.Y.Z` | + | `@typescript-eslint/rule-tester` | `X.Y.Z` | | `@typescript-eslint/scope-manager` | `X.Y.Z` | | `@typescript-eslint/typescript-estree` | `X.Y.Z` | | `@typescript-eslint/type-utils` | `X.Y.Z` | diff --git a/.github/actions/prepare-build/action.yml b/.github/actions/prepare-build/action.yml index d656587ca56..227b60733b3 100644 --- a/.github/actions/prepare-build/action.yml +++ b/.github/actions/prepare-build/action.yml @@ -10,13 +10,27 @@ runs: id: build-cache with: path: '**/dist/**' - key: ${{ runner.os }}-build-${{ github.ref }} + key: ${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }} + # We don't want to share builds across runs even for the same branch + # because each commit can have different build artifacts and we don't + # want to accidentally share artifacts and poison the build output restore-keys: | - ${{ runner.os }}-build- + ${{ runner.os }}-build-${{ github.ref }}-${{ github.run_id }} + + # If the cache was hit, then we still run the types build because we generate source files + - name: Build AST Spec + if: steps['build-cache'].outputs.cache-hit == 'true' + shell: bash + run: | + npx nx run types:build + env: + SKIP_AST_SPEC_REBUILD: true - # if the cache was hit - this will run in <1s - name: Build + if: steps['build-cache'].outputs.cache-hit != 'true' shell: bash # Website will be built by the Netlify GitHub App run: | - npx nx run-many --target=build --parallel --exclude website + npx nx run-many --target=build --parallel --exclude=website --exclude=website-eslint + env: + SKIP_AST_SPEC_REBUILD: true diff --git a/.github/actions/wait-for-netlify/action.yml b/.github/actions/wait-for-netlify/action.yml new file mode 100644 index 00000000000..f5095651e30 --- /dev/null +++ b/.github/actions/wait-for-netlify/action.yml @@ -0,0 +1,15 @@ +name: Wait for the Netlify deployment for the current commit to be ready +description: Wait for the Netlify deployment for the current commit to be ready + +inputs: + netlify_token: + description: The value of secrets.NETLIFY_TOKEN + required: true + max_timeout: + description: The maximum length of time to keep retrying the Netlify api + retry_interval: + description: How long to wait between retries of the Netlify api + +runs: + using: node16 + main: index.js diff --git a/.github/actions/wait-for-netlify/index.js b/.github/actions/wait-for-netlify/index.js new file mode 100644 index 00000000000..f96f6bac7d0 --- /dev/null +++ b/.github/actions/wait-for-netlify/index.js @@ -0,0 +1,108 @@ +const core = require('@actions/core'); +const github = require('@actions/github'); + +const NETLIFY_SITE_ID = '128d21c7-b2fe-45ad-b141-9878fcf5de3a'; // https://app.netlify.com/sites/typescript-eslint/overview +const NETLIFY_TOKEN = core.getInput('netlify_token', { required: true }); +const MAX_TIMEOUT = core.getInput('max_timeout') || 300000; // 5 minutes +const RETRY_INTERVAL = core.getInput('retry_interval') || 5000; // 5 seconds + +const COMMIT_SHA = + github.context.eventName === 'pull_request' + ? github.context.payload.pull_request.head.sha + : github.context.sha; +const BRANCH = + github.context.eventName === 'pull_request' + ? github.context.payload.pull_request.head.ref + : github.context.ref_name; + +if (!COMMIT_SHA || !BRANCH) { + core.setFailed( + `Could not determine the full commit SHA and branch from the GitHub context: ${JSON.stringify( + github.context, + null, + 2, + )}`, + ); +} + +async function run() { + const { NetlifyAPI } = await import('netlify'); // ESM only, cannot be used with `require` + const client = new NetlifyAPI(NETLIFY_TOKEN); + + async function getReadyDeploymentForCommitRef() { + console.log( + `Checking if deployment for commit "${COMMIT_SHA}" on branch "${BRANCH}" has state "ready"...`, + ); + const deployments = await client.listSiteDeploys({ + site_id: NETLIFY_SITE_ID, + branch: BRANCH, + }); + console.log( + `Found ${deployments.length} deployments for this branch "${BRANCH}"`, + ); + const deploymentForCommit = deployments.find( + deployment => deployment.commit_ref === COMMIT_SHA, + ); + if (!deploymentForCommit) { + console.log( + `No deployment found yet for commit "${COMMIT_SHA}" on branch "${BRANCH}"`, + ); + return null; + } + if (deploymentForCommit.state !== 'ready') { + console.log( + `Resolve deployment for commit "${COMMIT_SHA}" on branch "${BRANCH}", but it is not ready yet. State: ${deploymentForCommit.state}`, + ); + return null; + } + return deploymentForCommit; + } + + async function waitUntilReadyDeployment() { + const maxTimeout = new Promise((_, reject) => { + const id = setTimeout(() => { + clearTimeout(id); + reject( + new Error( + `Error: Timed out in ${MAX_TIMEOUT}ms, based on the configured MAX_TIMEOUT.`, + ), + ); + }, MAX_TIMEOUT); + }); + + const isReady = new Promise(async (resolve, reject) => { + const checkReady = async () => { + try { + const readyDeployment = await getReadyDeploymentForCommitRef(); + if (readyDeployment) { + return resolve({ readyDeployment }); + } + console.log( + `Deployment is not ready yet. Retrying in ${RETRY_INTERVAL}ms based on the configured RETRY_INTERVAL...`, + ); + setTimeout(checkReady, RETRY_INTERVAL); + } catch (err) { + return reject(err); + } + }; + checkReady(); + }); + + return Promise.race([isReady, maxTimeout]); + } + + waitUntilReadyDeployment() + .then(({ readyDeployment }) => { + console.log( + `Resolved "ready" deployment with ID: ${readyDeployment.id}, URL: ${readyDeployment.deploy_ssl_url}`, + ); + core.setOutput('deploy_id', readyDeployment.id); + core.setOutput('url', readyDeployment.deploy_ssl_url); + process.exit(0); + }) + .catch(error => { + core.setFailed(error.message); + }); +} + +run(); diff --git a/.github/renovate.json5 b/.github/renovate.json5 index c14c3ed55e5..73ef8938f86 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,10 +1,10 @@ { enabledManagers: ['github-actions', 'npm'], ignoreDeps: [ + // AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70 + 'ajv', // globby is ESM so we can't go any higher right now 'globby', - // this dep now uses package.json exports - we will be removing it next major - 'eslint-scope', // this dep is now ESM only 'execa', // Some kind of weird caching issue: @@ -12,20 +12,14 @@ 'ts-node', // the nx packages get updated using the nx migrate CLI '@nrwl/cli', + '@nx/cli', '@nrwl/devkit', - '@nrwl/jest', + '@nx/devkit', + '@nx/jest', + '@nx/jest', '@nrwl/nx-cloud', + 'nx-cloud', '@nrwl/tao', - // TODO - once we bump pass the major, we can remove these. Currently renovate is creating broken, immortal PRs - '@rollup/plugin-babel', - '@rollup/plugin-commonjs', - '@rollup/plugin-json', - '@rollup/plugin-node-resolve', - '@rollup/plugin-replace', - '@rollup/plugin-terser', - '@rollup/pluginutils', - 'rollup-plugin-terser', - 'rollup', ], ignorePaths: [ // integration test package.json's should never be updated as they're purposely fixed tests @@ -85,11 +79,6 @@ matchPackagePrefixes: ['@types/jest', 'jest-', '@jest/'], groupName: 'jest', }, - { - matchPackagePrefixes: ['@rollup', 'rollup-'], - matchPackageNames: ['rollup'], - groupName: 'rollup', - }, ], postUpdateOptions: [ // run yarn dedupe to cleanup the lockfile after updates diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67ac9a27d68..47da35c1741 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,14 +4,13 @@ on: push: branches: - main - - v6 pull_request: branches: - '**' merge_group: env: - PRIMARY_NODE_VERSION: 18 + PRIMARY_NODE_VERSION: 20 # Only set the read-write token if we are on the main branch NX_CLOUD_ACCESS_TOKEN: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && secrets.NX_CLOUD_ACCESS_TOKEN || '' }} @@ -95,6 +94,21 @@ jobs: - name: Run Check run: yarn ${{ matrix.lint-task }} + stylelint: + name: Stylelint + needs: [install] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} + - name: Run stylelint check + run: yarn stylelint + working-directory: packages/website + integration_tests: name: Run integration tests on primary Node.js version needs: [build] @@ -121,7 +135,7 @@ jobs: strategy: matrix: # just run on the oldest and latest supported versions and assume the intermediate versions are good - node-version: [14, 18] + node-version: [16, 20] package: [ 'ast-spec', @@ -129,6 +143,8 @@ jobs: 'eslint-plugin-internal', 'eslint-plugin-tslint', 'parser', + 'repo-tools', + 'rule-schema-to-typescript-types', 'scope-manager', 'type-utils', 'typescript-estree', @@ -176,52 +192,81 @@ jobs: # Sadly 1 day is the minimum retention-days: 1 - ## TODO - re-enable once we fix them - # https://github.com/typescript-eslint/typescript-eslint/issues/6508 - # website_tests: - # permissions: - # contents: read # to fetch code (actions/checkout) - - # name: Website tests - # # We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however, - # # it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources, - # # we do still keep this requirement here. - # needs: [build] - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v3 - # with: - # fetch-depth: 2 + unit_tests_tsserver: + name: Run Unit Tests with Experimental TSServer + needs: [build] + runs-on: ubuntu-latest + strategy: + matrix: + package: + [ + 'eslint-plugin', + 'eslint-plugin-internal', + 'eslint-plugin-tslint', + 'typescript-estree', + ] + env: + COLLECT_COVERAGE: false + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: 18 + - name: Build + uses: ./.github/actions/prepare-build + - name: Run unit tests for ${{ matrix.package }} + run: npx nx test ${{ matrix.package }} --coverage=false + env: + CI: true + TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER: true + + website_tests: + # The NETLIFY_TOKEN secret will not be available on forks + if: github.repository_owner == 'typescript-eslint' + permissions: + contents: read # to fetch code (actions/checkout) + + name: Website tests + # We technically do not need to wait for build within the pipeline any more because the build we care about is happening within Netlify, however, + # it is highly likely that if the CI one fails, the Netlify one will as well, so in order to not waste unncessary Github Actions minutes/resources, + # we do still keep this requirement here. + needs: [build] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 - # - name: Install - # uses: ./.github/actions/prepare-install - # with: - # node-version: ${{ env.PRIMARY_NODE_VERSION }} + - name: Install + uses: ./.github/actions/prepare-install + with: + node-version: ${{ env.PRIMARY_NODE_VERSION }} - # - name: Install Playwright Browsers - # run: npx playwright install --with-deps + - name: Install Playwright Browsers + run: npx playwright install --with-deps - # - name: Wait for Netlify deployment - # uses: probablyup/wait-for-netlify-action@v3.4.0 - # id: waitForDeployment - # with: - # site_id: '128d21c7-b2fe-45ad-b141-9878fcf5de3a' - # max_timeout: 300 # 5 minutes - # env: - # NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }} + - name: Wait for Netlify deployment + uses: ./.github/actions/wait-for-netlify + id: waitForDeployment + with: + netlify_token: ${{ secrets.NETLIFY_TOKEN }} - # - name: Run Playwright tests against the Netlify deployment - # run: yarn playwright test --reporter=list - # working-directory: packages/website - # env: - # PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }} + - name: Run Playwright tests against the Netlify deployment + run: yarn playwright test --reporter=list + working-directory: packages/website + env: + PLAYWRIGHT_TEST_BASE_URL: ${{ steps.waitForDeployment.outputs.url }} - # - if: always() - # uses: actions/upload-artifact@v3 - # with: - # name: playwright-report - # path: packages/website/playwright-report + - if: always() + uses: actions/upload-artifact@v3 + with: + name: playwright-report + path: packages/website/playwright-report upload_coverage: name: Upload Codecov Coverage @@ -247,6 +292,8 @@ jobs: publish_canary_version: name: Publish the latest code as a canary version runs-on: ubuntu-latest + permissions: + id-token: write needs: [integration_tests, lint_with_build, lint_without_build, unit_tests] if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main' steps: @@ -268,28 +315,3 @@ jobs: run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - publish_canary_version_v6: - name: Publish the next major version code as a canary version - runs-on: ubuntu-latest - needs: [integration_tests, lint_with_build, lint_without_build, unit_tests] - if: github.ref == 'refs/heads/v6' - steps: - - 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: Build - 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 premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v6 - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/nx-migrate.yml b/.github/workflows/nx-migrate.yml index af107f6c391..b379d65e2c7 100644 --- a/.github/workflows/nx-migrate.yml +++ b/.github/workflows/nx-migrate.yml @@ -1,8 +1,8 @@ # This workflow is used to augment the capabilities of the renovate GitHub app by running a full -# `nx migrate` when renovate opens a PR to change the version of @nrwl/workspace. +# `nx migrate` when renovate opens a PR to change the version of @nx/workspace. # # You will therefore also notice that in the renovate configuration, we ignore any packages which -# Nx will manage for us as part of `nx migrate` such as the remaining @nrwl/* packages and jest. +# Nx will manage for us as part of `nx migrate` such as the remaining @nx/* packages and jest. name: Nx Migrate @@ -33,12 +33,12 @@ jobs: - name: Derive appropriate SHAs for base and head for `nx affected` commands uses: nrwl/nx-set-shas@v3 - - name: Check if @nrwl/workspace was changed as part of the latest commit on the PR + - name: Check if @nx/workspace was changed as part of the latest commit on the PR id: nrwl-workspace-package-check run: | - git diff HEAD~1 -G"@nrwl/workspace" --exit-code package.json && echo "@nrwl/workspace unchanged" || echo "::set-output name=was-changed::true" + git diff HEAD~1 -G"@nx/workspace" --exit-code package.json && echo "@nx/workspace unchanged" || echo "::set-output name=was-changed::true" - - name: Run nx migrate if @nrwl/workspace changed and commit the results + - name: Run nx migrate if @nx/workspace changed and commit the results if: ${{ steps.nrwl-workspace-package-check.outputs.was-changed == 'true' }} env: # We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions worfklow runs, so we use a PAT instead @@ -50,14 +50,14 @@ jobs: gh pr checkout ${{ github.event.pull_request.number }} # Get the version of Nx we are migrating to - NX_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nrwl/workspace'])") + NX_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nx/workspace'])") # Revert renovate's changes to package.json and yarn.lock so that it is a clean migrate from the status quo git checkout HEAD~1 -- package.json yarn.lock yarn --ignore-scripts - npx nx migrate @nrwl/workspace@$NX_VERSION + npx nx migrate @nx/workspace@$NX_VERSION # Sometimes Nx can require config formatting changes after a migrate command yarn --ignore-scripts @@ -81,5 +81,5 @@ jobs: git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git git add --all - git commit -m "chore: run nx migrate for @nrwl/workspace v$NX_VERSION" + git commit -m "chore: run nx migrate for @nx/workspace v$NX_VERSION" git push diff --git a/.github/workflows/prettier-update.yml b/.github/workflows/prettier-update.yml new file mode 100644 index 00000000000..c90c72151ae --- /dev/null +++ b/.github/workflows/prettier-update.yml @@ -0,0 +1,51 @@ +# This workflow is used to augment the capabilities of the renovate GitHub app by running a full +# `prettier --write` when renovate opens a PR to change the version of prettier. + +name: Prettier Update + +on: + pull_request: + branches: [main] + paths: + - 'package.json' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +jobs: + maybe_prettier_update: + # Only run if it was the renovate bot that triggered the workflow (otherwise we'll create a loop) + if: contains('["renovate[bot]"]', github.actor) == true + name: Run prettier formatting if required + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Check if prettier was changed as part of the latest commit on the PR + id: prettier-package-check + run: | + git diff HEAD~1 -G"prettier" --exit-code package.json && echo "prettier unchanged" || echo "::set-output name=was-changed::true" + + - name: Run prettier formatting if prettier was changed and commit the results + if: ${{ steps.prettier-package-check.outputs.was-changed == 'true' }} + env: + # We cannot use secrets.GITHUB_TOKEN for this because it is not permitted to kick off subsequent actions worfklow runs, so we use a PAT instead + GITHUB_TOKEN: ${{ secrets.JAMES_HENRY_GITHUB_TOKEN }} + run: | + yarn --ignore-scripts + yarn format + + # Commit all the changes to the PR (see note on not being able to use secrets.GITHUB_TOKEN for this) + git config --global user.email "james@henry.sc" + git config --global user.name "JamesHenry" + git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git + + # If the status is empty, there are no uncommitted changes + if [[ -z $(git status --porcelain) ]]; then + echo "No uncommitted changes" + else + git add --all + git commit -m "chore: update formatting after prettier upgrade" + git push + fi diff --git a/.github/workflows/semantic-pr-titles.yml b/.github/workflows/semantic-pr-titles.yml index 98a7013beb7..fdbc928068c 100644 --- a/.github/workflows/semantic-pr-titles.yml +++ b/.github/workflows/semantic-pr-titles.yml @@ -30,7 +30,6 @@ jobs: eslint-plugin eslint-plugin-internal eslint-plugin-tslint - experimental-utils parser scope-manager type-utils diff --git a/.gitignore b/.gitignore index 7fad8b15206..fb6fcf441bd 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,11 @@ _ts4.2 .watchmanconfig .rollup.cache +# the downlevel-dts output folders +_ts3.4 +_ts4.2 +_ts4.3 + # Files copied as part of the build packages/types/src/generated/**/*.ts diff --git a/.npmrc b/.npmrc index 9cf9495031e..4cfe3ce0674 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -package-lock=false \ No newline at end of file +package-lock=false +provenance=true \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 548792bb901..ac66ab689e2 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,25 +1,28 @@ -**/tests/fixtures/**/* -!packages/scope-manager/tests/fixtures/**/* -**/tests/fixture-project/**/* **/dist **/coverage **/.vscode **/.nyc_output **/.vs -packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js -packages/eslint-plugin/src/configs/*.json CONTRIBUTORS.md packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts +packages/eslint-plugin/tests/fixtures/indent/ -# prettier doesn't yet support auto-accessors -packages/ast-spec/src/element/AccessorProperty/fixtures +# prettier errors on this case because it's semantically valid +packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts # prettier doesn't yet support `const` modifiers for type parameters packages/ast-spec/src/special/TSTypeParameter/fixtures +# prettier doesn't yet support JSX namespaced attributes +packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx +packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx + # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md packages/website/.docusaurus packages/website/build -packages/website/src/vendor +packages/website/playwright-report + +# see the file header in eslint-base.test.js for more info +packages/rule-tester/tests/eslint-base diff --git a/.vscode/launch.json b/.vscode/launch.json index aee0ff73ab0..82c02f90b2e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -71,6 +71,109 @@ "${workspaceFolder}/packages/scope-manager/dist/index.js", "${workspaceFolder}/packages/scope-manager/dist/index.js", ], + },{ + "type": "node", + "request": "launch", + "name": "Jest Test Current eslint-plugin-tslint Rule", + "cwd": "${workspaceFolder}/packages/eslint-plugin-tslint/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasenameNoExtension}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "skipFiles": [ + "${workspaceFolder}/packages/utils/src/index.ts", + "${workspaceFolder}/packages/utils/dist/index.js", + "${workspaceFolder}/packages/utils/src/ts-estree.ts", + "${workspaceFolder}/packages/utils/dist/ts-estree.js", + "${workspaceFolder}/packages/type-utils/src/index.ts", + "${workspaceFolder}/packages/type-utils/dist/index.js", + "${workspaceFolder}/packages/parser/src/index.ts", + "${workspaceFolder}/packages/parser/dist/index.js", + "${workspaceFolder}/packages/typescript-estree/src/index.ts", + "${workspaceFolder}/packages/typescript-estree/dist/index.js", + "${workspaceFolder}/packages/types/src/index.ts", + "${workspaceFolder}/packages/types/dist/index.js", + "${workspaceFolder}/packages/visitor-keys/src/index.ts", + "${workspaceFolder}/packages/visitor-keys/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + ], + }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened rule-tester test", + "cwd": "${workspaceFolder}/packages/rule-tester/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasename}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "skipFiles": [ + "${workspaceFolder}/packages/utils/src/index.ts", + "${workspaceFolder}/packages/utils/dist/index.js", + "${workspaceFolder}/packages/utils/src/ts-estree.ts", + "${workspaceFolder}/packages/utils/dist/ts-estree.js", + "${workspaceFolder}/packages/type-utils/src/ts-estree.ts", + "${workspaceFolder}/packages/type-utils/dist/ts-estree.js", + "${workspaceFolder}/packages/parser/src/index.ts", + "${workspaceFolder}/packages/parser/dist/index.js", + "${workspaceFolder}/packages/rule-tester/src/index.ts", + "${workspaceFolder}/packages/rule-tester/dist/index.js", + "${workspaceFolder}/packages/typescript-estree/src/index.ts", + "${workspaceFolder}/packages/typescript-estree/dist/index.js", + "${workspaceFolder}/packages/types/src/index.ts", + "${workspaceFolder}/packages/types/dist/index.js", + "${workspaceFolder}/packages/visitor-keys/src/index.ts", + "${workspaceFolder}/packages/visitor-keys/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + ], + }, + { + "type": "node", + "request": "launch", + "name": "Jest Test Current eslint-plugin-tslint Rule", + "cwd": "${workspaceFolder}/packages/eslint-plugin-tslint/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasenameNoExtension}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "skipFiles": [ + "${workspaceFolder}/packages/utils/src/index.ts", + "${workspaceFolder}/packages/utils/dist/index.js", + "${workspaceFolder}/packages/utils/src/ts-estree.ts", + "${workspaceFolder}/packages/utils/dist/ts-estree.js", + "${workspaceFolder}/packages/type-utils/src/index.ts", + "${workspaceFolder}/packages/type-utils/dist/index.js", + "${workspaceFolder}/packages/parser/src/index.ts", + "${workspaceFolder}/packages/parser/dist/index.js", + "${workspaceFolder}/packages/typescript-estree/src/index.ts", + "${workspaceFolder}/packages/typescript-estree/dist/index.js", + "${workspaceFolder}/packages/types/src/index.ts", + "${workspaceFolder}/packages/types/dist/index.js", + "${workspaceFolder}/packages/visitor-keys/src/index.ts", + "${workspaceFolder}/packages/visitor-keys/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + ], }, { "type": "node", @@ -258,10 +361,6 @@ "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "skipFiles": [ - "${workspaceFolder}/packages/experimental-utils/src/index.ts", - "${workspaceFolder}/packages/experimental-utils/dist/index.js", - "${workspaceFolder}/packages/experimental-utils/src/ts-estree.ts", - "${workspaceFolder}/packages/experimental-utils/dist/ts-estree.js", "${workspaceFolder}/packages/parser/src/index.ts", "${workspaceFolder}/packages/parser/dist/index.js", "${workspaceFolder}/packages/typescript-estree/src/index.ts", diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cd3da95b52..2b770bca2c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,317 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* **ast-spec:** remove more invalid properties ([#6243](https://github.com/typescript-eslint/typescript-eslint/issues/6243)) ([aa20f63](https://github.com/typescript-eslint/typescript-eslint/commit/aa20f63e8f345767bb4693c9d20f751e6998bd65)) +* bumped ts-api-utils to 0.0.39 ([#6497](https://github.com/typescript-eslint/typescript-eslint/issues/6497)) ([217c710](https://github.com/typescript-eslint/typescript-eslint/commit/217c710d99445994b9c8db7b9bee9b9cc63bc4cb)) +* correct handling of additionalProperties in object schemas ([#6939](https://github.com/typescript-eslint/typescript-eslint/issues/6939)) ([489c7a5](https://github.com/typescript-eslint/typescript-eslint/commit/489c7a50ae99ef66df152a68fd447f7e42a23558)) +* correct jest.mock path post merge ([778d254](https://github.com/typescript-eslint/typescript-eslint/commit/778d254eefc5bb08f39e4ce7d691c67977e620ab)) +* correct lint error after merge ([277fdb5](https://github.com/typescript-eslint/typescript-eslint/commit/277fdb5ac76bd761ae6f5d1052445dcff2e848a1)) +* **eslint-plugin:** [explicit-module-boundary-types] remove shouldTrackReferences option from schema ([#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399)) ([6d32734](https://github.com/typescript-eslint/typescript-eslint/commit/6d32734b1312f60ee7d12d4bb19fc1cf52e7f0a5)) +* **eslint-plugin:** allow parser@^6.0.0 ([#6630](https://github.com/typescript-eslint/typescript-eslint/issues/6630)) ([92908bd](https://github.com/typescript-eslint/typescript-eslint/commit/92908bdd9c102ff599da6a4791e8ad3e6d3dc593)) +* **eslint-plugin:** remove valid-typeof disable in eslint-recommended ([#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381)) ([b82df5e](https://github.com/typescript-eslint/typescript-eslint/commit/b82df5eaed437727566cde2b53410001505f1b13)) +* fix illegal decorator check ([#6723](https://github.com/typescript-eslint/typescript-eslint/issues/6723)) ([c456f8c](https://github.com/typescript-eslint/typescript-eslint/commit/c456f8cdef5a931c631bfbcfc84d8a25caaf019f)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* replace tsutils with ts-api-tools ([#6428](https://github.com/typescript-eslint/typescript-eslint/issues/6428)) ([79327b4](https://github.com/typescript-eslint/typescript-eslint/commit/79327b4999999cde3003901b40527af002c4906a)) +* **type-utils:** checking of type aliases' type names by `typeMatchesSpecifier` ([#6820](https://github.com/typescript-eslint/typescript-eslint/issues/6820)) ([7ca2c90](https://github.com/typescript-eslint/typescript-eslint/commit/7ca2c900eb07ade771bed43a8eb4a5a97fdfa3b3)) +* **type-utils:** file variant of TypeOrValueSpecifier uses canonical filenames instead of lowercasing ([#6781](https://github.com/typescript-eslint/typescript-eslint/issues/6781)) ([5095d05](https://github.com/typescript-eslint/typescript-eslint/commit/5095d05ac97320e7e50decef58279b01f2bfbd18)) +* **type-utils:** fixed TypeOrValueSpecifier not accounting for scoped DT packages ([#6780](https://github.com/typescript-eslint/typescript-eslint/issues/6780)) ([3350940](https://github.com/typescript-eslint/typescript-eslint/commit/335094064c441573638fda589d10f3b925058d5e)) +* **type-utils:** treat intrinsic types as if they are from lib and never match error types ([#6869](https://github.com/typescript-eslint/typescript-eslint/issues/6869)) ([ecb57de](https://github.com/typescript-eslint/typescript-eslint/commit/ecb57de5eb50511bed163f6e1b27e31b8577344e)) +* **typescript-estree:** account for namespace nesting in AST conversion ([#6272](https://github.com/typescript-eslint/typescript-eslint/issues/6272)) ([09e3877](https://github.com/typescript-eslint/typescript-eslint/commit/09e38776c63fea3328f71df36644ee11dd137cc1)) +* **typescript-estree:** allow writing to deprecated node properties ([#6670](https://github.com/typescript-eslint/typescript-eslint/issues/6670)) ([6652ebe](https://github.com/typescript-eslint/typescript-eslint/commit/6652ebea3e338f05a377f6f124d20520a840b1d5)) +* **typescript-estree:** fix error handling on `ImportExpression` ([#6587](https://github.com/typescript-eslint/typescript-eslint/issues/6587)) ([e8cdd5c](https://github.com/typescript-eslint/typescript-eslint/commit/e8cdd5ce48fa0a2f6f93e6b3ed7c337d042ab45d)) +* **typescript-estree:** forbid `override` on non-constructor function/methods ([#6729](https://github.com/typescript-eslint/typescript-eslint/issues/6729)) ([2f3638f](https://github.com/typescript-eslint/typescript-eslint/commit/2f3638fb00745429d6392a8e6492e83f853e92db)) +* **typescript-estree:** wrap import = declaration in an export node ([#5885](https://github.com/typescript-eslint/typescript-eslint/issues/5885)) ([1c3f470](https://github.com/typescript-eslint/typescript-eslint/commit/1c3f470da75bf63526efbf5b45615772e562dcb5)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) +* **utils:** removed `TRuleListener` generic from the `createRule` ([#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036)) ([361f8bc](https://github.com/typescript-eslint/typescript-eslint/commit/361f8bcebe588fc7410a53e002c55118b0bfee85)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* bump minimum supported TS version to 4.2.4 ([#5915](https://github.com/typescript-eslint/typescript-eslint/issues/5915)) ([a8e71d5](https://github.com/typescript-eslint/typescript-eslint/commit/a8e71d52169f32ab9e836ec96d980ba52deffe12)) +* bump ts-api-utils to v0.0.21 ([#6459](https://github.com/typescript-eslint/typescript-eslint/issues/6459)) ([3915661](https://github.com/typescript-eslint/typescript-eslint/commit/391566172dbc6013be79952fc68a588bf653fa8d)) +* bump ts-api-utils to v0.0.22 ([#6472](https://github.com/typescript-eslint/typescript-eslint/issues/6472)) ([b88cd23](https://github.com/typescript-eslint/typescript-eslint/commit/b88cd2332921efcca7ec5f4176f19779346d963b)) +* create TSTypeQuery node when TSImportType has isTypeOf ([#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076)) ([2b69b65](https://github.com/typescript-eslint/typescript-eslint/commit/2b69b659d87b58468e413801d31086ae0eeafff4)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) +* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-nullish-coalescing]: add support for assignment expressions ([#5234](https://github.com/typescript-eslint/typescript-eslint/issues/5234)) ([4bdbe67](https://github.com/typescript-eslint/typescript-eslint/commit/4bdbe67955fd591c25e58b13e674ba05bf5ed585)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) +* **eslint-plugin:** [prefer-readonly-parameter-types] added an optional type allowlist ([#4436](https://github.com/typescript-eslint/typescript-eslint/issues/4436)) ([c9427b7](https://github.com/typescript-eslint/typescript-eslint/commit/c9427b78b69f1a6a2453ef2df2be5bf96b7b00bc)) +* **eslint-plugin:** [restrict-plus-operands] change checkCompoundAssignments to skipCompoundAssignments ([#7027](https://github.com/typescript-eslint/typescript-eslint/issues/7027)) ([dc801d8](https://github.com/typescript-eslint/typescript-eslint/commit/dc801d892ecc1af678ff37166481f4b69186164c)) +* **eslint-plugin:** add config that disables type-aware linting ([#6470](https://github.com/typescript-eslint/typescript-eslint/issues/6470)) ([3b063cf](https://github.com/typescript-eslint/typescript-eslint/commit/3b063cfadce50985f8ec6d8f44f5b1cbd5c1ea57)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* **eslint-plugin:** deprecate no-type-alias ([#6229](https://github.com/typescript-eslint/typescript-eslint/issues/6229)) ([820bdf2](https://github.com/typescript-eslint/typescript-eslint/commit/820bdf2a3934d4186d51186693ced02df64a57ce)) +* **eslint-plugin:** final final config changes for v6 ([#7157](https://github.com/typescript-eslint/typescript-eslint/issues/7157)) ([e35c5c1](https://github.com/typescript-eslint/typescript-eslint/commit/e35c5c1c39f3d76b916ad1c1ac2c7bf05b379193)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* **experimental-utils:** console.warn on import of experimental-utils ([#6179](https://github.com/typescript-eslint/typescript-eslint/issues/6179)) ([0b7476b](https://github.com/typescript-eslint/typescript-eslint/commit/0b7476b4570f5630645420dbb0b8b753e04b5fe1)) +* fork json schema types for better compat with ESLint rule validation ([#6963](https://github.com/typescript-eslint/typescript-eslint/issues/6963)) ([a4967f2](https://github.com/typescript-eslint/typescript-eslint/commit/a4967f2e8cc7b0432d8dfe804772e60042c5384c)) +* improve error location ([#6556](https://github.com/typescript-eslint/typescript-eslint/issues/6556)) ([355adf0](https://github.com/typescript-eslint/typescript-eslint/commit/355adf0b5dcc1b4f5c360722acc1ba8b6f4e4117)) +* improve rule schemas, add test to validate schemas, add tooling to generate schema types ([#6899](https://github.com/typescript-eslint/typescript-eslint/issues/6899)) ([acc1a43](https://github.com/typescript-eslint/typescript-eslint/commit/acc1a43e02a403ff74a54c28c2c495f00d0be038)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* raise tsconfig target to ES2021 ([#5981](https://github.com/typescript-eslint/typescript-eslint/issues/5981)) ([2a5e20f](https://github.com/typescript-eslint/typescript-eslint/commit/2a5e20fd6733ccfa63dfc137287ae18027d4691a)) +* remove `experimental-utils` ([#6468](https://github.com/typescript-eslint/typescript-eslint/issues/6468)) ([71adbc5](https://github.com/typescript-eslint/typescript-eslint/commit/71adbc5119fa55c29d55747a64e9f4e178374c3c)) +* remove `RuleTester` in `/utils` in favour of the new `/rule-tester` package ([#6816](https://github.com/typescript-eslint/typescript-eslint/issues/6816)) ([c33f497](https://github.com/typescript-eslint/typescript-eslint/commit/c33f497ad8aec7c123c7374f7aff3e24025fe861)) +* remove moduleResolver API ([#6609](https://github.com/typescript-eslint/typescript-eslint/issues/6609)) ([f0f45a9](https://github.com/typescript-eslint/typescript-eslint/commit/f0f45a9d35453c3ec601df770092d236c72d447b)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration ([#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863)) ([844875c](https://github.com/typescript-eslint/typescript-eslint/commit/844875cbe933195ff25ba218f82ede3ebde9a0a0)) +* **scope-manager:** ignore ECMA version ([#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889)) ([f2330f7](https://github.com/typescript-eslint/typescript-eslint/commit/f2330f79739eb93e3c290ccc6e810a01e097eda0)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) +* **typescript-estree:** added allowInvalidAST option to not throw on invalid tokens ([#6247](https://github.com/typescript-eslint/typescript-eslint/issues/6247)) ([a3b177d](https://github.com/typescript-eslint/typescript-eslint/commit/a3b177d59adaf8ea76b205befc8b12d86447f1fb)) +* **typescript-estree:** allow providing code as a ts.SourceFile ([#5892](https://github.com/typescript-eslint/typescript-eslint/issues/5892)) ([af41b7f](https://github.com/typescript-eslint/typescript-eslint/commit/af41b7fa7b9b8f3023fdabd40846598d5d4d4f61)) +* **typescript-estree:** check for illegal decorators on function declarations ([#6590](https://github.com/typescript-eslint/typescript-eslint/issues/6590)) ([1b39cfd](https://github.com/typescript-eslint/typescript-eslint/commit/1b39cfd307955deb8e407cf8dd3a6ca1ed1b8df6)) +* **typescript-estree:** check modifiers on every node ([#6615](https://github.com/typescript-eslint/typescript-eslint/issues/6615)) ([62d6230](https://github.com/typescript-eslint/typescript-eslint/commit/62d62304e16b553274a80d8ab2653543a22f2391)) +* **typescript-estree:** deprecate createDefaultProgram ([#5890](https://github.com/typescript-eslint/typescript-eslint/issues/5890)) ([426d6b6](https://github.com/typescript-eslint/typescript-eslint/commit/426d6b647e6df3e312d1cef3e28dadaef6675fd3)) +* **typescript-estree:** forbid members in Mapped Type ([#6802](https://github.com/typescript-eslint/typescript-eslint/issues/6802)) ([b93458f](https://github.com/typescript-eslint/typescript-eslint/commit/b93458f9dfe36409d3a736a081ab69ba749caf24)) +* **typescript-estree:** remove optionality from AST boolean properties ([#6274](https://github.com/typescript-eslint/typescript-eslint/issues/6274)) ([df131e2](https://github.com/typescript-eslint/typescript-eslint/commit/df131e258c93e5714c88c0373cfeb2e1e75afc75)) +* **typescript-estree:** remove parseWithNodeMaps ([#7120](https://github.com/typescript-eslint/typescript-eslint/issues/7120)) ([e2a0a76](https://github.com/typescript-eslint/typescript-eslint/commit/e2a0a768d18a6aed5046946a2b57b219a54dcf3e)) +* **typescript-estree:** strict class heritage clauses check ([#6576](https://github.com/typescript-eslint/typescript-eslint/issues/6576)) ([530185b](https://github.com/typescript-eslint/typescript-eslint/commit/530185bd7e62b05adc673d1f96257dd14bb4d9dc)) +* **typescript-estree:** throw errors for object methods without function bodies ([#6589](https://github.com/typescript-eslint/typescript-eslint/issues/6589)) ([1d78576](https://github.com/typescript-eslint/typescript-eslint/commit/1d78576d41323e35c2d2a2ecc92f6ee76ed61d57)) +* **typescript-estree:** throw errors on interface with implements ([#6551](https://github.com/typescript-eslint/typescript-eslint/issues/6551)) ([67e05c8](https://github.com/typescript-eslint/typescript-eslint/commit/67e05c8f0381ba7065a0257d6038f0a50a3b9888)) +* **typescript-estree:** throw errors when abstract property has initializer ([#6613](https://github.com/typescript-eslint/typescript-eslint/issues/6613)) ([dcdbc76](https://github.com/typescript-eslint/typescript-eslint/commit/dcdbc76d5418a383968d15e32d2eba7a9d2d7e79)) +* **typescript-estree:** warn on deprecated AST property accesses ([#6525](https://github.com/typescript-eslint/typescript-eslint/issues/6525)) ([79c058d](https://github.com/typescript-eslint/typescript-eslint/commit/79c058d69f723ed18a3a7631370009359510d128)) +* **utils:** remove (ts-)eslint-scope types ([#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256)) ([df54175](https://github.com/typescript-eslint/typescript-eslint/commit/df541751c6510f5d15d863f515cff3748fd9e688)) +* **utils:** remove obsolete `meta.docs.suggestion` rule type ([#5967](https://github.com/typescript-eslint/typescript-eslint/issues/5967)) ([f424b2a](https://github.com/typescript-eslint/typescript-eslint/commit/f424b2a519595283be01149f0e13eb7f869bd247)) + + +### BREAKING CHANGES + +* Removes `experimental-utils` - we will no longer update this package and it will be forever frozen at v5.x +* **eslint-plugin:** Adds an additional class of checks to the rule +* drop support for ESLint v6 +* drops support for node v17 +* **utils:** Removes `meta.docs.suggestion` property +* Bumps the minimum supported range and removes handling for old versions +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + + +### Bug Fixes + +* **eslint-plugin:** [comma-spacing] allow no space after trailing comma in objects and arrays ([#6938](https://github.com/typescript-eslint/typescript-eslint/issues/6938)) ([24bdacc](https://github.com/typescript-eslint/typescript-eslint/commit/24bdacc7e5df40c92031a1bd7e9815d66a35b31d)) +* **eslint-plugin:** [prefer-includes] escape special characters ([#7161](https://github.com/typescript-eslint/typescript-eslint/issues/7161)) ([5a347a5](https://github.com/typescript-eslint/typescript-eslint/commit/5a347a5978bc5737412bd12d61eb6058163cf4a0)), closes [#7145](https://github.com/typescript-eslint/typescript-eslint/issues/7145) +* **eslint-plugin:** replace auto-fix of class literal property style rule with suggestion ([#7054](https://github.com/typescript-eslint/typescript-eslint/issues/7054)) ([a8c824a](https://github.com/typescript-eslint/typescript-eslint/commit/a8c824a1e84453f93cd2b464fc102bc878c1aff3)) + + +### Features + +* **eslint-plugin:** [prefer-nullish-coalescing] add `ignorePrimitives` option ([#6487](https://github.com/typescript-eslint/typescript-eslint/issues/6487)) ([6edaa04](https://github.com/typescript-eslint/typescript-eslint/commit/6edaa04565576f0af7e60bc08602bd781c847804)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* **eslint-plugin:** [ban-types] ban types in extends and implements ([#7129](https://github.com/typescript-eslint/typescript-eslint/issues/7129)) ([997783f](https://github.com/typescript-eslint/typescript-eslint/commit/997783ff108ca18af709667ef3fdfa7134a8eefe)) +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) +* use graphemer instead of grapheme-splitter ([#7069](https://github.com/typescript-eslint/typescript-eslint/issues/7069)) ([faea3ff](https://github.com/typescript-eslint/typescript-eslint/commit/faea3ff8b4d750974c41262b44db314f20d0c99c)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + + +### Features + +* **eslint-plugin:** [restrict-plus-operands] add allow* options ([#6161](https://github.com/typescript-eslint/typescript-eslint/issues/6161)) ([def09f8](https://github.com/typescript-eslint/typescript-eslint/commit/def09f88cdb4a85cebb8619b45931f7e2c88dfc0)) + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/typescript-eslint + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + + +### Bug Fixes + +* **eslint-plugin:** [prefer-regexp-exec] skip malformed regexes ([#6935](https://github.com/typescript-eslint/typescript-eslint/issues/6935)) ([05ed60e](https://github.com/typescript-eslint/typescript-eslint/commit/05ed60e25f1de9d1bb83d56c81a349130960bec8)) +* **eslint-plugin:** [unified-signatures] no parameters function ([#6940](https://github.com/typescript-eslint/typescript-eslint/issues/6940)) ([2970861](https://github.com/typescript-eslint/typescript-eslint/commit/297086154acc568a0ae8eb41c8977b7a7ba4e0ed)) + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + + +### Bug Fixes + +* **eslint-plugin:** [no-unnecessary-condition] allow nullish coalescing for naked type parameter ([#6910](https://github.com/typescript-eslint/typescript-eslint/issues/6910)) ([3e5f858](https://github.com/typescript-eslint/typescript-eslint/commit/3e5f8583f1e4fe045c2fe2143d6f280b7381f96b)) + + +### Features + +* **eslint-plugin:** [ban-types] add NonNullable suggestion and allow custom suggestions ([#6876](https://github.com/typescript-eslint/typescript-eslint/issues/6876)) ([ff65235](https://github.com/typescript-eslint/typescript-eslint/commit/ff65235246bb6214fb64f0e0317373ca99f8bcbe)) + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + + +### Bug Fixes + +* **eslint-plugin:** [unified-signatures] allow overloads with different named and different number of parameters ([#6877](https://github.com/typescript-eslint/typescript-eslint/issues/6877)) ([939d665](https://github.com/typescript-eslint/typescript-eslint/commit/939d6656ebcb94fab048a08d719b3e77362ab5b4)) +* update getLib for new TypeScript targets ES2021, ES2022 ([#6782](https://github.com/typescript-eslint/typescript-eslint/issues/6782)) ([1c04664](https://github.com/typescript-eslint/typescript-eslint/commit/1c0466414300f338c6c4111f8d1eac0c3e6a8983)) + + +### Features + +* **eslint-plugin:** [no-unsafe-enum-comparison] add rule ([#6107](https://github.com/typescript-eslint/typescript-eslint/issues/6107)) ([915f9c2](https://github.com/typescript-eslint/typescript-eslint/commit/915f9c2dc8934eef491a672786ec9f016f3658ba)) + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + + +### Bug Fixes + +* **eslint-plugin:** [strict-boolean-expressions] support mixed enums in allowNullableEnum option ([#6740](https://github.com/typescript-eslint/typescript-eslint/issues/6740)) ([49be8a8](https://github.com/typescript-eslint/typescript-eslint/commit/49be8a814c82f3784308ef5a6e90478eb56e55c1)) + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + + +### Bug Fixes + +* **eslint-plugin:** [no-unnecessary-boolean-literal-compare] simplify fixer and add support for double negation ([#6620](https://github.com/typescript-eslint/typescript-eslint/issues/6620)) ([81c8519](https://github.com/typescript-eslint/typescript-eslint/commit/81c85193d27d2e7f6d12bc259088b9b73dbe1e8b)) +* **eslint-plugin:** correct crashes with getTypeArguments for ts < 3.7 ([#6767](https://github.com/typescript-eslint/typescript-eslint/issues/6767)) ([59eab58](https://github.com/typescript-eslint/typescript-eslint/commit/59eab587890a915387444d00c4a9387aed602718)) + + +### Features + +* **eslint-plugin:** [consistent-type-assertions] add suggestions for objectLiteralTypeAssertions ([#6642](https://github.com/typescript-eslint/typescript-eslint/issues/6642)) ([720e811](https://github.com/typescript-eslint/typescript-eslint/commit/720e81138b66c94c60c4a4471b86b7d8567b6df0)) +* **eslint-plugin:** [consistent-type-assertions] autofix angle bracket assertions to as ([#6641](https://github.com/typescript-eslint/typescript-eslint/issues/6641)) ([ad8ea64](https://github.com/typescript-eslint/typescript-eslint/commit/ad8ea64dbdf06c92ff72b48022f041693a8d7076)) +* **eslint-plugin:** add `no-duplicate-type-constituents` rule ([#5728](https://github.com/typescript-eslint/typescript-eslint/issues/5728)) ([bc31078](https://github.com/typescript-eslint/typescript-eslint/commit/bc31078cf86d69eee881e4a7daeffa347c1d82a7)) + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0b78c2f34f4..031a9105d30 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,3 +1,12 @@ + + # Contributors Thanks goes to these wonderful people: @@ -9,7 +18,7 @@ Thanks goes to these wonderful people:
James Henry

Brad Zacher

Armano
-
Josh Goldberg
+
Josh Goldberg ✨

Oleksandr T.
@@ -17,10 +26,10 @@ Thanks goes to these wonderful people:
Reyad Attiyat

SUZUKI Sosuke

Gareth Jones
-
Patricio Trevino
+
Joshua Chen
-
Joshua Chen
+
Patricio Trevino

YeonJuan

Nicholas C. Zakas

Jed Fox
@@ -34,18 +43,36 @@ Thanks goes to these wonderful people:
Retsam
+
Kai Cataldo

Rasmus Eneman
+
Rebecca Stevens
+
Toru Nagashima
+
Yosuke Ota
+ +
JounQin
-
Zzzen
-
Daniil Dubrava
-
ldrick
+
Lucas Azzola
+
Omri Luzon
+
Simen Bekkhus
+
Danny Fritz
+ + +
Ika
+
Mackie Underdown
+
Sviatoslav Zaytsev
+
Bryan Mishkin
+
Kanitkorn Sujautra
+
SHIMA RYUHEI
+
Zzzen
+
Anix
+
Pete Gonzalez

Gavin Barron
-
Pavel Birukov
-
Daniel Cassidy
-
Daniel Nixon
-
James Garbutt
+ + +
Sylvia Favello
+ diff --git a/README.md b/README.md index fd3e232b0b7..c9474769f51 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,7 @@

- See main--typescript-eslint.netlify.app for documentation on the latest canary release. - -

-

- - See v6--typescript-eslint.netlify.app for documentation on upcoming v6 release. + See main--typescript-eslint.netlify.app for documentation on the latest canary release.

diff --git a/docs/Architecture.mdx b/docs/Architecture.mdx deleted file mode 100644 index ee224c1e90a..00000000000 --- a/docs/Architecture.mdx +++ /dev/null @@ -1,17 +0,0 @@ ---- -id: architecture -title: Architecture ---- - -The `@typescript-eslint/*` packages are built from a monorepo located at https://github.com/typescript-eslint/typescript-eslint. -The monorepo is built with [Lerna](https://lerna.js.org) and [Nx](https://nx.dev). - -Each page in this section corresponds to a package we intentionally expose to users. -They are: - -- [`@typescript-eslint/eslint-plugin`](./architecture/ESLint_Plugin.mdx): An ESLint plugin which provides lint rules for TypeScript codebases. -- [`@typescript-eslint/eslint-plugin-tslint`](./architecture/ESLint_Plugin_TSLint.mdx): ESLint plugin that allows running TSLint rules within ESLint to help you migrate from TSLint to ESLint. -- [`@typescript-eslint/parser`](./architecture/Parser.mdx): An ESLint parser which allows for ESLint to lint TypeScript source code. -- [`@typescript-eslint/scope-manager`](./architecture/Scope_Manager.mdx): A fork of [`eslint-scope`](https://github.com/eslint/eslint-scope), enhanced to support TypeScript functionality. -- [`@typescript-eslint/typescript-estree`](./architecture/TypeScript-ESTree.mdx): The underlying code used by [`@typescript-eslint/parser`](./architecture/Parser.mdx) that converts TypeScript source code into an ESTree-compatible form. -- [`@typescript-eslint/utils`](./architecture/Utils.mdx): Utilities for working with TypeScript + ESLint together. diff --git a/docs/Developers.mdx b/docs/Developers.mdx new file mode 100644 index 00000000000..e1658aa105b --- /dev/null +++ b/docs/Developers.mdx @@ -0,0 +1,10 @@ +--- +id: developers +title: Developers +--- + +These are the developer guides to working with the typescript-eslint tooling. +It's intended for use by third-parties who want to use our tools to build great things. + +> If you're reading this as a new developer: welcome to the community! +> We're happy to have you! ❤️‍🔥 diff --git a/docs/Getting_Started.mdx b/docs/Getting_Started.mdx index cdaf39899a9..40463088e58 100644 --- a/docs/Getting_Started.mdx +++ b/docs/Getting_Started.mdx @@ -20,6 +20,7 @@ npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugi Next, create a `.eslintrc.cjs` config file in the root of your project, and populate it with the following: ```js title=".eslintrc.cjs" +/* eslint-env node */ module.exports = { extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], parser: '@typescript-eslint/parser', @@ -57,22 +58,23 @@ ESLint will lint all TypeScript compatible files within the current folder, and ## Details -- You can read more about configuring ESLint [in their documentation on configuration](https://eslint.org/docs/user-guide/configuring). -- You can read more about the rules provided by ESLint [in their documentation on their rules](https://eslint.org/docs/rules/). -- You can read more about the rules provided by typescript-eslint in [our rules documentation](/rules). - -### Configuration Values - -- `parser: '@typescript-eslint/parser'` tells ESLint to use the [`@typescript-eslint/parser`](./architecture/Parser.mdx) package you installed to parse your source files. +- `parser: '@typescript-eslint/parser'` tells ESLint to use the [`@typescript-eslint/parser`](./packages/Parser.mdx) package you installed to parse your source files. - This is required, or else ESLint will throw errors as it tries to parse TypeScript code as if it were regular JavaScript. -- `plugins: ['@typescript-eslint']` tells ESLint to load the [`@typescript-eslint/eslint-plugin`](./architecture/ESLint_Plugin.mdx) package as a plugin. +- `plugins: ['@typescript-eslint']` tells ESLint to load the [`@typescript-eslint/eslint-plugin`](./packages/ESLint_Plugin.mdx) package as a plugin. - This allows you to use typescript-eslint's rules within your codebase. - `extends: [ ... ]` tells ESLint that your config extends the given configurations. - `eslint:recommended` is ESLint's inbuilt "recommended" config - it turns on a small, sensible set of rules which lint for well-known best-practices. - `plugin:@typescript-eslint/recommended` is our "recommended" config - it's similar to `eslint:recommended`, except it turns on TypeScript-specific rules from our plugin. +- `root: true` is a generally good ESLint practice to indicate this file is the root-level one used by the project and ESLint should not search beyond this directory for config files. ## Next Steps We provide a plethora of powerful rules that utilize the power of TypeScript's type information. [Visit the next page for a setup guide](./linting/Typed_Linting.mdx 'Visit the next page for a typed rules setup guide'). If you're having problems getting this working, please have a look at our [Troubleshooting & FAQs](./linting/Troubleshooting.mdx). + +### Documentation Resources + +- You can read more about configuring ESLint [in their documentation on configuration](https://eslint.org/docs/user-guide/configuring). +- You can read more about the rules provided by ESLint [in their documentation on their rules](https://eslint.org/docs/rules/). +- You can read more about the rules provided by typescript-eslint in [our rules documentation](/rules). diff --git a/docs/Maintenance.mdx b/docs/Maintenance.mdx index 75f1030c015..bc0db0d1e19 100644 --- a/docs/Maintenance.mdx +++ b/docs/Maintenance.mdx @@ -8,5 +8,7 @@ This is the maintainers guide to working on typescript-eslint. It's intended for use by contributors who have been given access to at least triage issues and pull requests. We keep it in the open for visibility into our processes. -> If you're reading this as a new maintainer: welcome! -> We're happy to have you! ❤️‍🔥 +:::info Welcome! +If you're reading this as a new maintainer: welcome! +We're happy to have you! ❤️‍🔥 +::: diff --git a/docs/Packages.mdx b/docs/Packages.mdx new file mode 100644 index 00000000000..e0eee8cf178 --- /dev/null +++ b/docs/Packages.mdx @@ -0,0 +1,18 @@ +--- +id: packages +title: Packages +--- + +The `@typescript-eslint/*` packages are all stored in [our GitHub monorepo](https://github.com/typescript-eslint/typescript-eslint). +The monorepo is built with [Lerna](https://lerna.js.org) and [Nx](https://nx.dev). + +Each page in this section corresponds to a package we intentionally expose to users. +They are: + +- [`@typescript-eslint/eslint-plugin`](./packages/ESLint_Plugin.mdx): An ESLint plugin which provides lint rules for TypeScript codebases. +- [`@typescript-eslint/eslint-plugin-tslint`](./packages/ESLint_Plugin_TSLint.mdx): An ESLint plugin that allows running TSLint rules within ESLint to help you migrate from TSLint to ESLint. +- [`@typescript-eslint/parser`](./packages/Parser.mdx): An ESLint parser which allows for ESLint to lint TypeScript source code. +- [`@typescript-eslint/rule-tester`](./packages/Rule_Tester.mdx): A utility for testing ESLint rules. +- [`@typescript-eslint/scope-manager`](./packages/Scope_Manager.mdx): A fork of [`eslint-scope`](https://github.com/eslint/eslint-scope), enhanced to support TypeScript functionality. +- [`@typescript-eslint/typescript-estree`](./packages/TypeScript_ESTree.mdx): The underlying code used by [`@typescript-eslint/parser`](./packages/Parser.mdx) that converts TypeScript source code into an [ESTree](https://github.com/estree/estree)-compatible form. +- [`@typescript-eslint/utils`](./packages/Utils.mdx): Utilities for working with TypeScript + ESLint together. diff --git a/docs/Users.mdx b/docs/Users.mdx new file mode 100644 index 00000000000..120d225240c --- /dev/null +++ b/docs/Users.mdx @@ -0,0 +1,12 @@ +--- +id: users +title: Users +--- + +These are the user guides to consuming the typescript-eslint tooling. +It's intended for users who want to consume our tools. + +:::info Welcome! +If you're reading this as a new user: welcome to the community! +We're happy to have you! ❤️‍🔥 +::: diff --git a/docs/contributing/Discussions.md b/docs/contributing/Discussions.mdx similarity index 92% rename from docs/contributing/Discussions.md rename to docs/contributing/Discussions.mdx index ac7fe9d875a..80c723157dd 100644 --- a/docs/contributing/Discussions.md +++ b/docs/contributing/Discussions.mdx @@ -23,5 +23,5 @@ We can always move an issue to a discussion if it becomes unexpectedly deep. :::caution Please don't use Discussions as a support forum. -See [Issues > Questions and Support Requests](./Issues.mdx#questions-and-support-requests). +See [Contributing > Issues > Questions and Support Requests](./Issues.mdx#questions-and-support-requests). ::: diff --git a/docs/contributing/Issues.mdx b/docs/contributing/Issues.mdx index bd4620a9d72..90531020ebf 100644 --- a/docs/contributing/Issues.mdx +++ b/docs/contributing/Issues.mdx @@ -31,7 +31,7 @@ Please don't: The issue tracker is not an appropriate place for questions or support requests. You can instead: -- Ask in our [Discord channel](https://discord.gg/FSxKq8Tdyg)'s `#help` server +- Ask in our [Discord server](https://discord.gg/FSxKq8Tdyg)'s `#help` server - Ask a question on [StackOverflow](https://stackoverflow.com/questions/tagged/typescript-eslint 'StackOverflow questions tagged with typescript-eslint') using the `typescript-eslint` tag - Publicly toot [@tseslint on Mastodon](https://fosstodon.org/@tseslint) or tweet [@tseslint on Twitter](https://twitter.com/tseslint) diff --git a/docs/contributing/Local_Development.mdx b/docs/contributing/Local_Development.mdx index 3f85bd9c90b..0b23be5c4a9 100644 --- a/docs/contributing/Local_Development.mdx +++ b/docs/contributing/Local_Development.mdx @@ -32,7 +32,7 @@ For example, if you make a change within `scope-manager` and want to use it in ` The following checks are all run on pull requests automatically. You can also perform them locally. -> See [Contributing > Pull Requests](../Contributing.mdx#raising-a-pr) for more information on pull requests. +> See [Contributing > Pull Requests](./Pull_Requests.mdx) for more information on pull requests. ### Formatting diff --git a/docs/contributing/Pull_Requests.mdx b/docs/contributing/Pull_Requests.mdx index 36059661b4b..c2c99aa06a6 100644 --- a/docs/contributing/Pull_Requests.mdx +++ b/docs/contributing/Pull_Requests.mdx @@ -35,7 +35,7 @@ The title of your PR should match the following format: You can find more samples of good past PR titles in [recent commits to `main`](https://github.com/typescript-eslint/typescript-eslint/commits/main): - `fix(scope-manager): correct handling for class static blocks` -- `docs: Fix links to getting started in README.md` +- `docs: fix links to getting started in README.md` Within the body of your PR, make sure you reference the issue that you have worked on, as well as pointing out anything of note you wish us to look at during our review. @@ -81,3 +81,9 @@ You can [resolve conversations](https://docs.github.com/en/pull-requests/collabo Once you've addressed all our feedback by making code changes and/or started a followup discussion, [re-request review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/about-pull-request-reviews#re-requesting-a-review) from each maintainer whose feedback you addressed. Once the feedback is addressed, and the PR is approved, we'll ensure the branch is up to date with `main`, and merge it for you. + +### Asking Questions + +If you need help and/or have a question, posting a comment in the PR is a great way to do so. +There's no need to tag anybody individually. +One of us will drop by and help when we can. diff --git a/docs/Custom_Rules.mdx b/docs/developers/Custom_Rules.mdx similarity index 78% rename from docs/Custom_Rules.mdx rename to docs/developers/Custom_Rules.mdx index 56cc7899792..29ed9adde0e 100644 --- a/docs/Custom_Rules.mdx +++ b/docs/developers/Custom_Rules.mdx @@ -1,12 +1,12 @@ --- id: custom-rules -sidebar_label: Custom Rules +sidebar_label: Building Custom Rules title: Custom Rules --- :::important This page describes how to write your own custom ESLint rules using typescript-eslint. -You should be familiar with [ESLint's developer guide](https://eslint.org/docs/developer-guide) and [ASTs](https://typescript-eslint.io/blog/asts-and-typescript-eslint) before writing custom rules. +You should be familiar with [ESLint's developer guide](https://eslint.org/docs/developer-guide) and [ASTs](/blog/asts-and-typescript-eslint) before writing custom rules. ::: As long as you are using `@typescript-eslint/parser` as the `parser` in your ESLint configuration, custom ESLint rules generally work the same way for JavaScript and TypeScript code. @@ -18,7 +18,7 @@ The main three changes to custom rules writing are: ## Utils Package -The [`@typescript-eslint/utils`](./architecture/Utils.mdx) package acts as a replacement package for `eslint` that exports all the same objects and types, but with typescript-eslint support. +The [`@typescript-eslint/utils`](../packages/Utils.mdx) package acts as a replacement package for `eslint` that exports all the same objects and types, but with typescript-eslint support. It also exports common utility functions and constants most custom typescript-eslint rules tend to use. :::caution @@ -63,7 +63,6 @@ export const rule = createRule({ docs: { description: 'Function declaration names should start with an upper-case letter.', - recommended: 'warn', }, messages: { uppercase: 'Start this name with an upper-case letter.', @@ -210,38 +209,40 @@ Read TypeScript's [Compiler APIs > Using the Type Checker](https://github.com/mi The biggest addition typescript-eslint brings to ESLint rules is the ability to use TypeScript's type checker APIs. -`@typescript-eslint/utils` exports an `ESLintUtils` namespace containing a `getParserServices` function that takes in an ESLint context and returns a `parserServices` object. +`@typescript-eslint/utils` exports an `ESLintUtils` namespace containing a `getParserServices` function that takes in an ESLint context and returns a `services` object. -That `parserServices` object contains: +That `services` object contains: -- `program`: A full TypeScript `ts.Program` object +- `program`: A full TypeScript `ts.Program` object if type checking is enabled, or `null` otherwise - `esTreeNodeToTSNodeMap`: Map of `@typescript-eslint/estree` `TSESTree.Node` nodes to their TypeScript `ts.Node` equivalents - `tsNodeToESTreeNodeMap`: Map of TypeScript `ts.Node` nodes to their `@typescript-eslint/estree` `TSESTree.Node` equivalents -By mapping from ESTree nodes to TypeScript nodes and retrieving the TypeScript program from the parser services, rules are able to ask TypeScript for full type information on those nodes. +If type checking is enabled, that `services` object additionally contains: -This rule bans for-of looping over an enum by using the type-checker via typescript-eslint and TypeScript APIs: +- `getTypeAtLocation`: Wraps the type checker function, with a `TSESTree.Node` parameter instead of a `ts.Node` +- `getSymbolAtLocation`: Wraps the type checker function, with a `TSESTree.Node` parameter instead of a `ts.Node` + +Those additional objects internally map from ESTree nodes to their TypeScript equivalents, then call to the TypeScript program. +By using the TypeScript program from the parser services, rules are able to ask TypeScript for full type information on those nodes. + +This rule bans for-of looping over an enum by using the TypeScript type checker via typescript-eslint's services: ```ts import { ESLintUtils } from '@typescript-eslint/utils'; +import * as tsutils from 'ts-api-tools'; import * as ts from 'typescript'; -import * as tsutils from 'tsutils'; export const rule = createRule({ create(context) { return { ForOfStatement(node) { - // 1. Grab the TypeScript program from parser services - const parserServices = ESLintUtils.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + // 1. Grab the parser services for the rule + const services = ESLintUtils.getParserServices(context); - // 2. Find the backing TS node for the ES node, then that TS type - const originalNode = parserServices.esTreeNodeToTSNodeMap.get( - node.right, - ); - const nodeType = checker.getTypeAtLocation(originalNode); + // 2. Find the TS type for the ES node + const type = services.getTypeAtLocation(node); - // 3. Check the TS node type using the TypeScript APIs + // 3. Check the TS type using the TypeScript APIs if (tsutils.isTypeFlagSet(nodeType, ts.TypeFlags.EnumLike)) { context.report({ messageId: 'loopOverEnum', @@ -254,7 +255,6 @@ export const rule = createRule({ meta: { docs: { description: 'Avoid looping over enums.', - recommended: 'error', }, messages: { loopOverEnum: 'Do not loop over enums.', @@ -267,20 +267,27 @@ export const rule = createRule({ }); ``` +:::note +Rules can retrieve their full backing TypeScript type checker with `services.program.getTypeChecker()`. +This can be necessary for TypeScript APIs not wrapped by the parser services. +::: + ## Testing -`@typescript-eslint/utils` exports a `RuleTester` with a similar API to the built-in [ESLint `RuleTester`](https://eslint.org/docs/developer-guide/nodejs-api#ruletester). +`@typescript-eslint/rule-tester` exports a `RuleTester` with a similar API to the built-in ESLint `RuleTester`. It should be provided with the same `parser` and `parserOptions` you would use in your ESLint configuration. +Below is a quick-start guide. For more in-depth docs and examples [see the `@typescript-eslint/rule-tester` package documentation](../packages/Rule_Tester.mdx). + ### Testing Untyped Rules For rules that don't need type information, passing just the `parser` will do: ```ts -import { ESLintUtils } from '@typescript-eslint/utils'; +import { RuleTester } from '@typescript-eslint/rule-tester'; import rule from './my-rule'; -const ruleTester = new ESLintUtils.RuleTester({ +const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); @@ -300,10 +307,10 @@ For rules that do need type information, `parserOptions` must be passed in as we Tests must have at least an absolute `tsconfigRootDir` path provided as well as a relative `project` path from that directory: ```ts -import { ESLintUtils } from '@typescript-eslint/utils'; +import { RuleTester } from '@typescript-eslint/rule-tester'; import rule from './my-typed-rule'; -const ruleTester = new ESLintUtils.RuleTester({ +const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { project: './tsconfig.json', @@ -322,11 +329,11 @@ ruleTester.run('my-typed-rule', rule, { ``` :::note -For now, `ESLintUtils.RuleTester` requires the following physical files be present on disk for typed rules: +For now, `RuleTester` requires the following physical files be present on disk for typed rules: - `tsconfig.json`: tsconfig used as the test "project" - One of the following two files: - `file.ts`: blank test file used for normal TS tests - - `file.tsx`: blank test file used for tests with `parserOptions: { ecmaFeatures: { jsx: true } }` + - `react.tsx`: blank test file used for tests with `parserOptions: { ecmaFeatures: { jsx: true } }` ::: diff --git a/docs/linting/CONFIGURATIONS.mdx b/docs/linting/CONFIGURATIONS.mdx deleted file mode 100644 index 10d3f6293d5..00000000000 --- a/docs/linting/CONFIGURATIONS.mdx +++ /dev/null @@ -1,141 +0,0 @@ ---- -id: configs -title: Configurations ---- - -[ESLint shareable configurations](https://eslint.org/docs/latest/developer-guide/shareable-configs) exist to provide a comprehensive base config for you. -`@typescript-eslint/eslint-plugin` includes built-in configurations you can extend from to pull in the recommended starting rules. - -> With the exception of `strict`, all configurations are considered "stable". -> Rule additions and removals are treated as breaking changes and will only be done in major version bumps. - -## Recommended Configurations - -Most projects should extend from at least one of: - -- [`recommended`](#recommended): Recommended rules for code correctness that you can drop in without additional configuration. -- [`recommended-requiring-type-checking`](#recommended-requiring-type-checking): Additional recommended rules that require type information. -- [`strict`](#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. - -:::tip -We recommend most projects use [`recommended-requiring-type-checking`](#recommended-requiring-type-checking) (which requires [typed linting](./Typed_Linting.mdx)). -::: - -:::note -These configurations are our recommended starting points, but **you don't need to use them as-is**. -ESLint allows configuring own rule settings on top of extended configurations. -See [ESLint's Configuring Rules docs](https://eslint.org/docs/user-guide/configuring/rules#using-configuration-files). -::: - -### `recommended` - -Recommended rules for code correctness that you can drop in without additional configuration. -These rules are those whose reports are almost always for a bad practice and/or likely bug. -`recommended` also disables rules known to conflict with this repository, or cause issues in TypeScript codebases. - -```json -{ - "extends": ["plugin:@typescript-eslint/recommended"] -} -``` - -See [`configs/recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts) for the exact contents of this config. - -:::tip -We strongly recommend all TypeScript projects extend from `plugin:@typescript-eslint/recommended`. -::: - -### `recommended-requiring-type-checking` - -Additional recommended rules that require type information. -Rules in this configuration are similarly useful to those in `recommended`. - -```json -{ - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" - ] -} -``` - -See [`configs/recommended-requiring-type-checking.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts) for the exact contents of this config. - -:::tip -We recommend all TypeScript projects extend from `plugin:@typescript-eslint/recommended-requiring-type-checking`, with the caveat that rules using type information take longer to run. -See [Linting with Type Information](/linting/typed-linting) for more details. -::: - -### `strict` - -Additional strict rules that can also catch bugs but are more opinionated than recommended rules. - -```json -{ - "extends": [ - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking", - "plugin:@typescript-eslint/strict" - ] -} -``` - -See [`configs/strict.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts) for the exact contents of this config. - -:::caution -We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict` only if a nontrivial percentage of its developers are highly proficient in TypeScript. -::: - -## Other Configurations - -typescript-eslint includes a scattering of utility configurations used by the recommended configurations. -We don't recommend using these directly; instead, extend from an earlier recommended rule. - -### `all` - -Enables each the rules provided as a part of typescript-eslint. -Note that many rules are not applicable in all codebases, or are meant to be configured. - -See [`configs/all.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/all.ts) for the exact contents of this config. - -:::warning -We do not recommend a TypeScript projects extend from `plugin:@typescript-eslint/all`. -Many rules conflict with each other and/or are intended to be configured per-project. -::: - -### `base` - -A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint. - - - -This config is automatically included if you use any of the recommended configurations. - -### `eslint-recommended` - -This ruleset is meant to be used after extending `eslint:recommended`. -It disables core ESLint rules that are already checked by the TypeScript compiler. -Additionally, it enables rules that promote using the more modern constructs TypeScript allows for. - -```jsonc -{ - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/eslint-recommended" - ] -} -``` - -This config is automatically included if you use any of the recommended configurations. - -See [`configs/eslint-recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts) for the exact contents of this config. - -## Suggesting Configuration Changes - -If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning. - -## Formatting - -None of the preset configs provided by typescript-eslint enable formatting rules (rules that only serve to enforce code whitespace and other trivia). -We strongly recommend you use Prettier or an equivalent for formatting your code, not ESLint formatting rules. -See [What About Formatting? > Suggested Usage](./troubleshooting/formatting#suggested-usage). diff --git a/docs/linting/Configurations.mdx b/docs/linting/Configurations.mdx new file mode 100644 index 00000000000..215a5ec0168 --- /dev/null +++ b/docs/linting/Configurations.mdx @@ -0,0 +1,232 @@ +--- +id: configs +title: Configurations +--- + +[ESLint shareable configurations](https://eslint.org/docs/latest/developer-guide/shareable-configs) exist to provide a comprehensive list of rules settings that you can start with. +`@typescript-eslint/eslint-plugin` includes built-in configurations you can extend from to pull in the recommended starting rules. + +> With the exception of `all`, `strict`, and `strict-type-checked`, all configurations are considered "stable". +> Rule additions and removals are treated as breaking changes and will only be done in major version bumps. + +## Getting Started + +### Projects Without Type Checking + +If your project does not enable [typed linting](./Typed_Linting.mdx), we suggest enabling the [`recommended`](#recommended) and [`stylistic`](#stylistic) configurations to start: + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/stylistic', + ], +}; +``` + +> If a majority of developers working on your project are comfortable with TypeScript and typescript-eslint, consider replacing `recommended` with `strict`. + +### Projects With Type Checking + +If your project enables [typed linting](./Typed_Linting.mdx), we suggest enabling the [`recommended-type-checked`](#recommended-type-checked) and [`stylistic-type-checked`](#stylistic-type-checked) configurations to start: + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended-type-checked', + 'plugin:@typescript-eslint/stylistic-type-checked', + ], +}; +``` + +> If a majority of developers working on your project are comfortable with TypeScript and typescript-eslint, consider replacing `recommended-type-checked` with `strict-type-checked`. + +## Recommended Configurations + +We recommend that most projects should extend from one of: + +- [`recommended`](#recommended): Recommended rules for code correctness that you can drop in without additional configuration. +- [`recommended-type-checked`](#recommended-type-checked): Additional recommended rules that require type information. +- [`strict`](#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. +- [`strict-type-checked`](#strict-type-checked): Additional strict rules require type information. + +Additionally, we provide a [`stylistic`](#stylistic) config that enforces concise and consistent code. +We recommend that most projects should extend from either: + +- [`stylistic`](#stylistic): Stylistic rules you can drop in without additional configuration. +- [`stylistic-type-checked`](#stylistic-type-checked): Additional stylistic rules that require type information. + +:::note +These configurations are our recommended starting points, but **you don't need to use them as-is**. +ESLint allows configuring own rule settings on top of extended configurations. +See [ESLint's Configuring Rules docs](https://eslint.org/docs/user-guide/configuring/rules#using-configuration-files). +::: + +### `recommended` + +Recommended rules for code correctness that you can drop in without additional configuration. +These rules are those whose reports are almost always for a bad practice and/or likely bug. +`recommended` also disables core ESLint rules known to conflict with typescript-eslint rules or cause issues in TypeScript codebases. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/recommended'], +}; +``` + +See [`configs/recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended.ts) for the exact contents of this config. + +### `recommended-type-checked` + +Contains all of `recommended` along with additional recommended rules that require type information. +Rules newly added in this configuration are similarly useful to those in `recommended`. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/recommended-type-checked'], +}; +``` + +See [`configs/recommended-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/recommended-type-checked.ts) for the exact contents of this config. + +### `strict` + +Contains all of `recommended`, as well as additional strict rules that can also catch bugs. +Rules added in `strict` are more opinionated than recommended rules and might not apply to all projects. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/strict'], +}; +``` + +See [`configs/strict.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict.ts) for the exact contents of this config. + +:::caution +We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict` only if a nontrivial percentage of its developers are highly proficient in TypeScript. +::: + +### `strict-type-checked` + +Contains all of `recommended`, `recommended-type-checked`, and `strict`, along with additional strict rules that require type information. +Rules newly added in this configuration are similarly useful (and opinionated) to those in `strict`. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/strict-type-checked'], +}; +``` + +See [`configs/strict-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/strict-type-checked.ts) for the exact contents of this config. + +:::caution +We recommend a TypeScript project extend from `plugin:@typescript-eslint/strict-type-checked` only if a nontrivial percentage of its developers are highly proficient in TypeScript. +::: + +### `stylistic` + +Rules considered to be best practice for modern TypeScript codebases, but that do not impact program logic. +These rules are generally opinionated about enforcing simpler code patterns. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/stylistic'], +}; +``` + +See [`configs/stylistic.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic.ts) for the exact contents of this config. + +### `stylistic-type-checked` + +Contains all of `stylistic`, along with additional stylistic rules that require type information. +Rules newly added in this configuration are similarly opinionated to those in `stylistic`. + +```js title=".eslintrc.js" +module.exports = { + extends: ['plugin:@typescript-eslint/stylistic-type-checked'], +}; +``` + +See [`configs/stylistic-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/stylistic-type-checked.ts) for the exact contents of this config. + +## Other Configurations + +typescript-eslint includes a few utility configurations. + +### `all` + +Enables each the rules provided as a part of typescript-eslint. +Note that many rules are not applicable in all codebases, or are meant to be configured. + +See [`configs/all.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/all.ts) for the exact contents of this config. + +:::warning +We do not recommend TypeScript projects extend from `plugin:@typescript-eslint/all`. +Many rules conflict with each other and/or are intended to be configured per-project. +::: + +### `base` + +A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint. +We don't recommend using this directly; instead, extend from an earlier recommended rule. + +This config is automatically included if you use any of the recommended configurations. + +See [`configs/base.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/base.ts) for the exact contents of this config. + +### `disable-type-checked` + +A utility ruleset that will disable type-aware linting and all type-aware rules available in our project. +This config is useful if you'd like to have your base config concerned with type-aware linting, and then conditionally use [overrides](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-based-on-glob-patterns) to disable type-aware linting on specific subsets of your codebase. + +See [`configs/disable-type-checked.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/disable-type-checked.ts) for the exact contents of this config. + +:::info +If you use type-aware rules from other plugins, you will need to manually disable these rules or use a premade config they provide to disable them. +::: + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + ], + overrides: [ + { + files: ['*.js'], + extends: ['plugin:@typescript-eslint/disable-type-checked'], + }, + ], +}; +``` + +### `eslint-recommended` + +This ruleset is meant to be used after extending `eslint:recommended`. +It disables core ESLint rules that are already checked by the TypeScript compiler. +Additionally, it enables rules that promote using the more modern constructs TypeScript allows for. + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + ], +}; +``` + +This config is automatically included if you use any of the recommended configurations. + +See [`configs/eslint-recommended.ts`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts) for the exact contents of this config. + +## Suggesting Configuration Changes + +If you feel strongly that a specific rule should (or should not) be one of these configurations, please [file an issue](https://github.com/typescript-eslint/typescript-eslint/issues/new?assignees=&labels=package%3A+eslint-plugin%2Cpreset+config+change%2Ctriage&template=09-config-change.yaml&title=Configs%3A+%3Ca+short+description+of+my+proposal%3E) along with a **detailed** argument explaining your reasoning. + +## Formatting + +None of the preset configs provided by typescript-eslint enable formatting rules (rules that only serve to enforce code whitespace and other trivia). +We strongly recommend you use Prettier or an equivalent for formatting your code, not ESLint formatting rules. +See [What About Formatting? > Suggested Usage](./troubleshooting/formatting#suggested-usage). diff --git a/docs/linting/Troubleshooting.mdx b/docs/linting/Troubleshooting.mdx index f29eabc12c3..2393a533a1d 100644 --- a/docs/linting/Troubleshooting.mdx +++ b/docs/linting/Troubleshooting.mdx @@ -7,7 +7,7 @@ title: Troubleshooting & FAQs This happens because TypeScript adds new features that ESLint doesn't know about. -The first step is to [check our list of "extension" rules here](https://typescript-eslint.io/rules/#extension-rules). +The first step is to [check our list of "extension" rules here](/rules/#extension-rules). An extension rule is a rule which extends the base ESLint rules to support TypeScript syntax. If you find it in there, give it a go to see if it works for you. You can configure it by disabling the base rule, and turning on the extension rule. @@ -23,28 +23,74 @@ Here's an example with the `semi` rule: ``` If you don't find an existing extension rule, or the extension rule doesn't work for your case, then you can go ahead and check our issues. -[The contributing guide outlines the best way to raise an issue](https://github.com/typescript-eslint/typescript-eslint/blob/main/CONTRIBUTING.md#raising-issues). +[The contributing guide outlines the best way to raise an issue](../contributing/Issues.mdx). > We release a new version our tooling every week. -> _Please_ ensure that you [check our the latest list of "extension" rules](https://typescript-eslint.io/rules/#extension-rules) **_before_** filing an issue. +> _Please_ ensure that you [check our the latest list of "extension" rules](/rules/#extension-rules) **_before_** filing an issue. ## I get errors telling me "ESLint was configured to run ... However, that TSConfig does not / none of those TSConfigs include this file" +These errors are caused by an ESLint config requesting type information be generated for a file that isn't included in the TypeScript configuration. + ### Fixing the Error + + - If you **do not** want to lint the file: - Use [one of the options ESLint offers](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code) to ignore files, namely a `.eslintignore` file, or `ignorePatterns` config. - If you **do** want to lint the file: - If you **do not** want to lint the file with [type-aware linting](./Typed_Linting.mdx): - - Use [ESLint's `overrides` configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) to configure the file to not be parsed with type information. - - A popular setup is to omit the above additions from top-level configuration and only apply them to TypeScript files via an override. - - Alternatively, you can add `parserOptions: { project: null }` to an override for the files you wish to exclude. Note that `{ project: undefined }` will not work. + - Use [ESLint's `overrides` configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-based-on-glob-patterns) to configure the file to not be parsed with type information: +

+ + A popular setup is to remove all rules requiring type information from the top-level configuration + and only apply them to TypeScript files via an override. + + + ```js title=".eslintrc.cjs" + module.exports = { + // ... the rest of your config ... + overrides: [ + { + extends: [ + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + ], + files: ['./**/*.{ts,tsx}'], + }, + ], + }; + ``` + +
+
+ + Alternatively, in our version v6, you can use our{' '} + disable-type-checked config to disable type checking for just that type of file. + + + ```js title=".eslintrc.cjs" + module.exports = { + // ... the rest of your config ... + overrides: [ + { + extends: ['plugin:@typescript-eslint/disable-type-checked'], + files: ['./**/*.js'], + }, + ], + }; + ``` + To disable type checking for files manually, set `parserOptions: { project: null }` to an override for the files you wish to exclude. Note that `{ project: undefined }` will not work, and you'll also need to disable any rules or rule options that require type checking. +
+ - If you **do** want to lint the file with [type-aware linting](./Typed_Linting.mdx): - - Check the `include` option of each of the tsconfigs that you provide to `parserOptions.project` - you must ensure that all files match an `include` glob, or else our tooling will not be able to find it. + - Check the `include` option of each of the TSConfigs that you provide to `parserOptions.project` - you must ensure that all files match an `include` glob, or else our tooling will not be able to find it. + - If the file is a `.cjs`, `.js`, or `.mjs` file, make sure [`allowJs`](https://www.typescriptlang.org/tsconfig#allowJs) is enabled. - If your file shouldn't be a part of one of your existing tsconfigs (for example, it is a script/tool local to the repo), then consider creating a new tsconfig (we advise calling it `tsconfig.eslint.json`) in your project root which lists this file in its `include`. For an example of this, you can check out the configuration we use in this repo: - [`tsconfig.eslint.json`](https://github.com/typescript-eslint/typescript-eslint/blob/main/tsconfig.eslint.json) - [`.eslintrc.js`](https://github.com/typescript-eslint/typescript-eslint/blob/main/.eslintrc.js) + + ### More Details This error may appear from the combination of two things: @@ -71,6 +117,42 @@ See our docs on [type aware linting](./Typed_Linting.mdx) for more information. You're using an outdated version of `@typescript-eslint/parser`. Update to the latest version to see a more informative version of this error message, explained [above](#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file 'backlink to I get errors telling me ESLint was configured to run ...'). +## How do I turn on a `@typescript-eslint` rule? + +First make sure you've read the docs and understand ESLint configuration files: + +- [Read our getting started guide](../Getting_Started.mdx) to ensure your config is properly setup to start configuring our rules. +- [Checkout ESLint's documentation on configuring rules](https://eslint.org/docs/latest/use/configure/rules) to ensure you understand how to configure rules. + +Our [rule docs](/rules) detail the options each rule supports under the "Options" heading. +We use TypeScript types to describe an `Options` tuple type for the rule which you can use to configure the a rule. +In your config file the keys of the `rules` object are the names of the rules you wish to configure and the values follow the following form: + +```ts +type Severity = 'off' | 'warn' | 'error'; +type RuleConfig = + | Severity + | [Severity] + | [ + Severiy, + // Options is the tuple type from the rule docs + ...Options, + ]; +``` + +Some examples + +```js title=".eslintrc.js" +module.exports = { + rules: { + // turns a rule on with no configuration (i.e. uses the default configuration) + '@typescript-eslint/array-type': 'error', + // turns on a rule with configuration + '@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }], + }, +}; +``` + ## I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config" You can use `parserOptions.extraFileExtensions` to specify an array of non-TypeScript extensions to allow, for example: @@ -125,7 +207,7 @@ See [#2041](https://github.com/typescript-eslint/typescript-eslint/issues/2041) ESLint core contains the rule [`no-restricted-syntax`](https://eslint.org/docs/rules/no-restricted-syntax). This generic rule allows you to specify a [selector](https://eslint.org/docs/developer-guide/selectors) for the code you want to ban, along with a custom error message. -You can use an AST visualization tool such as [typescript-eslint playground](https://typescript-eslint.io/play#showAST=es) > _Options_ > _AST Explorer_ on its left sidebar by selecting _ESTree_ to help in figuring out the structure of the AST that you want to ban. +You can use an AST visualization tool such as [typescript-eslint playground](/play#showAST=es) > _Options_ > _AST Explorer_ on its left sidebar by selecting _ESTree_ to help in figuring out the structure of the AST that you want to ban. For example, you can ban enums (or some variation of) using one of the following configs: @@ -244,8 +326,36 @@ See [this issue comment](https://github.com/typescript-eslint/typescript-eslint/ ### I get `no-unsafe-*` complaints for cross-file changes See [Changes to one file are not reflected in linting other files in my IDE](#changes-to-one-file-are-not-reflected-when-linting-other-files-in-my-ide). -Rules such as [`no-unsafe-argument`](https://typescript-eslint.io/rules/no-unsafe-argument), [`no-unsafe-assignment`](https://typescript-eslint.io/rules/no-unsafe-assignment), and [`no-unsafe-call`](https://typescript-eslint.io/rules/no-unsafe-call) are often impacted. +Rules such as [`no-unsafe-argument`](/rules/no-unsafe-argument), [`no-unsafe-assignment`](/rules/no-unsafe-assignment), and [`no-unsafe-call`](/rules/no-unsafe-call) are often impacted. + +## "The '``' property is deprecated on '``' nodes. Use '``' instead." warnings + +If you're seeing this warning, it's likely you're using an ESLint plugin (or other tooling) that hasn't been updated for typescript-eslint v6. +Make sure you're using the latest versions of each of your ESLint plugins (and other tooling). + +If you've using many ESLint plugins, have updated each to their latest version, and you're not sure which one this complaint is coming from, try disabling half of them at a time to narrow down which plugin it is. +Then make sure each of those plugins has a GitHub issue asking that they release a version supporting typescript-eslint v6. + +:::tip +For developers updating ESLint rules in plugins that still need to support typescript-eslint v5: you may need to `||` fall back to the old property key if the new one doesn't exist: + +```diff +- node.typeParameters ++ node.typeArguments || node.typeParameters +``` + +::: + +For more context, see the [Some properties named typeParameters instead of typeArguments](https://github.com/typescript-eslint/typescript-eslint/issues/146) issue, and the implementing [fix: rename typeParameters to typeArguments where needed](https://github.com/typescript-eslint/typescript-eslint/pull/5384) pull request. + +The [typescript-eslint v6 release post](https://deploy-preview-6515--typescript-eslint.netlify.app/blog/announcing-typescript-eslint-v6-beta) has more information on typescript-eslint v6. ## My linting feels really slow -If you think you're having issues with performance, see our [Performance Troubleshooting documentation](./troubleshooting/Performance.md). +If you think you're having issues with performance, see our [Performance Troubleshooting documentation](./troubleshooting/Performance.mdx). + +## Are TypeScript project references supported? + +No, TypeScript project references are not yet supported. + +See [issue #2094 discussing project references](https://github.com/typescript-eslint/typescript-eslint/issues/2094) for more details. diff --git a/docs/linting/Typed_Linting.mdx b/docs/linting/Typed_Linting.mdx index a51afdad02b..290aca7d392 100644 --- a/docs/linting/Typed_Linting.mdx +++ b/docs/linting/Typed_Linting.mdx @@ -6,13 +6,14 @@ title: Linting with Type Information Some typescript-eslint rules utilize the awesome power of TypeScript's type checking APIs to provide much deeper insights into your code. To tap into TypeScript's additional powers, there are two small changes you need to make to your config file: -```js title=".eslintrc.js" +```js title=".eslintrc.cjs" +/* eslint-env node */ module.exports = { extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', // Add this line - 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:@typescript-eslint/recommended-type-checked', ], plugins: ['@typescript-eslint'], parser: '@typescript-eslint/parser', @@ -26,12 +27,17 @@ module.exports = { }; ``` +:::caution +Your `.eslintrc.cjs` file may start receiving a parsing error about type information. +See [our TSConfig inclusion FAQ](./Troubleshooting.mdx#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file). +::: + In more detail: -- `plugin:@typescript-eslint/recommended-requiring-type-checking` is another [recommended configuration](./CONFIGURATIONS.mdx) we provide. This one contains recommended rules that additionally require type information. -- `parserOptions.project` tells our parser the relative path where your project's `tsconfig.json` is. +- `plugin:@typescript-eslint/recommended-type-checked` is another [recommended configuration](./Configurations.mdx) we provide. This one contains recommended rules that additionally require type information. +- `parserOptions.project` tells our parser how to find the TSConfig for each source file (`true` indicates to find the closest `tsconfig.json` for each source file) - If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/Monorepos.mdx). -- `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory (see [Parser#tsconfigRootDir](../architecture/Parser.mdx#tsconfigRootDir)). +- `parserOptions.tsconfigRootDir` tells our parser the absolute path of your project's root directory (see [Parser#tsconfigRootDir](../packages/Parser.mdx#tsconfigRootDir)). With that done, run the same lint command you ran before. You may see new rules reporting errors based on type information! @@ -41,7 +47,7 @@ You may see new rules reporting errors based on type information! The `parserOptions.project` option can be turned on with either: - `true`: to always use `tsconfig.json`s nearest to source files -- `string | string[]`: any number of glob paths to match TSConfig files relative to the +- `string | string[]`: any number of glob paths to match TSConfig files relative to `parserOptions.tsconfigRootDir`, or the current working directory if that is not provided For example, if you use a specific `tsconfig.eslint.json` for linting, you'd specify: @@ -55,7 +61,7 @@ module.exports = { }; ``` -See [the `@typescript-eslint/parser` docs for more details](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/README.md#parseroptionsproject). +See [the `@typescript-eslint/parser` docs for more details](../packages/Parser.mdx#project). :::note If your project is a multi-package monorepo, see [our docs on configuring a monorepo](./typed-linting/Monorepos.mdx). @@ -63,6 +69,39 @@ If your project is a multi-package monorepo, see [our docs on configuring a mono ## FAQs +### How can I disable type-aware linting for a subset of files? + +You can combine ESLint's [overrides](https://eslint.org/docs/latest/use/configure/configuration-files#configuration-based-on-glob-patterns) config in conjunction with our [`disable-type-checked`](./Configurations.mdx#disable-type-checked) config to turn off type-aware linting on specific subsets of files. + +```js title=".eslintrc.js" +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-type-checked', + ], + plugins: ['@typescript-eslint'], + parser: '@typescript-eslint/parser', + parserOptions: { + project: true, + tsconfigRootDir: __dirname, + }, + root: true, + // Added lines start + overrides: [ + { + files: ['*.js'], + extends: ['plugin:@typescript-eslint/disable-type-checked'], + }, + ], + // Added lines end +}; +``` + +:::info +If you use type-aware rules from other plugins, you will need to manually disable these rules or use a premade config they provide to disable them. +::: + ### How is performance? Typed rules come with a catch. diff --git a/docs/linting/troubleshooting/Formatting.mdx b/docs/linting/troubleshooting/Formatting.mdx index 345ac00acf4..fecec612bdc 100644 --- a/docs/linting/troubleshooting/Formatting.mdx +++ b/docs/linting/troubleshooting/Formatting.mdx @@ -38,6 +38,7 @@ You can then configure your formatter separately from ESLint. Using this config by adding it to the end of your `extends`: ```js title=".eslintrc.js" +/* eslint-env node */ module.exports = { extends: [ 'eslint:recommended', diff --git a/docs/linting/troubleshooting/Performance.md b/docs/linting/troubleshooting/Performance.mdx similarity index 100% rename from docs/linting/troubleshooting/Performance.md rename to docs/linting/troubleshooting/Performance.mdx diff --git a/docs/linting/troubleshooting/TSLint.mdx b/docs/linting/troubleshooting/TSLint.mdx index cc55ee62617..29e778aec93 100644 --- a/docs/linting/troubleshooting/TSLint.mdx +++ b/docs/linting/troubleshooting/TSLint.mdx @@ -17,7 +17,7 @@ You can look at [the alternatives list](https://github.com/typescript-eslint/typ There is also the ultimate fallback option of using both linters together for a while during your transition if you absolutely have to by using TSLint _within_ ESLint. -For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](../../architecture/ESLint_Plugin_TSLint.mdx). +For this option, check out [`@typescript-eslint/eslint-plugin-tslint`](../../packages/ESLint_Plugin_TSLint.mdx). ## Why Deprecate TSLint? diff --git a/docs/linting/typed-linting/Monorepos.mdx b/docs/linting/typed-linting/Monorepos.mdx index 9d0d67e331f..43f688062b7 100644 --- a/docs/linting/typed-linting/Monorepos.mdx +++ b/docs/linting/typed-linting/Monorepos.mdx @@ -43,11 +43,12 @@ Paths may be provided as [Node globs](https://github.com/isaacs/node-glob/blob/f For each file being linted, the first matching project path will be used as its backing TSConfig. ```js title=".eslintrc.js" +/* eslint-env node */ module.exports = { extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:@typescript-eslint/recommended-type-checked', ], parser: '@typescript-eslint/parser', parserOptions: { @@ -68,11 +69,12 @@ Using wide globs `**` in your `parserOptions.project` may degrade linting perfor Instead of globs that use `**` to recursively check all folders, prefer paths that use a single `*` at a time. ```js title=".eslintrc.js" +/* eslint-env node */ module.exports = { extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:@typescript-eslint/recommended-type-checked', ], parser: '@typescript-eslint/parser', parserOptions: { @@ -99,7 +101,7 @@ See [#1192](https://github.com/typescript-eslint/typescript-eslint/issues/1192) If you do run into an OOM, please comment on the above issue and let us know about your repo - the more information we have, the better. As an interim workaround, consider one of the following: -- Switching to one root `tsconfig.eslint.json` (see below) +- Switching to one root `tsconfig.eslint.json` (see [One root `tsconfig.json`](#one-root-tsconfigjson)) - Using a shell script to only lint one package at a time, using your existing config above. ## Troubleshooting diff --git a/docs/maintenance/versioning/dependant-version-upgrades.mdx b/docs/maintenance/Dependency_Version_Upgrades.mdx similarity index 92% rename from docs/maintenance/versioning/dependant-version-upgrades.mdx rename to docs/maintenance/Dependency_Version_Upgrades.mdx index bf1a17f2829..25903f3f535 100644 --- a/docs/maintenance/versioning/dependant-version-upgrades.mdx +++ b/docs/maintenance/Dependency_Version_Upgrades.mdx @@ -1,6 +1,6 @@ --- -id: dependant-version-upgrades -title: Dependant Version Upgrades +id: dependency-version-upgrades +title: Dependency Version Upgrades --- ## ESLint @@ -21,7 +21,7 @@ Whenever you discover any new areas of work that are blocked by dropping an old 1. Upgrade the root `package.json` `devDependency` to the latest ESLint 1. Add the new major version to the explicit `peerDependency` versions 1. Check [`eslint-visitor-keys`](https://www.npmjs.com/package/eslint-visitor-keys) for a new version to be upgraded to as well. -1. Update [Versioning > ESLint](../Versioning.mdx#eslint) +1. Update [Users > Dependency Versions > ESLint](../users/Dependency_Versions.mdx#eslint) ### Removing Support for an Old ESLint Version @@ -32,7 +32,7 @@ Whenever you discover any new areas of work that are blocked by dropping an old - `/eslint.*5/i` - `/todo.*eslint.*5/i` - `/todo.*eslint/i` -1. Update [Versioning > ESLint](../Versioning.mdx#eslint) +1. Update [Users > Dependency Versions > ESLint](../users/Dependency_Versions.mdx#eslint) See [chore: drop support for ESLint v6](https://github.com/typescript-eslint/typescript-eslint/pull/5972) for reference. @@ -81,15 +81,15 @@ We generally start the process of supporting a new TypeScript version just after - Change the `SUPPORTED_TYPESCRIPT_VERSIONS` constant's `<` version to the next version of TypeScript - Change the `SUPPORTED_PRERELEASE_RANGES` constant to equal `['X.Y.2-rc']` - Rename and update `patches/typescript*` to the new TypeScript version - - Run `yarn generate:lib` to update `scope-manager` + - Run `yarn generate-lib` to update `scope-manager` 1. Once all PRs needed for the RC update PR are merged, merge the RC update PR 1. Once TypeScript releases the stable X.Y version, create and merge a PR with a title like `chore: bump TypeScript from X.YRC to X.Y` and the following changes: - In the root `package.json`, remove `|| X.Y.2-rc2` from the `dependency` on `typescript`, and bump its `<` version to the next version of TypeScript - In the root `package.json`, change the `devDependency` on `typescript` to `~X.Y.3` - Rename and update `patches/typescript*` to the new TypeScript version - Any other changes made necessary due to changes in TypeScript between the RC version and stable version - - Update the supported version range in [Versioning](../Versioning.mdx) -1. Update [Versioning > TypeScript](../Versioning.mdx#typescript) + - Update the supported version range in [Users > Dependency Versions](../users/Dependency_Versions.mdx) +1. Update [Users > Dependency Versions > TypeScript](../users/Dependency_Versions.mdx#typescript) 1. Send a PR that updates this documentation page to point to your newer issues and PRs - Also update any of these steps if you go with a different process @@ -108,7 +108,7 @@ A single PR can remove support for old TypeScript versions as a breaking change: 1. Update the root `package.json` `devDependency` 1. Update the `SUPPORTED_TYPESCRIPT_VERSIONS` constant in `warnAboutTSVersion.ts` 1. Update the `versions` constant in `version-check.ts` -1. Update [Versioning > TypeScript](../Versioning.mdx#typescript) +1. Update [Users > Dependency Versions > TypeScript](../users/Dependency_Versions.mdx#typescript) 1. Search for source code comments (excluding `CHANGELOG.md` files) that mention a now-unsupported version of TypeScript. - For example, to remove support for v4.3, searches might include: - `4.3` diff --git a/docs/maintenance/Issues.mdx b/docs/maintenance/Issues.mdx index fc8a89711de..fbe1a45157f 100644 --- a/docs/maintenance/Issues.mdx +++ b/docs/maintenance/Issues.mdx @@ -78,7 +78,7 @@ In such cases you can forgo the back-and-forth and just skip to the closing step #### 🐞 "Simple" Bugs -A simple bug is a bug that can be reproduced in a single TS file plus an ESLint config (and possibly a TSConfig) - i.e. an issue reproducible on https://typescript-eslint.io/play. +A simple bug is a bug that can be reproduced in a single TS file plus an ESLint config (and possibly a TSConfig) - i.e. an issue reproducible on [our playground](/play). The vast majority of bug reports fall into this category. If you cannot reproduce the issue as described using the issue's provided playground reproduction, it has not provided enough information. @@ -127,7 +127,7 @@ For enhancements meant to limit which kinds of nodes the rule targets, mark the #### 🚀 New Rules We're generally accepting of new rules that meet the above feature request criteria. -The biggest exception is rules that can roughly be implemented with [`@typescript-eslint/ban-types`](https://typescript-eslint.io/rules/ban-types) and/or [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax). +The biggest exception is rules that can roughly be implemented with [`@typescript-eslint/ban-types`](/rules/ban-types) and/or [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax). ## Pruning Old Issues diff --git a/docs/maintenance/Releases.mdx b/docs/maintenance/Major_Release_Steps.mdx similarity index 55% rename from docs/maintenance/Releases.mdx rename to docs/maintenance/Major_Release_Steps.mdx index 87fb87529df..42993b4480b 100644 --- a/docs/maintenance/Releases.mdx +++ b/docs/maintenance/Major_Release_Steps.mdx @@ -1,62 +1,9 @@ --- -id: releases -sidebar_label: Releases -title: Releases +id: major-release-steps +title: Major Release Steps --- -## Canary - -We release a canary version for each commit to `main` that passes all required checks. This release is performed automatically by the [`publish_canary_version` step](https://github.com/typescript-eslint/typescript-eslint/blob/5feb2dba9da2bd5e233451b7b0f1c99414b5aef9/.github/workflows/ci.yml#L234-L263). - -This release is goes to the `canary` tag on npm and it is versioned as an incremental canary patch release on top of the current `latest` version. I.e. if the current version is `5.6.1`, then the first canary version will be `5.6.2-alpha.0`, the second `5.6.2-alpha.1`, and so on. - -### Installing Canary Versions - -To try out the latest canary versions of typescript-eslint, install `@typescript-eslint/eslint-plugin@canary` and `@typescript-eslint/parser@canary`. -Note that npm may need a `--force` to override version requirements. - - - -### npm - -```bash -npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary --save-dev --force -``` - -### Yarn - -```bash -yarn add @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary --save-dev -``` - - - -## Latest - -We release a latest version every Monday at 1pm US Eastern time using the latest commit to `main` at that time. This release is performed automatically by a Github action located in a private repository. This release goes to the standard `latest` tag on npm. - -See the [versioning](#versioning) section below for how the version number is calculated. - -If there have been no commits that impact public-facing packages then a patch-level release shall be released. - -Latest releases shall only ever be "minor" or "patch" releases. - -## Major Releases - -We currently do not have a set schedule around when major releases shall be performed; instead they are done as the need arises. - -We keep a backlog of breaking issues as a milestone on GitHub that is named in the form `${major}.0.0`. -When we do do a major release, we release a release candidate version to the `rc-v${major}` tag on npm for each commit to the major branch. - -### Major Release Steps - -Our releases go through three groups of steps: - -1. [Pre-Release Preparation] -1. [Merging Breaking Changes] -1. [Releasing the Version] - -#### 1. Pre-Release Preparation +## 1. Pre-Release Preparation 1. Create a milestone by the name of the release [example: [Milestone 6.0.0](https://github.com/typescript-eslint/typescript-eslint/milestone/8)]. 1. If an issue for changes to recommended rule configs doesn't yet exist, create one [example: [Changes to the `recommended` sets for 5.0.0](https://github.com/typescript-eslint/typescript-eslint/issues/5900)]. @@ -71,7 +18,7 @@ Our releases go through three groups of steps: - Its publish command should be `npx lerna publish premajor --loglevel=verbose --canary --exact --force-publish --yes --dist-tag rc-v${major}`. - Merge this into `main` once reviewed and rebase the `v${major}` branch. -#### 2. Merging Breaking Changes +## 2. Merging Breaking Changes 1. Send a PR from `v${major}` to `main` [example: [v6.0.0](https://github.com/typescript-eslint/typescript-eslint/pull/5886)]. 1. Change all [breaking change PRs](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+is%3Aopen+label%3A%22breaking+change%22) to target the `v${major}` branch. @@ -87,7 +34,7 @@ _Non_-breaking changes can be merged to `main` or the major branch. They don't need any special treatment. ::: -#### 3. Releasing the Version +## 3. Releasing the Version 1. Discuss with the maintainers to be ready for an [out-of-band](#out-of-band) release. Doing this manually helps ensure someone is on-hand to action any issues that might arise from the major release. 1. Prepare the release notes. Lerna will automatically generate the release notes on GitHub, however this will be disorganized and unhelpful for users. We need to reorganize the release notes so that breaking changes are placed at the top to make them most visible. If any migrations are required, we must list the steps to make it easy for users. @@ -95,15 +42,3 @@ They don't need any special treatment. - Example release notes: [`v5.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v5.0.0), [`v4.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0), [`v3.0.0`](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) 1. Finally, tweet the release on the `@tseslint` twitter with a link to the GitHub release. Make sure you include additional information about the highlights of the release! - -## Out-of-Band - -We will do releases "out-of-band" (outside the [latest](#latest) schedule) for rare emergencies. -We assess need on a case-by-case basis though generally an emergency is defined as a critical regression specifically introduced in the latest release. - -These releases are done manually by a maintainer with the required access privileges. - -## Back-Porting Releases - -We **_do not_** back port releases to previously released major/minor versions. -We only ever release forward. diff --git a/docs/maintenance/Pull_Requests.mdx b/docs/maintenance/Pull_Requests.mdx index 37c6b40256c..02f00ac952d 100644 --- a/docs/maintenance/Pull_Requests.mdx +++ b/docs/maintenance/Pull_Requests.mdx @@ -32,3 +32,11 @@ Our flow for PRs that have been waiting for >=1 month is: 2. Add the `stale` label to the PR 3. Wait 2 weeks 4. If they still haven't responded, close the PR with a message like the _Pruning Stale PR_ template + +## Suggestions + +Consider adding fun to PR reviews with GIFs. +The benefits of using GIFs in PR reviews are that it adds a touch of humor and lightheartedness to the process, builds camaraderie and team spirit, and can help break the ice by making users feel welcomed. +Please remember to use appropriate and respectful GIFs and use them sparingly; GIFs should enhance the conversation, not detract from it. + +> We like to use the _GIFs for Github_ extension: available as [GIFs for GitHub (Chrome)](https://chrome.google.com/webstore/detail/gifs-for-github/dkgjnpbipbdaoaadbdhpiokaemhlphep) and [GIFs for GitHub (Firefox)](https://addons.mozilla.org/en-US/firefox/addon/gifs-for-github). ✨ diff --git a/docs/maintenance/issues/Rule_Deprecations.mdx b/docs/maintenance/issues/Rule_Deprecations.mdx index 98486f2bb6c..1e89880390b 100644 --- a/docs/maintenance/issues/Rule_Deprecations.mdx +++ b/docs/maintenance/issues/Rule_Deprecations.mdx @@ -31,4 +31,4 @@ Provide it an `## Overview` containing: - `deprecated: true` - `replacedBy`, if applicable 2. In the next major version, you may delete the rule - - If the rule is relatively popular with users, consider leaving a documentation page as a tombstone pointing to the new relevant rule or docs (see [`camelcase`](https://typescript-eslint.io/rules/camelcase/) as an example) + - If the rule is relatively popular with users, consider leaving a documentation page as a tombstone pointing to the new relevant rule or docs (see [`camelcase`](/rules/camelcase/) as an example) diff --git a/docs/architecture/ESLint_Plugin.mdx b/docs/packages/ESLint_Plugin.mdx similarity index 100% rename from docs/architecture/ESLint_Plugin.mdx rename to docs/packages/ESLint_Plugin.mdx diff --git a/docs/architecture/ESLint_Plugin_TSLint.mdx b/docs/packages/ESLint_Plugin_TSLint.mdx similarity index 100% rename from docs/architecture/ESLint_Plugin_TSLint.mdx rename to docs/packages/ESLint_Plugin_TSLint.mdx diff --git a/docs/architecture/Parser.mdx b/docs/packages/Parser.mdx similarity index 88% rename from docs/architecture/Parser.mdx rename to docs/packages/Parser.mdx index 39ade74168a..a4faf2a8446 100644 --- a/docs/architecture/Parser.mdx +++ b/docs/packages/Parser.mdx @@ -21,7 +21,7 @@ TS's AST is optimized for its use case of parsing incomplete code and typechecki ESTree is unoptimized and intended for "general purpose" use-cases of traversing the AST. :::tip -You can select `@typescript-eslint/parser` on the [typescript-eslint playground](https://typescript-eslint.io/play#showAST=es)'s left sidebar under _Options_ > _AST Explorer_ by selecting _ESTree_. +You can select `@typescript-eslint/parser` on the [typescript-eslint playground](/play#showAST=es)'s left sidebar under _Options_ > _AST Explorer_ by selecting _ESTree_. ::: ## Configuration @@ -43,7 +43,6 @@ interface ParserOptions { jsxFragmentName?: string | null; jsxPragma?: string | null; lib?: string[]; - moduleResolver?: string; program?: import('typescript').Program; project?: string | string[] | true; projectFolderIgnoreList?: string[]; @@ -109,7 +108,7 @@ Specifies the version of ECMAScript syntax you want to use. This is used by the > Default `undefined`. -This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](https://typescript-eslint.io/linting/typed-linting). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. +This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](../linting/Typed_Linting.mdx). In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster. ### `extraFileExtensions` @@ -150,31 +149,12 @@ Specifies the TypeScript `lib`s that are available. This is used by the scope an If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler. -### `moduleResolver` - -> Default `undefined`. - -This option allows you to provide a custom module resolution. The value should point to a JS file that default exports (`export default`, or `module.exports =`, or `export =`) a file with the following interface: - -```ts -interface ModuleResolver { - version: 1; - resolveModuleNames( - moduleNames: string[], - containingFile: string, - reusedNames: string[] | undefined, - redirectedReference: ts.ResolvedProjectReference | undefined, - options: ts.CompilerOptions, - ): (ts.ResolvedModule | undefined)[]; -} -``` - ### `program` > Default `undefined`. This option allows you to programmatically provide an instance of a TypeScript Program object that will provide type information to rules. -This will override any programs that would have been computed from `parserOptions.project` or `parserOptions.createDefaultProgram`. +This will override any programs that would have been computed from `parserOptions.project`. All linted files must be part of the provided program(s). [Refer to the TypeScript Wiki for an example on how to write the `resolveModuleNames` function](https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#customizing-module-resolution). @@ -211,7 +191,7 @@ This option allows you to provide a path to your project's `tsconfig.json`. **Th - TypeScript will ignore files with duplicate filenames in the same folder (for example, `src/file.ts` and `src/file.js`). TypeScript purposely ignore all but one of the files, only keeping the one file with the highest priority extension (the extension priority order (from highest to lowest) is `.ts`, `.tsx`, `.d.ts`, `.js`, `.jsx`). For more info see #955. -- Note that if this setting is specified and `createDefaultProgram` is not, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: +- Note that if this setting is specified, you must only lint files that are included in the projects as defined by the provided `tsconfig.json` files. If your existing configuration does not include all of the files you would like to lint, you can create a separate `tsconfig.eslint.json` as follows: ```jsonc { @@ -251,7 +231,23 @@ Doing so ensures running ESLint from a directory other than the root will still > Default `true`. -This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported +This option allows you to toggle the warning that the parser will give you if you use a version of TypeScript which is not explicitly supported. The warning message would look like this: + +```plaintext +============= + +WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree. + +You may find that it works just fine, or you may not. + +SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <5.1.0 + +YOUR TYPESCRIPT VERSION: 5.1.3 + +Please only submit bug reports when using the officially supported version. + +============= +``` ## Utilities diff --git a/docs/packages/Rule_Tester.mdx b/docs/packages/Rule_Tester.mdx new file mode 100644 index 00000000000..8caec346d77 --- /dev/null +++ b/docs/packages/Rule_Tester.mdx @@ -0,0 +1,218 @@ +--- +id: rule-tester +sidebar_label: rule-tester +--- + +import CodeBlock from '@theme/CodeBlock'; + +# `@typescript-eslint/rule-tester` + +> A utility for testing ESLint rules + +This is a fork of ESLint's built-in `RuleTester` to provide some better types and additional features for testing TypeScript rules. + +## Usage + +For non-type-aware rules you can test them as follows: + +```ts +import { RuleTester } from '@typescript-eslint/rule-tester'; +import rule from '../src/rules/my-rule.ts'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('my-rule', rule, { + valid: [ + // valid tests can be a raw string, + 'const x = 1;', + // or they can be an object + { + code: 'const y = 2;', + options: [{ ruleOption: true }], + }, + + // you can enable JSX parsing by passing parserOptions.ecmaFeatures.jsx = true + { + code: 'const z =
;', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, + ], + invalid: [ + // invalid tests must always be an object + { + code: 'const a = 1;', + // invalid tests must always specify the expected errors + errors: [ + { + messageId: 'ruleMessage', + // If applicable - it's recommended that you also assert the data in + // addition to the messageId so that you can ensure the correct message + // is generated + data: { + placeholder1: 'a', + }, + }, + ], + }, + + // fixers can be tested using the output parameter + { + code: 'const b = 1;', + output: 'const c = 1;', + errors: [ + /* ... */ + ], + }, + // passing `output = null` will enforce the code is NOT changed + { + code: 'const c = 1;', + output: null, + errors: [ + /* ... */ + ], + }, + + // suggestions can be tested via errors + { + code: 'const d = 1;', + output: null, + errors: [ + { + messageId: 'suggestionError', + suggestions: [ + { + messageId: 'suggestionOne', + output: 'const e = 1;', + }, + ], + }, + ], + }, + // passing `suggestions = null` will enforce there are NO suggestions + { + code: 'const d = 1;', + output: null, + errors: [ + { + messageId: 'noSuggestionError', + suggestions: null, + }, + ], + }, + ], +}); +``` + +### Type-Aware Testing + +Type-aware rules can be tested in almost exactly the same way, except you need to create some files on disk. +We require files on disk due to a limitation with TypeScript in that it requires physical files on disk to initialize the project. +We suggest creating a `fixture` folder nearby that contains three files: + +1. `file.ts` - this should be an empty file. +2. `react.tsx` - this should be an empty file. +3. `tsconfig.json` - this should be the config to use for your test, for example: + ```json + { + "compilerOptions": { + "strict": true + }, + "include": ["file.ts", "react.tsx"] + } + ``` + +:::caution +It's important to note that both `file.ts` and `react.tsx` must both be empty files! +The rule tester will automatically use the string content from your tests - the empty files are just there for initialization. +::: + +You can then test your rule by providing the type-aware config: + +```ts +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + // Added lines start + parserOptions: { + tsconfigRootDir: './path/to/your/folder/fixture', + project: './tsconfig.json', + }, + // Added lines end +}); +``` + +With that config the parser will automatically run in type-aware mode and you can write tests just like before. + +### Test Dependency Constraints + +Sometimes it's desirable to test your rule against multiple versions of a dependency to ensure backwards and forwards compatibility. +With backwards-compatibility testing there comes a complication in that some tests may not be compatible with an older version of a dependency. +For example - if you're testing against an older version of TypeScript, certain features might cause a parser error! + +import DependencyConstraint from '!!raw-loader!../../packages/rule-tester/src/types/DependencyConstraint.ts'; + +{DependencyConstraint} + +The `RuleTester` allows you to apply dependency constraints at either an individual test or constructor level. + +```ts +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + // Added lines start + dependencyConstraints: { + // none of the tests will run unless `my-dependency` matches the semver range `>=1.2.3` + 'my-dependency': '1.2.3', + // you can also provide granular semver ranges + 'my-granular-dep': { + // none of the tests will run unless `my-granular-dep` matches the semver range `~3.2.1` + range: '~3.2.1', + }, + }, + // Added lines end +}); + +ruleTester.run('my-rule', rule, { + valid: [ + { + code: 'const y = 2;', + // Added lines start + dependencyConstraints: { + // this test won't run unless BOTH dependencies match the given ranges + first: '1.2.3', + second: '3.2.1', + }, + // Added lines end + }, + ], + invalid: [ + /* ... */ + ], +}); +``` + +All dependencies provided in the `dependencyConstraints` object must match their given ranges in order for a test to not be skipped. + +## Options + +### `RuleTester` constructor options + +import RuleTesterConfig from '!!raw-loader!../../packages/rule-tester/src/types/RuleTesterConfig.ts'; + +{RuleTesterConfig} + +### Valid test case options + +import ValidTestCase from '!!raw-loader!../../packages/rule-tester/src/types/ValidTestCase.ts'; + +{ValidTestCase} + +### Invalid test case options + +import InvalidTestCase from '!!raw-loader!../../packages/rule-tester/src/types/InvalidTestCase.ts'; + +{InvalidTestCase} diff --git a/docs/architecture/Scope_Manager.mdx b/docs/packages/Scope_Manager.mdx similarity index 90% rename from docs/architecture/Scope_Manager.mdx rename to docs/packages/Scope_Manager.mdx index af7bd6e27c5..cd33ac0fc75 100644 --- a/docs/architecture/Scope_Manager.mdx +++ b/docs/packages/Scope_Manager.mdx @@ -23,13 +23,6 @@ interface AnalyzeOptions { */ childVisitorKeys?: Record | null; - /** - * Which ECMAScript version is considered. - * Defaults to `2018`. - * `'latest'` is converted to 1e8 at parser. - */ - ecmaVersion?: EcmaVersion | 1e8; - /** * Whether the whole script is executed under node.js environment. * When enabled, the scope manager adds a function scope immediately following the global scope. @@ -38,7 +31,7 @@ interface AnalyzeOptions { globalReturn?: boolean; /** - * Implied strict mode (if ecmaVersion >= 5). + * Implied strict mode. * Defaults to `false`. */ impliedStrict?: boolean; @@ -63,7 +56,7 @@ interface AnalyzeOptions { * This automatically defines a type variable for any types provided by the configured TS libs. * For more information, see https://www.typescriptlang.org/tsconfig#lib * - * Defaults to the lib for the provided `ecmaVersion`. + * Defaults to ['esnext']. */ lib?: Lib[]; @@ -92,7 +85,6 @@ const ast = parse(code, { range: true, }); const scope = analyze(ast, { - ecmaVersion: 2020, sourceType: 'module', }); ``` diff --git a/docs/architecture/TypeScript-ESTree.mdx b/docs/packages/TypeScript_ESTree.mdx similarity index 82% rename from docs/architecture/TypeScript-ESTree.mdx rename to docs/packages/TypeScript_ESTree.mdx index 40d42606296..6354565e828 100644 --- a/docs/architecture/TypeScript-ESTree.mdx +++ b/docs/packages/TypeScript_ESTree.mdx @@ -31,11 +31,22 @@ Parses the given string of code with the options provided and returns an ESTree- ```ts interface ParseOptions { + /** + * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. + * This case only usually occurs when attempting to lint invalid code. + */ + allowInvalidAST?: boolean; + /** * create a top-level comments array containing all comments */ comment?: boolean; + /** + * Whether deprecated AST properties should skip calling console.warn on accesses. + */ + suppressDeprecatedPropertyWarnings?: boolean; + /** * An array of modules to turn explicit debugging on for. * - 'typescript-eslint' is the same as setting the env var `DEBUG=typescript-eslint:*` @@ -99,7 +110,6 @@ interface ParseOptions { const PARSE_DEFAULT_OPTIONS: ParseOptions = { comment: false, - errorOnUnknownASTType: false, filePath: 'estree.ts', // or 'estree.tsx', if you pass jsx: true jsx: false, loc: false, @@ -137,6 +147,15 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + /** + * ***EXPERIMENTAL FLAG*** - Use this at your own risk. + * + * Whether to create a shared TypeScript server to power program creation. + * + * @see https://github.com/typescript-eslint/typescript-eslint/issues/6575 + */ + EXPERIMENTAL_useProjectService?: boolean; + /** * ***EXPERIMENTAL FLAG*** - Use this at your own risk. * @@ -145,7 +164,7 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { * * This flag REQUIRES at least TS v3.9, otherwise it does nothing. * - * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094 + * @see https://github.com/typescript-eslint/typescript-eslint/issues/2094 */ EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; @@ -202,15 +221,10 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { programs?: Program[]; /** - *************************************************************************************** - * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. * - *************************************************************************************** - * - * When passed with `project`, this allows the parser to create a catch-all, default program. - * This means that if the parser encounters a file not included in any of the provided `project`s, - * it will not error, but will instead parse the file and its dependencies in a new program. + * @deprecated - this flag will be removed in the next major. + * Do not rely on the behavior provided by this flag. */ - createDefaultProgram?: boolean; + DEPRECATED__createDefaultProgram?: boolean; /** * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, @@ -241,18 +255,12 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ glob?: number | 'Infinity'; }; - - /** - * Path to a file exporting a custom `ModuleResolver`. - */ - moduleResolver?: string; } interface ParserServices { program: ts.Program; esTreeNodeToTSNodeMap: WeakMap; tsNodeToESTreeNodeMap: WeakMap; - hasFullTypeInformation: boolean; } interface ParseAndGenerateServicesResult { @@ -290,56 +298,6 @@ const { ast, services } = parseAndGenerateServices(code, { }); ``` -##### `ModuleResolver` - -The `moduleResolver` option allows you to specify the path to a module with a custom module resolver implementation. The module is expected to adhere to the following interface: - -```ts -interface ModuleResolver { - version: 1; - resolveModuleNames( - moduleNames: string[], - containingFile: string, - reusedNames: string[] | undefined, - redirectedReference: ts.ResolvedProjectReference | undefined, - options: ts.CompilerOptions, - ): (ts.ResolvedModule | undefined)[]; -} -``` - -#### `parseWithNodeMaps(code, options)` - -Parses the given string of code with the options provided and returns both the ESTree-compatible AST as well as the node maps. -This allows you to work with both ASTs without the overhead of types that may come with `parseAndGenerateServices`. - -```ts -interface ParseWithNodeMapsResult { - ast: TSESTree.Program; - esTreeNodeToTSNodeMap: ParserServices['esTreeNodeToTSNodeMap']; - tsNodeToESTreeNodeMap: ParserServices['tsNodeToESTreeNodeMap']; -} - -declare function parseWithNodeMaps( - code: string, - options: ParseOptions = PARSE_DEFAULT_OPTIONS, -): ParseWithNodeMapsResult; -``` - -Example usage: - -```js -import { parseWithNodeMaps } from '@typescript-eslint/typescript-estree'; - -const code = `const hello: string = 'world';`; -const { ast, esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap } = parseWithNodeMaps( - code, - { - loc: true, - range: true, - }, -); -``` - ### `TSESTree`, `AST_NODE_TYPES` and `AST_TOKEN_TYPES` Types for the AST produced by the parse functions. diff --git a/docs/architecture/Utils.mdx b/docs/packages/Utils.mdx similarity index 66% rename from docs/architecture/Utils.mdx rename to docs/packages/Utils.mdx index 7c4fd674d70..df05daa7690 100644 --- a/docs/architecture/Utils.mdx +++ b/docs/packages/Utils.mdx @@ -8,21 +8,21 @@ sidebar_label: utils > Utilities for working with TypeScript + ESLint together. ✨ This package contains public utilities for writing custom rules and plugins in TypeScript. -Rules declared in [`@typescript-eslint/eslint-plugin`](https://typescript-eslint.io/architecture/eslint-plugin) are created using these utility functions. +Rules declared in [`@typescript-eslint/eslint-plugin`](./ESLint_Plugin.mdx) are created using these utility functions. Any custom rules you write generally will be as well. -> See [Custom Rules](https://typescript-eslint.io/custom-rules) for documentation on creating your own custom ESLint rules for TypeScript code. +> See [Custom Rules](../developers/Custom_Rules.mdx) for documentation on creating your own custom ESLint rules for TypeScript code. ## Exports -| Name | Description | -| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `AST_NODE_TYPES` | An enum with the names of every single _node_ found in `TSESTree`. | -| `AST_TOKEN_TYPES` | An enum with the names of every single _token_ found in `TSESTree`. | -| `ASTUtils` | Tools for operating on the ESTree AST. Also includes the [`@eslint-community/eslint-utils`](https://www.npmjs.com/package/@eslint-community/eslint-utils) package, correctly typed to work with the types found in `TSESTree` | -| `ESLintUtils` | Tools for creating ESLint rules with TypeScript. | -| `JSONSchema` | Types from the [`@types/json-schema`](https://www.npmjs.com/package/@types/json-schema) package, re-exported to save you having to manually import them. Also ensures you're using the same version of the types as this package. | -| `ParserServices` | Typing for the parser services provided when parsing a file using `@typescript-eslint/typescript-estree`. | -| `TSESLint` | Types for ESLint, correctly typed to work with the types found in `TSESTree`. | -| `TSESLintScope` | The [`eslint-scope`](https://www.npmjs.com/package/eslint-scope) package, correctly typed to work with the types found in both `TSESTree` and `TSESLint` | -| `TSESTree` | Types for the TypeScript flavor of ESTree created by `@typescript-eslint/typescript-estree`. | +| Name | Description | +| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AST_NODE_TYPES` | An enum with the names of every single _node_ found in `TSESTree`. | +| `AST_TOKEN_TYPES` | An enum with the names of every single _token_ found in `TSESTree`. | +| `ASTUtils` | Tools for operating on the ESTree AST. Also includes the [`@eslint-community/eslint-utils`](https://www.npmjs.com/package/@eslint-community/eslint-utils) package, correctly typed to work with the types found in `TSESTree` | +| `ESLintUtils` | Tools for creating ESLint rules with TypeScript. | +| `JSONSchema` | Strict types for the JSON Schema v4 spec - the version that ESLint uses to validate all rules with. | +| `ParserServices` | Typing for the parser services provided when parsing a file using `@typescript-eslint/typescript-estree`. | +| `TSESLint` | Types for ESLint, correctly typed to work with the types found in `TSESTree`. | +| `TSESLintScope` | The [`eslint-scope`](https://www.npmjs.com/package/eslint-scope) package, correctly typed to work with the types found in both `TSESTree` and `TSESLint` | +| `TSESTree` | Types for the TypeScript flavor of ESTree created by `@typescript-eslint/typescript-estree`. | diff --git a/docs/users/Dependency_Versions.mdx b/docs/users/Dependency_Versions.mdx new file mode 100644 index 00000000000..406ec999eeb --- /dev/null +++ b/docs/users/Dependency_Versions.mdx @@ -0,0 +1,35 @@ +--- +id: dependency-versions +title: Dependency Versions +--- + +## ESLint + +> The version range of ESLint currently supported is `^6.0.0 || ^7.0.0 || ^8.0.0`. + +We generally support at least the latest two major versions of ESLint. + +## Node + +This project makes an effort to support Active LTS and Maintenance LTS release statuses of Node according to [Node's release document](https://nodejs.org/en/about/releases). +Support for specific Current status releases are considered periodically. + +## TypeScript + +> The version range of TypeScript currently supported is `>=3.3.1 <5.2.0`. + +These versions are what we test against. + +We will always endeavor to support the latest stable version of TypeScript. +Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. +In some cases, we may even be able to support additional pre-releases (i.e. betas and release candidates) of TypeScript, but only if doing so does not require us to compromise on support for the latest stable version. + +Note that our packages have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. + +If you use a non-supported version of TypeScript, the parser will log a warning to the console. +If you want to disable this warning, you can configure this in your `parserOptions`. +See: [Packages > Parser > `warnOnUnsupportedTypeScriptVersion`](../packages/Parser.mdx#warnonunsupportedtypescriptversion). + +## Dependant Version Upgrades + +See [Maintenance > Dependent Version Upgrades](../maintenance/Dependency_Version_Upgrades.mdx) for maintenance steps to update these versions. diff --git a/docs/users/Releases.mdx b/docs/users/Releases.mdx new file mode 100644 index 00000000000..7e8721f9fb5 --- /dev/null +++ b/docs/users/Releases.mdx @@ -0,0 +1,83 @@ +--- +id: releases +sidebar_label: Releases +title: Releases +--- + +## Latest + + + NPM Version + + +We release a latest version every Monday at 1pm US Eastern time using the latest commit to `main` at that time. This release is performed automatically by a Github action located in a private repository. This release goes to the standard `latest` tag on npm. + +See [Versioning](./Versioning.mdx) for how the version number is calculated. + +If there have been no commits that impact public-facing packages then a patch-level release shall be released. + +Latest releases shall only ever be "minor" or "patch" releases. + +### Release Notes + +Every release is documented on the [Github Release page](https://github.com/typescript-eslint/typescript-eslint/releases). + +These release notes will list the PRs included in the release. + +## Canary + + + NPM Version + + +We release a canary version for each commit to `main` that passes all required checks. This release is performed automatically by the [`publish_canary_version` step](https://github.com/typescript-eslint/typescript-eslint/blob/5feb2dba9da2bd5e233451b7b0f1c99414b5aef9/.github/workflows/ci.yml#L234-L263). + +This release is goes to the `canary` tag on npm and it is versioned as an incremental canary patch release on top of the current `latest` version. I.e. if the current version is `5.6.1`, then the first canary version will be `5.6.2-alpha.0`, the second `5.6.2-alpha.1`, and so on. + +### Installing Canary Versions + +To try out the latest canary versions of typescript-eslint, install `@typescript-eslint/eslint-plugin@canary` and `@typescript-eslint/parser@canary`. +Note that npm may need a `--force` to override version requirements. + + + +### npm + +```bash +npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary --save-dev --force +``` + +### Yarn + +```bash +yarn add @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary --dev +``` + + + +## Major Releases + +We currently do not have a set schedule around when major releases shall be performed; instead they are done as the need arises. + +We keep a backlog of breaking issues as a milestone on GitHub that is named in the form `${major}.0.0`. +When we do do a major release, we release a release candidate version to the `rc-v${major}` tag on npm for each commit to the major branch. + +See [Maintenance > Major Release Steps](../maintenance/Major_Release_Steps.mdx) for steps to perform a major release. + +## Out-of-Band + +We will do releases "out-of-band" (outside the [latest](#latest) schedule) for rare emergencies. +We assess need on a case-by-case basis though generally an emergency is defined as a critical regression specifically introduced in the latest release. + +These releases are done manually by a maintainer with the required access privileges. + +## Back-Porting Releases + +We **_do not_** back port releases to previously released major/minor versions. +We only ever release forward. diff --git a/docs/maintenance/Versioning.mdx b/docs/users/Versioning.mdx similarity index 77% rename from docs/maintenance/Versioning.mdx rename to docs/users/Versioning.mdx index 4cd92c6c857..5f9f9450953 100644 --- a/docs/maintenance/Versioning.mdx +++ b/docs/users/Versioning.mdx @@ -35,10 +35,6 @@ The only exception to the automated publishes described above is when we are in During these periods, we manually publish `canary` releases until we are happy with the release and promote it to `latest`. ::: -## Dependant Versions - -> See [Versioning > Dependant Version Upgrades](./versioning/dependant-version-upgrades.mdx) for maintenance steps to update these versions. - ### ESLint > The version range of ESLint currently supported is `^6.0.0 || ^7.0.0 || ^8.0.0`. @@ -52,19 +48,31 @@ Support for specific Current status releases are considered periodically. ### TypeScript -> The version range of TypeScript currently supported is `>=3.3.1 <5.1.0`. +> The version range of TypeScript currently supported is `>=4.3.5 <5.1.0`. + +Note that we mirror [DefinitelyTyped's version support window](https://github.com/DefinitelyTyped/DefinitelyTyped/#support-window) - meaning we only support versions of TypeScript less than 2 years old. + +You may find that our tooling works on older TypeScript versions however we provide no guarantees and **_we will not accept issues against unsupported versions_**. + +#### Supporting New TypeScript Releases + +With each new TypeScript release we file an issue to track the changes in the new version. The issue should always be pinned, and you can also [find the issues by searching for issues tagged with "New TypeScript Version"](https://github.com/typescript-eslint/typescript-eslint/issues?q=is%3Aissue+label%3A%22New+TypeScript+Version%22+sort%3Acreated-desc). If the issue is open, we do not have official support yet - please be patient. + +In terms of what versions we support: + +- We do not support the `beta` releases. +- We _generally_ do not officially support the `rc` releases. +- We endeavor to support the latest stable TypeScript versions as soon as possible after the release. -These versions are what we test against. +Generally we will begin working on supporting the next release when the `rc` version is released. -We will always endeavor to support the latest stable version of TypeScript. -Sometimes, but not always, changes in TypeScript will not require breaking changes in this project, and so we are able to support more than one version of TypeScript. -In some cases, we may even be able to support additional pre-releases (i.e. betas and release candidates) of TypeScript, but only if doing so does not require us to compromise on support for the latest stable version. +#### Version Warning Logs Note that our packages have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript. -If you use a non-supported version of TypeScript, the parser will log a warning to the console. +However if you use a non-supported version of TypeScript, the parser will log a warning to the console. If you want to disable this warning, you can configure this in your `parserOptions`. -See: [Parser > `warnOnUnsupportedTypeScriptVersion`](../architecture/Parser.mdx#warnonunsupportedtypescriptversion). +See: [Parser > `warnOnUnsupportedTypeScriptVersion`](../packages/Parser.mdx#warnonunsupportedtypescriptversion). ## Breaking Changes diff --git a/jest.config.base.js b/jest.config.base.js index 48c306a70c0..355b70884c9 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -11,6 +11,7 @@ module.exports = { 'tsx', 'mts', 'mtsx', + 'cjs', 'js', 'jsx', 'mjs', diff --git a/jest.config.js b/jest.config.js index 42c86fd0ca4..1a9107f8706 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,4 +1,4 @@ -const { getJestProjects } = require('@nrwl/jest'); +const { getJestProjects } = require('@nx/jest'); module.exports = { projects: getJestProjects(), diff --git a/lerna.json b/lerna.json index f5ad724031b..c96412a8497 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,11 @@ { - "version": "5.56.0", + "$schema": "node_modules/lerna/schemas/lerna-schema.json", + "version": "6.0.0", "npmClient": "yarn", - "useWorkspaces": true, - "stream": true + "stream": true, + "command": { + "version": { + "changelogEntryAdditionalMarkdown": "You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website." + } + } } diff --git a/netlify.toml b/netlify.toml index 06deeaaed01..6d2badd2a9c 100644 --- a/netlify.toml +++ b/netlify.toml @@ -19,7 +19,7 @@ [[redirects]] from = "/docs/development/architecture/packages" - to = "/architecture" + to = "/packages" [[redirects]] from = "/docs/development/custom-rules" @@ -39,4 +39,4 @@ [[redirects]] from = "/docs/*" - to = "/" + to = "/:splat" diff --git a/nx.json b/nx.json index 8830a7c698a..e441e44aff7 100644 --- a/nx.json +++ b/nx.json @@ -1,9 +1,8 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", - "npmScope": "typescript-eslint", "tasksRunnerOptions": { "default": { - "runner": "@nrwl/nx-cloud", + "runner": "nx-cloud", "options": { "cacheableOperations": ["build", "lint", "package", "prebuild", "test"], "accessToken": "YjIzMmMxMWItMjhiMS00NWY2LTk1NWYtYWU3YWQ0YjE4YjBlfHJlYWQ=" @@ -27,6 +26,7 @@ "inputs": [ "default", "{workspaceRoot}/.eslintrc.js", + "{workspaceRoot}/yarn.lock", "{workspaceRoot}/.eslintignore" ] } @@ -43,6 +43,6 @@ } ], "sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"], - "production": ["default"] + "production": ["default", "!{projectRoot}/src/test-setup.[jt]s"] } } diff --git a/package.json b/package.json index 88447c4b5f2..22460b599a7 100644 --- a/package.json +++ b/package.json @@ -16,121 +16,133 @@ "armano2", "Jed Fox" ], + "type": "commonjs", "license": "BSD-2-Clause", "repository": "typescript-eslint/typescript-eslint", "bugs": { "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "scripts": { - "build": "nx run-many --target=build --parallel --exclude website", + "build": "nx run-many --target=build --parallel --exclude website --exclude website-eslint", "check-clean-workspace-after-install": "git diff --quiet --exit-code", "check-configs": "nx run-many --target=check-configs --parallel", "check-docs": "nx run-many --target=check-docs --parallel", "check-format": "prettier --list-different .", - "check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\"", + "check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions", "clean": "lerna clean -y && nx run-many --target=clean", "format": "prettier --write .", - "generate-contributors": "yarn tsx ./tools/generate-contributors.ts", - "generate-sponsors": "yarn tsx ./tools/generate-sponsors.ts", - "generate-website-dts": "yarn tsx ./tools/generate-website-dts.ts", - "generate-lib": "nx generate-lib @typescript-eslint/scope-manager", - "lint-fix": "eslint . --fix", + "generate-breaking-changes": "nx run eslint-plugin:generate-breaking-changes", + "generate-configs": "nx run eslint-plugin:generate:configs", + "generate-contributors": "nx run repo-tools:generate-contributors", + "generate-sponsors": "nx run repo-tools:generate-sponsors", + "generate-website-dts": "nx run website:generate-website-dts", + "generate-lib": "nx run scope-manager:generate-lib", + "lint-fix": "yarn lint --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", "lint": "nx run-many --target=lint --parallel", - "postinstall": "yarn tsx ./tools/postinstall.ts", + "postinstall": "nx run repo-tools:postinstall-script", "pre-commit": "yarn lint-staged", "start": "nx run website:start", - "test": "nx run-many --target=test --parallel", - "test-integration": "yarn jest -c ./tests/integration/jest.config.js", + "test": "nx run-many --target=test --parallel --exclude integration-tests --exclude website --exclude website-eslint", + "test-integration": "nx run integration-tests:test", + "test-website": "nx run-many --target=test --projects=website,website-eslint", "typecheck": "nx run-many --target=typecheck --parallel" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "devDependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/core": "^7.20.2", - "@babel/eslint-parser": "^7.19.1", - "@babel/parser": "^7.21.2", - "@babel/types": "^7.20.2", - "@nrwl/jest": "15.7.2", - "@nrwl/nx-cloud": "15.0.3", - "@nrwl/workspace": "15.7.2", - "@swc/core": "^1.3.1", - "@swc/jest": "^0.2.21", + "@actions/core": "^1.10.0", + "@actions/github": "^5.1.1", + "@babel/code-frame": "^7.22.5", + "@babel/core": "^7.22.8", + "@babel/eslint-parser": "^7.22.7", + "@babel/parser": "^7.22.7", + "@babel/types": "^7.22.5", + "@nrwl/nx-cloud": "16.1.0", + "@nx/jest": "16.5.2", + "@nx/linter": "16.5.2", + "@nx/workspace": "16.5.2", + "@swc/core": "^1.3.68", + "@swc/jest": "^0.2.26", "@types/babel__code-frame": "^7.0.3", - "@types/debug": "^4.1.7", - "@types/eslint-visitor-keys": "^1.0.0", - "@types/glob": "^8.0.0", + "@types/babel__core": "^7.20.1", + "@types/debug": "^4.1.8", "@types/is-glob": "^4.0.2", - "@types/jest": "^29.0.2", - "@types/jest-specific-snapshot": "^0.5.5", - "@types/lodash": "^4.14.182", - "@types/marked": "^4.0.3", + "@types/jest-specific-snapshot": "^0.5.6", + "@types/jest": "29.5.3", + "@types/marked": "^5.0.0", + "@types/natural-compare": "^1.4.1", "@types/ncp": "^2.0.5", - "@types/node": "^18.11.9", - "@types/prettier": "^2.6.0", - "@types/rimraf": "^3.0.2", - "@types/semver": "^7.3.9", + "@types/node": "^18.16.19", + "@types/prettier": "^2.7.2", + "@types/semver": "^7.5.0", "@types/tmp": "^0.2.3", - "console-fail-test": "^0.1.7", - "cross-env": "^7.0.3", - "cross-fetch": "^3.1.5", - "cspell": "^6.0.0", + "console-fail-test": "^0.2.3", + "cross-fetch": "^4.0.0", + "cspell": "^6.31.1", "downlevel-dts": ">=0.11.0", - "eslint": "^8.15.0", - "eslint-plugin-deprecation": "^1.3.2", + "eslint-plugin-deprecation": "^1.4.1", + "eslint": "^8.44.0", "eslint-plugin-eslint-comments": "^3.2.0", - "eslint-plugin-eslint-plugin": "^5.0.1", - "eslint-plugin-import": "^2.26.0", - "eslint-plugin-jest": "^27.0.0", + "eslint-plugin-eslint-plugin": "^5.1.0", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jest": "^27.2.2", + "eslint-plugin-jsx-a11y": "^6.7.1", + "eslint-plugin-react": "^7.32.2", + "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-simple-import-sort": "^10.0.0", - "eslint-plugin-unicorn": "^46.0.0", - "execa": "5.1.1", - "glob": "^8.0.1", - "husky": "^8.0.1", - "jest": "^29.0.3", - "jest-diff": "^29.0.3", - "jest-snapshot": "^29.0.3", + "eslint-plugin-unicorn": "^47.0.0", + "execa": "7.1.1", + "glob": "^10.3.3", + "husky": "^8.0.3", + "jest-diff": "^29.6.1", + "jest-snapshot": "^29.6.1", "jest-specific-snapshot": "^8.0.0", - "lerna": "6.5.1", - "lint-staged": "^13.0.0", - "make-dir": "^3.1.0", - "markdownlint-cli": "^0.33.0", + "jest": "29.6.1", + "lerna": "7.1.3", + "lint-staged": "^13.2.3", + "make-dir": "^4.0.0", + "markdownlint-cli": "^0.35.0", "ncp": "^2.0.0", - "nx": "15.7.2", - "patch-package": "^6.4.7", - "prettier": "2.8.1", - "pretty-format": "^29.0.3", - "rimraf": "^4.0.0", + "netlify": "^13.1.9", + "nx-cloud": "16.1.0", + "nx": "16.5.2", + "patch-package": "^7.0.0", + "prettier": "^2.8.4", + "pretty-format": "^29.6.1", + "raw-loader": "^4.0.2", + "rimraf": "^5.0.1", "tmp": "^0.2.1", "ts-node": "10.7.0", "tslint": "^6.1.3", - "tsx": "^3.12.1", - "typescript": ">=3.3.1 <5.1.0" + "tsx": "^3.12.7", + "typescript": ">=4.3.5 <5.2.0" }, "resolutions": { - "typescript": "~5.0.2", - "@types/node": "^18.11.9", "@jest/create-cache-key-function": "^29", "@jest/reporters": "^29", "@jest/test-result": "^29", + "@swc/core-android-arm-eabi": "link:./tools/dummypkg", + "@swc/core-android-arm64": "link:./tools/dummypkg", + "@swc/core-freebsd-x64": "link:./tools/dummypkg", + "@swc/core-linux-arm-gnueabihf": "link:./tools/dummypkg", + "@swc/core-linux-arm64-gnu": "link:./tools/dummypkg", + "@swc/core-linux-arm64-musl": "link:./tools/dummypkg", + "@swc/core-win32-arm64-msvc": "link:./tools/dummypkg", + "@swc/core-win32-ia32-msvc": "link:./tools/dummypkg", + "@types/eslint-scope": "link:./tools/dummypkg", + "@types/eslint": "link:./tools/dummypkg", + "@types/estree": "link:./tools/dummypkg", + "@types/node": "^18.16.19", + "@types/react": "^18.2.14", + "eslint-visitor-keys": "^3.4.1", "jest-config": "^29", - "jest-diff": "^29", - "jest-get-type": "^29", - "jest-matcher-utils": "^29", "jest-resolve": "^29", - "jest-snapshot": "^29", "jest-util": "^29", "pretty-format": "^29", - "@swc/core-android-arm-eabi": "npm:dummypkg-a@1.0.0", - "@swc/core-android-arm64": "npm:dummypkg-a@1.0.0", - "@swc/core-freebsd-x64": "npm:dummypkg-a@1.0.0", - "@swc/core-linux-arm-gnueabihf": "npm:dummypkg-a@1.0.0", - "@swc/core-linux-arm64-gnu": "npm:dummypkg-a@1.0.0", - "@swc/core-linux-arm64-musl": "npm:dummypkg-a@1.0.0", - "@swc/core-win32-arm64-msvc": "npm:dummypkg-a@1.0.0", - "@swc/core-win32-ia32-msvc": "npm:dummypkg-a@1.0.0" + "tsx": "^3.12.7", + "typescript": "5.1.6" } } diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index cecad00b4d5..091ae8a95ce 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -3,6 +3,220 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* **ast-spec:** remove more invalid properties ([#6243](https://github.com/typescript-eslint/typescript-eslint/issues/6243)) ([aa20f63](https://github.com/typescript-eslint/typescript-eslint/commit/aa20f63e8f345767bb4693c9d20f751e6998bd65)) +* fix illegal decorator check ([#6723](https://github.com/typescript-eslint/typescript-eslint/issues/6723)) ([c456f8c](https://github.com/typescript-eslint/typescript-eslint/commit/c456f8cdef5a931c631bfbcfc84d8a25caaf019f)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* **typescript-estree:** account for namespace nesting in AST conversion ([#6272](https://github.com/typescript-eslint/typescript-eslint/issues/6272)) ([09e3877](https://github.com/typescript-eslint/typescript-eslint/commit/09e38776c63fea3328f71df36644ee11dd137cc1)) +* **typescript-estree:** fix error handling on `ImportExpression` ([#6587](https://github.com/typescript-eslint/typescript-eslint/issues/6587)) ([e8cdd5c](https://github.com/typescript-eslint/typescript-eslint/commit/e8cdd5ce48fa0a2f6f93e6b3ed7c337d042ab45d)) +* **typescript-estree:** forbid `override` on non-constructor function/methods ([#6729](https://github.com/typescript-eslint/typescript-eslint/issues/6729)) ([2f3638f](https://github.com/typescript-eslint/typescript-eslint/commit/2f3638fb00745429d6392a8e6492e83f853e92db)) +* **typescript-estree:** wrap import = declaration in an export node ([#5885](https://github.com/typescript-eslint/typescript-eslint/issues/5885)) ([1c3f470](https://github.com/typescript-eslint/typescript-eslint/commit/1c3f470da75bf63526efbf5b45615772e562dcb5)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* create TSTypeQuery node when TSImportType has isTypeOf ([#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076)) ([2b69b65](https://github.com/typescript-eslint/typescript-eslint/commit/2b69b659d87b58468e413801d31086ae0eeafff4)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* improve error location ([#6556](https://github.com/typescript-eslint/typescript-eslint/issues/6556)) ([355adf0](https://github.com/typescript-eslint/typescript-eslint/commit/355adf0b5dcc1b4f5c360722acc1ba8b6f4e4117)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration ([#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863)) ([844875c](https://github.com/typescript-eslint/typescript-eslint/commit/844875cbe933195ff25ba218f82ede3ebde9a0a0)) +* **typescript-estree:** added allowInvalidAST option to not throw on invalid tokens ([#6247](https://github.com/typescript-eslint/typescript-eslint/issues/6247)) ([a3b177d](https://github.com/typescript-eslint/typescript-eslint/commit/a3b177d59adaf8ea76b205befc8b12d86447f1fb)) +* **typescript-estree:** check for illegal decorators on function declarations ([#6590](https://github.com/typescript-eslint/typescript-eslint/issues/6590)) ([1b39cfd](https://github.com/typescript-eslint/typescript-eslint/commit/1b39cfd307955deb8e407cf8dd3a6ca1ed1b8df6)) +* **typescript-estree:** check modifiers on every node ([#6615](https://github.com/typescript-eslint/typescript-eslint/issues/6615)) ([62d6230](https://github.com/typescript-eslint/typescript-eslint/commit/62d62304e16b553274a80d8ab2653543a22f2391)) +* **typescript-estree:** forbid members in Mapped Type ([#6802](https://github.com/typescript-eslint/typescript-eslint/issues/6802)) ([b93458f](https://github.com/typescript-eslint/typescript-eslint/commit/b93458f9dfe36409d3a736a081ab69ba749caf24)) +* **typescript-estree:** remove optionality from AST boolean properties ([#6274](https://github.com/typescript-eslint/typescript-eslint/issues/6274)) ([df131e2](https://github.com/typescript-eslint/typescript-eslint/commit/df131e258c93e5714c88c0373cfeb2e1e75afc75)) +* **typescript-estree:** strict class heritage clauses check ([#6576](https://github.com/typescript-eslint/typescript-eslint/issues/6576)) ([530185b](https://github.com/typescript-eslint/typescript-eslint/commit/530185bd7e62b05adc673d1f96257dd14bb4d9dc)) +* **typescript-estree:** throw errors for object methods without function bodies ([#6589](https://github.com/typescript-eslint/typescript-eslint/issues/6589)) ([1d78576](https://github.com/typescript-eslint/typescript-eslint/commit/1d78576d41323e35c2d2a2ecc92f6ee76ed61d57)) +* **typescript-estree:** throw errors on interface with implements ([#6551](https://github.com/typescript-eslint/typescript-eslint/issues/6551)) ([67e05c8](https://github.com/typescript-eslint/typescript-eslint/commit/67e05c8f0381ba7065a0257d6038f0a50a3b9888)) +* **typescript-estree:** throw errors when abstract property has initializer ([#6613](https://github.com/typescript-eslint/typescript-eslint/issues/6613)) ([dcdbc76](https://github.com/typescript-eslint/typescript-eslint/commit/dcdbc76d5418a383968d15e32d2eba7a9d2d7e79)) +* **typescript-estree:** warn on deprecated AST property accesses ([#6525](https://github.com/typescript-eslint/typescript-eslint/issues/6525)) ([79c058d](https://github.com/typescript-eslint/typescript-eslint/commit/79c058d69f723ed18a3a7631370009359510d128)) + + +### BREAKING CHANGES + +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/ast-spec + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/ast-spec diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 6437c93c83b..f8ef9553d47 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "5.56.0", + "version": "6.0.0", "description": "Complete specification for the TypeScript-ESTree AST", "private": true, "keywords": [ @@ -9,7 +9,7 @@ "estree" ], "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "files": [ "dist", @@ -31,7 +31,7 @@ "scripts": { "build": "tsc -b tsconfig.build.json && api-extractor run --local", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", + "postclean": "rimraf dist && rimraf coverage", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", @@ -43,11 +43,11 @@ "url": "https://opencollective.com/typescript-eslint" }, "devDependencies": { + "@babel/code-frame": "*", "@babel/core": "*", "@babel/eslint-parser": "*", "@babel/parser": "*", - "@microsoft/api-extractor": "^7.34.4", - "@types/babel__core": "*", + "@microsoft/api-extractor": "^7.36.1", "glob": "*", "jest-diff": "*", "jest-snapshot": "*", diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json index 41721d18d71..60741f21eae 100644 --- a/packages/ast-spec/project.json +++ b/packages/ast-spec/project.json @@ -13,10 +13,11 @@ "outputs": ["{projectRoot}/dist/**/*.ts"] }, "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/ast-spec/**/*.ts"] + "lintFilePatterns": ["packages/ast-spec/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/ast-spec/src/base/ClassBase.ts b/packages/ast-spec/src/base/ClassBase.ts index 4878cfc87b6..595d1393ac4 100644 --- a/packages/ast-spec/src/base/ClassBase.ts +++ b/packages/ast-spec/src/base/ClassBase.ts @@ -13,10 +13,8 @@ export interface ClassBase extends BaseNode { * ``` * abstract class Foo {...} * ``` - * This is always `undefined` for `ClassExpression`. */ - // TODO(#5020) - make this `false` if it is not `abstract` - abstract?: boolean; + abstract: boolean; /** * The class body. */ @@ -26,21 +24,16 @@ export interface ClassBase extends BaseNode { * ``` * declare class Foo {...} * ``` - * This is always `undefined` for `ClassExpression`. */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The decorators declared for the class. - * This is `undefined` if there are no decorators. * ``` * @deco * class Foo {...} * ``` - * This is always `undefined` for `ClassExpression`. */ - // TODO(#5020) - make this an empty array if there are none declared - decorators?: Decorator[]; + decorators: Decorator[]; /** * The class's name. * - For a `ClassExpression` this may be `null` if the name is omitted. @@ -50,21 +43,22 @@ export interface ClassBase extends BaseNode { id: Identifier | null; /** * The implemented interfaces for the class. - * This is `undefined` if there are no implemented interfaces. */ - implements?: TSClassImplements[]; + implements: TSClassImplements[]; /** * The super class this class extends. */ superClass: LeftHandSideExpression | null; /** * The generic type parameters passed to the superClass. - * This is `undefined` if there are no generic type parameters passed. */ - superTypeParameters?: TSTypeParameterInstantiation; + superTypeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `superTypeArguments`} instead. */ + superTypeParameters: TSTypeParameterInstantiation | undefined; + /** * The generic type parameters declared for the class. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/base/FunctionBase.ts b/packages/ast-spec/src/base/FunctionBase.ts index 56446bc78ba..035b18a682e 100644 --- a/packages/ast-spec/src/base/FunctionBase.ts +++ b/packages/ast-spec/src/base/FunctionBase.ts @@ -23,15 +23,14 @@ export interface FunctionBase extends BaseNode { * - For a `TSDeclareFunction` this is always `undefined`. * - For a `TSEmptyBodyFunctionExpression` this is always `null`. */ - body?: BlockStatement | Expression | null; + body: BlockStatement | Expression | null | undefined; /** * This is only `true` if and only if the node is a `TSDeclareFunction` and it has `declare`: * ``` * declare function foo(...) {...} * ``` */ - // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` - declare?: boolean; + declare: boolean; /** * This is only ever `true` if and only the node is an `ArrowFunctionExpression` and the body * is an expression: @@ -63,12 +62,10 @@ export interface FunctionBase extends BaseNode { params: Parameter[]; /** * The return type annotation for the function. - * This is `undefined` if there is no return type declared. */ - returnType?: TSTypeAnnotation; + returnType: TSTypeAnnotation | undefined; /** * The generic type parameter declaration for the function. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/base/MethodDefinitionBase.ts b/packages/ast-spec/src/base/MethodDefinitionBase.ts index f1f2087ccae..f2815458d58 100644 --- a/packages/ast-spec/src/base/MethodDefinitionBase.ts +++ b/packages/ast-spec/src/base/MethodDefinitionBase.ts @@ -1,7 +1,6 @@ import type { FunctionExpression } from '../expression/FunctionExpression/spec'; import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; import type { Decorator } from '../special/Decorator/spec'; -import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; import type { ClassPropertyNameNonComputed, PropertyName, @@ -18,11 +17,10 @@ interface MethodDefinitionBase extends BaseNode { computed: boolean; static: boolean; kind: 'constructor' | 'get' | 'method' | 'set'; - optional?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - typeParameters?: TSTypeParameterDeclaration; - override?: boolean; + optional: boolean; + decorators: Decorator[]; + accessibility: Accessibility | undefined; + override: boolean; } export interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { diff --git a/packages/ast-spec/src/base/PropertyDefinitionBase.ts b/packages/ast-spec/src/base/PropertyDefinitionBase.ts index f1d5b9cc440..a379ac92242 100644 --- a/packages/ast-spec/src/base/PropertyDefinitionBase.ts +++ b/packages/ast-spec/src/base/PropertyDefinitionBase.ts @@ -16,13 +16,13 @@ interface PropertyDefinitionBase extends BaseNode { computed: boolean; static: boolean; declare: boolean; - readonly?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - optional?: boolean; - definite?: boolean; - typeAnnotation?: TSTypeAnnotation; - override?: boolean; + readonly: boolean; + decorators: Decorator[]; + accessibility: Accessibility | undefined; + optional: boolean; + definite: boolean; + typeAnnotation: TSTypeAnnotation | undefined; + override: boolean; } export interface PropertyDefinitionComputedNameBase diff --git a/packages/ast-spec/src/base/TSFunctionSignatureBase.ts b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts index 0da1e7b414d..afd906f3778 100644 --- a/packages/ast-spec/src/base/TSFunctionSignatureBase.ts +++ b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts @@ -5,6 +5,6 @@ import type { BaseNode } from './BaseNode'; export interface TSFunctionSignatureBase extends BaseNode { params: Parameter[]; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; + returnType: TSTypeAnnotation | undefined; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts index 683600ec01d..dc7f701f0f1 100644 --- a/packages/ast-spec/src/base/TSHeritageBase.ts +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -5,5 +5,8 @@ import type { BaseNode } from './BaseNode'; export interface TSHeritageBase extends BaseNode { // TODO(#1852) - this should be restricted to MemberExpression | Identifier expression: Expression; - typeParameters?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; } diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/fixture.ts new file mode 100644 index 00000000000..d54b28def83 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/fixture.ts @@ -0,0 +1 @@ +export class { } diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f81327f8c1f --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ export-missing-name Babel - Error 1`] = `[SyntaxError: A class name is required. (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..428e6049da8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ export-missing-name TSESTree - Error 1`] = ` +"TSError +> 1 | export class { } + | ^^^^^^^^^^^^^^^^ A class declaration without the 'default' modifier must have a name. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..72c44523ffa --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ export-missing-name Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..f81327f8c1f --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ export-missing-name Babel - Error 1`] = `[SyntaxError: A class name is required. (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..09c3f103496 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/export-missing-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ export-missing-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..32918ff7c5f --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier Babel - Error 1`] = `[SyntaxError: Unexpected token (1:21)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..123225a1825 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4f8ef959d9b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot index c17328b32e8..f8cc08dcf67 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body TSESTree - Error 1`] = ` +"TSError +> 1 | class Foo; + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..18e4442401e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f8435732131 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..35683b84121 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..a14c3c54cac --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..49567ea7a7b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-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_/non-identifier-name/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..e3a40451c7e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: A class name is required. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 7b137a8c5de..cbf46a94b95 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | class 'Foo' {} + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..098ed5e7a14 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6ef9a4c481a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot index 0be64ad3473..106f67b9962 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = ` +"TSError +> 1 | class C<1> {} + | ^ Type parameter declaration expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..98c58289073 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-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/abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot index 556a8358a93..bbe0a4ac3df 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,13 @@ Program { end: { column: 21, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [15, 18], loc: { @@ -27,6 +31,7 @@ Program { end: { column: 18, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 21], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot index 54a7219ce9a..b4665912df8 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration ClassDeclaration abstract AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + abstract: true, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [19, 21], + loc: { + start: { column: 19, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index a1d8cdbc4c7..97f866fa71b 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -17,9 +18,12 @@ Program { }, }, declare: true, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [14, 17], loc: { @@ -27,6 +31,7 @@ Program { end: { column: 17, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 20], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 9fbaa86d5a2..7b52ed82f8c 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration ClassDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: true, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot index c9cc55d9563..c9593be9d1a 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,12 +17,15 @@ Program { end: { column: 12, line: 3 }, }, }, + declare: false, decorators: [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "decoratorOne", + optional: false, range: [1, 13], loc: { @@ -40,7 +44,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "decoratorTwo", + optional: false, range: [15, 27], loc: { @@ -58,7 +64,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [34, 37], loc: { @@ -66,6 +74,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot index 751a6cc951f..8170c78f09b 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,98 @@ exports[`AST Fixtures declaration ClassDeclaration decorator-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [38, 40], + loc: { + start: { column: 10, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'decoratorOne', +- optional: false, + + range: [1, 13], + loc: { + start: { column: 1, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'decoratorTwo', +- optional: false, + + range: [15, 27], + loc: { + start: { column: 1, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + + range: [14, 27], + loc: { + start: { column: 0, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [34, 37], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot index 589d5478de6..a8e11ccde02 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,12 +17,15 @@ Program { end: { column: 12, line: 2 }, }, }, + declare: false, decorators: [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "decorator", + optional: false, range: [1, 10], loc: { @@ -39,7 +43,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [17, 20], loc: { @@ -47,6 +53,7 @@ Program { end: { column: 9, line: 2 }, }, }, + implements: [], superClass: null, range: [0, 23], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot index 503bd4f5ad8..373c6c0b694 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,77 @@ exports[`AST Fixtures declaration ClassDeclaration decorator-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 10, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'decorator', +- optional: false, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 6, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 2 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 3 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index 189097a1c6b..df093f58556 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 12, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 12], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 795e34e032c..230ef4b49bc 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration ClassDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [10, 12], + loc: { + start: { column: 10, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot index 53d85a3efcb..e2d4e3c5b2b 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 28, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: Literal { type: "Literal", raw: "'Thing'", diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot index 432a1483eb4..f9a14574511 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ClassDeclaration extends-literal AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: Literal { + type: 'Literal', + raw: '\\'Thing\\'', + value: 'Thing', + + range: [18, 25], + loc: { + start: { column: 18, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot index d1b1649faf2..96f7df79dc0 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 32, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Set", + optional: false, range: [18, 21], loc: { @@ -36,7 +44,7 @@ Program { end: { column: 21, line: 1 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { + superTypeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSStringKeyword { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot index d7a16a19520..64ff14cbc80 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,87 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [30, 32], + loc: { + start: { column: 30, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Set', +- optional: false, + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +- superTypeArguments: TSTypeParameterInstantiation { ++ superTypeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot index 2ce8cf69e4f..d515d3cc5d0 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 27, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Object", + optional: false, range: [18, 24], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot index 7408520a611..724e995d358 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,66 @@ exports[`AST Fixtures declaration ClassDeclaration extends AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Object', +- optional: false, + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot index ce7ed5710f2..145331d6f60 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 48, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "Object", + optional: false, range: [21, 27], loc: { @@ -50,7 +57,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "Function", + optional: false, range: [29, 37], loc: { @@ -69,7 +78,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "RegExp", + optional: false, range: [39, 45], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot index 77b0476655c..d38bcdd0e91 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment end: { column: 48, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Object', +- optional: false, range: [21, 27], loc: { @@ -58,7 +65,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Function', +- optional: false, range: [29, 37], loc: { @@ -79,7 +88,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'RegExp', +- optional: false, range: [39, 45], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot index da55fad4be0..0fac21498b6 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "Object", + optional: false, range: [21, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot index b0aec089f61..e8a1bd9feae 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment end: { column: 30, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Object', +- optional: false, range: [21, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot index 5608ba08cb8..463d9e92366 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot index 8d97c664397..f995f9cb827 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS end: { column: 15, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [10, 11], - loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot index e67ef886321..449bb1d1903 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Set", + optional: false, range: [21, 24], loc: { @@ -36,14 +44,16 @@ Program { end: { column: 24, line: 1 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { + superTypeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [25, 26], loc: { @@ -75,7 +85,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot index 60e9b202a98..c370fbf2d48 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- end: { column: 30, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Set', +- optional: false, range: [21, 24], loc: { @@ -40,14 +48,17 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- end: { column: 24, line: 1 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { +- superTypeArguments: TSTypeParameterInstantiation { ++ superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [25, 26], loc: { @@ -79,7 +90,9 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [10, 11], - loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index 816492fcd48..881f037d032 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [14, 18], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 6, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -41,9 +48,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -51,6 +62,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 21], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index 121e647439e..24c2998c99c 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [14, 18], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment end: { column: 6, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -45,9 +52,13 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -55,6 +66,7 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 21], diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b45b0c8fc85 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-TSESTree-Error.shot index d3c411c7ec3..41bd9538e7f 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source TSESTree - Error 1`] = `[TSError: Expression expected.]`; +exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source TSESTree - Error 1`] = ` +"TSError +> 1 | export * from; + | ^ Expression expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..89889f0ae31 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-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_/named-non-identifier/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..04ccfb73d5b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot index 5f6d97e5f2b..cea1b9f2468 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier TSESTree - Error 1`] = ` +"TSError +> 1 | export * as 'foo' from 'module'; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..3e05e98bfaf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..a3d08a7b52a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source Babel - Error 1`] = `[SyntaxError: Unexpected token (1:14)]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot index bcf5b40695c..f3e5cca5923 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source TSESTree - Error 1`] = `[TSError: Module specifier must be a string literal.]`; +exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source TSESTree - Error 1`] = ` +"TSError +> 1 | export * from module; + | ^^^^^^ Module specifier must be a string literal. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..3a1a419a831 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot index d5880f6e82a..cfc3aa2ff7c 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [29, 33], loc: { diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot index 077fe892d33..73bad658c9a 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,75 @@ exports[`AST Fixtures declaration ExportAllDeclaration assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [29, 33], + loc: { + start: { column: 29, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\'json\\'', + value: 'json', + + range: [35, 41], + loc: { + start: { column: 35, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + + range: [29, 41], + loc: { + start: { column: 29, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + ], + exported: null, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/1-TSESTree-AST.shot index 46c322f2648..4ca39e1413a 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { assertions: [], exported: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/5-AST-Alignment-AST.shot index 7d543dbf759..35ef7eeb190 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/kind-type/snapshots/5-AST-Alignment-AST.shot @@ -13,7 +13,9 @@ exports[`AST Fixtures declaration ExportAllDeclaration kind-type AST Alignment - assertions: Array [], exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot index 414f4ad0e4d..0e45eb9b9ff 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { assertions: [], exported: Identifier { type: "Identifier", + decorators: [], name: "mod", + optional: false, range: [12, 15], loc: { diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot index 8aabbae3357..195370c94fc 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,53 @@ exports[`AST Fixtures declaration ExportAllDeclaration named AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [], + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'mod', +- optional: false, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'module\\'', + value: 'module', + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..294c438cb03 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum Babel - Error 1`] = `[SyntaxError: Unexpected reserved word 'enum'. (1:15)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot index c289052b36c..2d7fc99e0d6 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum TSESTree - Error 1`] = `[TSError: Expression expected.]`; +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum TSESTree - Error 1`] = ` +"TSError +> 1 | export default enum Foo {} + | ^ Expression expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..32a1cb0d300 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..a80c3233614 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:24)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot index d1633569950..49d3238347f 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace TSESTree - Error 1`] = `[TSError: ';' expected.]`; +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace TSESTree - Error 1`] = ` +"TSError +> 1 | export default namespace Foo {} + | ^ ';' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7ecaa9bcded --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6afc67d4a5b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:19)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot index bce2c7cd5ee..c9b9a1add35 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias TSESTree - Error 1`] = `[TSError: ';' expected.]`; +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias TSESTree - Error 1`] = ` +"TSError +> 1 | export default type Foo = 1; + | ^ ';' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..9f4c01a0337 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..318dee3aacf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration Babel - Error 1`] = `[SyntaxError: Only expressions, functions or classes are allowed as the \`default\` export. (1:15)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot index 43ab9a3893e..d8dbfa38549 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration TSESTree - Error 1`] = `[TSError: Expression expected.]`; +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration TSESTree - Error 1`] = ` +"TSError +> 1 | export default const x = 1; + | ^ Expression expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..327cd763562 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot index 39f13498111..b9477b99094 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, range: [15, 23], diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot index 6c617458733..27fa552a126 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,54 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: null, +- implements: Array [], + superClass: null, + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot index b385410a6f4..78e1248e57a 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot @@ -19,6 +19,7 @@ Program { end: { column: 29, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: null, diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot index 0472fbccb82..5ccd7cf076e 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,54 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [27, 29], + loc: { + start: { column: 27, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: null, + params: Array [], + + range: [15, 29], + loc: { + start: { column: 15, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot index 27c43a096a4..6d1adf5f5c3 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,9 +19,13 @@ Program { end: { column: 28, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [22, 25], loc: { @@ -28,6 +33,7 @@ Program { end: { column: 25, line: 1 }, }, }, + implements: [], superClass: null, range: [16, 28], diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot index 4d3dd269c49..f49e8ea492d 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: ClassExpression { + type: 'ClassExpression', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [22, 25], + loc: { + start: { column: 22, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [16, 28], + loc: { + start: { column: 16, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot index 10f61a476b3..5f8ad663f08 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,9 +19,13 @@ Program { end: { column: 27, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [21, 24], loc: { @@ -28,6 +33,7 @@ Program { end: { column: 24, line: 1 }, }, }, + implements: [], superClass: null, range: [15, 27], diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot index 892ae8987da..31cfe8a973e 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [15, 27], + loc: { + start: { column: 15, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot index 8583f46cc17..538a6bf0b1b 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -19,11 +19,14 @@ Program { end: { column: 32, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [24, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot index 6e67c16fb8b..d5c74ed1fc0 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [30, 32], + loc: { + start: { column: 30, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + params: Array [], + + range: [15, 32], + loc: { + start: { column: 15, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot index 2b194f9fe41..e065912d92e 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "ExportDefaultDeclaration", declaration: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot index 1fc84e1257d..5682d50ae12 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,41 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration identifier AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot index 4f5ff343403..2375cb57a51 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -18,9 +18,13 @@ Program { end: { column: 31, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [25, 28], loc: { diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot index 778b30b1513..5818ff75d81 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration interface AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [29, 31], + loc: { + start: { column: 29, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [25, 28], + loc: { + start: { column: 25, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [15, 31], + loc: { + start: { column: 15, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..dabc7d927d5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot index 71841045f6c..015ff072aa2 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal TSESTree - Error 1`] = ` +"TSError +> 1 | export { a as 'a' }; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..efb97399842 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b3ebe67f29a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class Babel - Error 1`] = `[SyntaxError: A class name is required. (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot index 4bb37139b1b..499868339f5 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class TSESTree - Error 1`] = ` +"TSError +> 1 | export class {} + | ^^^^^^^^^^^^^^^ A class declaration without the 'default' modifier must have a name. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..82e5ade4750 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot index 82e5ade4750..1f517013974 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..70ef1140faa --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression Babel - Error 1`] = `[SyntaxError: Unexpected token (1:16)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot index 9c89f7d7f37..4082dd30023 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression TSESTree - Error 1`] = ` +"TSError +> 1 | export function () {} + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..15aae2856e1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..d3a01941b96 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot index bc1507d797f..28d1d243964 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function TSESTree - Error 1`] = ` +"TSError +> 1 | export () => {}; + | ^ Declaration or statement expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..fd6445ddef3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..873ef0496aa --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ assertion Babel - Error 1`] = `[SyntaxError: A JSON module can only be imported with \`default\`. (1:9)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..b75c9eb03cb --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/assertion/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ assertion Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..59d790cb18d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot index af9eba5ac2c..ceed78baec4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression TSESTree - Error 1`] = ` +"TSError +> 1 | export (class Foo {}); + | ^ Declaration or statement expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..dbe6913aab5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..968987af209 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot index 302c6c7c652..1f563cfbf37 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct TSESTree - Error 1`] = ` +"TSError +> 1 | export a; + | ^ Declaration or statement expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..00f60c625f5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..3ba27489473 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-Babel-Error.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced Babel - Error 1`] = ` +[SyntaxError: A string literal cannot be used as an exported binding without \`from\`. +- Did you mean \`export { 'a' as 'a' } from 'some-module'\`? (1:9)] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot index 7e7d8c008fc..55c09361565 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced TSESTree - Error 1`] = ` +"TSError +> 1 | export { 'a' }; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f2d4bb40cc5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..cf5a26409d1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot index 9e96ac05522..119a66ed891 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct TSESTree - Error 1`] = ` +"TSError +> 1 | export 'a'; + | ^ Declaration or statement expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7d06f41fc05 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot index 3d293d47906..4b9ea6313a3 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [14, 15], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot index 845f2cb5cfb..81487c9bfc1 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration aliased AST Alignment - type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [14, 15], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration aliased AST Alignment - exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot index 38a932b1510..f5bf7d6c3a9 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -19,9 +20,13 @@ Program { end: { column: 19, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [13, 16], loc: { @@ -29,6 +34,7 @@ Program { end: { column: 16, line: 1 }, }, }, + implements: [], superClass: null, range: [7, 19], diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot index cb90ab5e0fb..1e08010d64d 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,68 @@ exports[`AST Fixtures declaration ExportNamedDeclaration class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [7, 19], + loc: { + start: { column: 7, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot index e3bcf1073f7..47339e03ec4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [24, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot index 9aaae286a11..b1623c4968c 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration declare-function AST Al generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [24, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot index 52eb4ae3b01..8f25a46494f 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,13 @@ Program { assertions: [], declaration: TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [12, 15], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index 1a21129afb2..cba00ad04c1 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,56 @@ exports[`AST Fixtures declaration ExportNamedDeclaration enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + members: Array [], + + range: [7, 18], + loc: { + start: { column: 7, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot index d00e691d3bc..ba60ee6c0a8 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot @@ -20,11 +20,14 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [16, 19], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot index fe318b3ed6f..31a4f289f30 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,68 @@ exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + params: Array [], + + range: [7, 24], + loc: { + start: { column: 7, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot index 24a743aa3e0..72b482685c1 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot index 240f602618f..d17b88c8cc6 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced AST A type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced AST A exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot index ce7c51c99dc..cf88a1a29c4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -45,7 +49,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { @@ -56,7 +62,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot index 8d76dc7c571..19de4d0f7c2 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -49,7 +53,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [12, 13], loc: { @@ -60,7 +66,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot index de96750e8a2..490d6d7493d 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -19,9 +19,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot index 02ddc518379..4a6ef4e90d4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -23,9 +23,13 @@ exports[`AST Fixtures declaration ExportNamedDeclaration interface AST Alignment end: { column: 23, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..494c5144247 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + declaration: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [7, 23], + loc: { + start: { column: 7, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "value", + source: null, + specifiers: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot index fe50a12a050..073273fe601 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot @@ -19,9 +19,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..0a3d1ca1dee --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [7, 16], + loc: { + start: { column: 7, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot index d9b1ab535bb..f2293b94d19 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot @@ -23,9 +23,13 @@ exports[`AST Fixtures declaration ExportNamedDeclaration namespace AST Alignment end: { column: 23, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot index 9bc7be30c10..a5080b151db 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot index db70418e9f1..896628c6482 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures declaration ExportNamedDeclaration type-alias AST Alignmen assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot index a28d2704149..92f70fe2850 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot @@ -12,9 +12,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [13, 14], loc: { @@ -41,6 +44,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [7, 19], diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot index bb45021e9c4..b265b8c947b 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,78 @@ exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [13, 18], + loc: { + start: { column: 13, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [7, 19], + loc: { + start: { column: 7, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..d0110ccac63 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot index e8630b3f99c..0956bdc9b2f 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported TSESTree - Error 1`] = ` +"TSError +> 1 | function () {} + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..adae3f26337 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..83a2a868f15 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..04a70d3af29 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..d23f3eff955 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 156bebb725c..ac2aad35f54 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | function 1() {} + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f34f77cd1b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..8be1b8d27a3 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot index 8c643863afb..13d3d85c2d0 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = ` +"TSError +> 1 | function foo<1>() {} + | ^ Type parameter declaration expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f2b863d8647 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot index e6fff4485ad..5db6bc765d6 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [15, 18], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot index fe3cf227fba..0d134e323b2 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration FunctionDeclaration async AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index 5488f802897..ddeb4088eba 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 17, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index b08265806b5..4d1680384f2 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration FunctionDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot index e4e71a2fb49..67d476e5548 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 18, line: 1 }, }, }, + declare: false, expression: false, generator: true, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [10, 13], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot index e94e87d038a..37659c98a4a 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration FunctionDeclaration generator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + params: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot index 50300869247..25ed627b8d0 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -32,7 +35,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [13, 14], loc: { @@ -42,7 +47,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [16, 17], loc: { @@ -52,7 +59,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [19, 20], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot index f8b80c46b1e..8e1fef0e8e0 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,92 @@ exports[`AST Fixtures declaration FunctionDeclaration param-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot index f2b6eb75bd0..17873554d10 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 18, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -32,7 +35,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot index 5c75a74de72..24d97c68311 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,68 @@ exports[`AST Fixtures declaration FunctionDeclaration param-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot index 9b4bc22574a..71e8be80b3c 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot index d0df21058e9..50df6aa1bbb 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures declaration FunctionDeclaration returnType AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index c0c9374cef9..7ca866c911b 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 26, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -39,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [13, 14], loc: { @@ -61,7 +66,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [16, 17], loc: { @@ -83,7 +90,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "V", + optional: false, range: [19, 20], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index b910a007d54..a51ce3f5843 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm end: { column: 26, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [9, 12], loc: { @@ -43,7 +46,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [13, 14], - loc: { @@ -66,7 +71,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [16, 17], - loc: { @@ -89,7 +96,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [19, 20], - loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index 591b41616e6..397c78f0a9b 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 20, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -39,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index d54f1d9b395..f70efb2f43c 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-one AST Alignme end: { column: 20, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [9, 12], loc: { @@ -43,7 +46,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-one AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [13, 14], - loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts index 4fe3d2dc693..0ede710628c 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts @@ -6,8 +6,7 @@ import type { BlockStatement } from '../../statement/BlockStatement/spec'; interface FunctionDeclarationBase extends FunctionBase { type: AST_NODE_TYPES.FunctionDeclaration; body: BlockStatement; - // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` - declare?: false; + declare: false; expression: false; } diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..438c9cdf750 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-TSESTree-Error.shot index 233c225dd50..33e9c446a1a 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier TSESTree - Error 1`] = ` +"TSError +> 1 | import 1 from 'mod'; + | ^ Declaration or statement expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..2e0bcbec5a5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..9cf4c4b719a --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/1-TSESTree-Error.shot index d94d399517f..e5cfc6b43cc 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace TSESTree - Error 1`] = `[TSError: 'from' expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace TSESTree - Error 1`] = ` +"TSError +> 1 | import { b }, * as a from 'a'; + | ^ 'from' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..89fae3fa27c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..970528e3253 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot index 2ca1651099b..a4b94678f3e 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ named-non-identifier TSESTree - Error 1`] = ` +"TSError +> 1 | import { 1 } from 'mod'; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..fefbeef9c52 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..294d069aacc --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/1-TSESTree-Error.shot index 9d2be22fe16..59a98df1b7c 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default TSESTree - Error 1`] = `[TSError: 'from' expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default TSESTree - Error 1`] = ` +"TSError +> 1 | import * as b, a from 'mod'; + | ^ 'from' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..6e491db0e63 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..605940a8433 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/1-TSESTree-Error.shot index a2271606e4b..53e838303c4 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named TSESTree - Error 1`] = `[TSError: 'from' expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named TSESTree - Error 1`] = ` +"TSError +> 1 | import * as a, { b } from 'a'; + | ^ 'from' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f1e891dbeca --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..8efbfcaf519 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/1-TSESTree-Error.shot index 0a5d4ab3922..3f80cb253da 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace TSESTree - Error 1`] = `[TSError: 'from' expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace TSESTree - Error 1`] = ` +"TSError +> 1 | import * as a, * as b from 'a'; + | ^ 'from' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..e3c8c7a6288 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..a511cc6c94d --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/1-TSESTree-Error.shot index fa9ec459a92..4264e2530ef 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier TSESTree - Error 1`] = ` +"TSError +> 1 | import * as 1 from 'mod'; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f0d97ae32bc --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..49abb836662 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot index 4cfff84fd98..9c245972b5d 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration ImportDeclaration _error_ non-string-source TSESTree - Error 1`] = ` +"TSError +> 1 | import * as x from module; + | ^^^^^^ Module specifier must be a string literal. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0d5964ffc24 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot index 21520b95679..c4795890019 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [34, 38], loc: { @@ -55,7 +57,9 @@ Program { type: "ImportNamespaceSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot index c7b85e439da..96cbf1acd91 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures declaration ImportDeclaration assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [34, 38], + loc: { + start: { column: 34, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\'json\\'', + value: 'json', + + range: [40, 46], + loc: { + start: { column: 40, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [34, 46], + loc: { + start: { column: 34, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + ], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + specifiers: Array [ + ImportNamespaceSpecifier { + type: 'ImportNamespaceSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [7, 13], + loc: { + start: { column: 7, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot index c313d622bce..8b38359c0e5 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [7, 8], loc: { @@ -43,7 +45,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { @@ -54,7 +58,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { @@ -73,7 +79,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [15, 16], loc: { @@ -84,7 +92,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [15, 16], loc: { @@ -103,7 +113,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "d", + optional: false, range: [18, 19], loc: { @@ -114,7 +126,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "d", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot index 5a7d0eb9f83..c6194ed4271 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,166 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-named-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [27, 32], + loc: { + start: { column: 27, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'd', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'd', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot index eb772c5560a..bed5bd1289c 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [26, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot index 77b9d9ec72b..7d7acd1e28b 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,64 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-named-none AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [37, 42], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + ], + + range: [19, 43], + loc: { + start: { column: 0, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + sourceType: 'module', + + range: [19, 44], + loc: { + start: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot index 1ea4756931c..f54adf1db18 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [7, 8], loc: { @@ -43,7 +45,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { @@ -54,7 +58,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot index 8661b6d43b2..5457bc7111e 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,98 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-named-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot index 34c14d0729c..ab716a4e00f 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [7, 8], loc: { @@ -43,7 +45,9 @@ Program { type: "ImportNamespaceSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot index c975ae69118..622ac6c755b 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,85 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-namespace AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [22, 27], + loc: { + start: { column: 22, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportNamespaceSpecifier { + type: 'ImportNamespaceSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [10, 16], + loc: { + start: { column: 10, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot index d8ef93e2bcf..50127e55882 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot index 2524045a807..4bbe4eb9480 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,64 @@ exports[`AST Fixtures declaration ImportDeclaration default AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot index 69d5b756745..38a4b893dcc 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -54,7 +58,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { @@ -65,7 +71,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [12, 13], loc: { @@ -84,7 +92,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [15, 16], loc: { @@ -95,7 +105,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot index 3f4b4b678e7..43e85474199 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,145 @@ exports[`AST Fixtures declaration ImportDeclaration named-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [24, 29], + loc: { + start: { column: 24, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot index e12f543ac79..1bf7774ca11 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot index a502907e8f6..d9cd9c7eb25 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,77 @@ exports[`AST Fixtures declaration ImportDeclaration named-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [18, 23], + loc: { + start: { column: 18, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..01db37879fb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-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-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..1f36cb0955f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..e56bbb59892 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..22b125b5643 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..bb9716addfb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot index 53a142d37be..552e4f76d05 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported TSESTree - Error 1`] = ` +"TSError +> 1 | declare function (); + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7bd554c552a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..be819649c55 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..83fabb4dfc7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..12fadb8985a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 86f0f5e5e10..42648fc529a 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | declare function 1(); + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0587657ad4e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..82c36588558 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot index 4b033027f13..cb267be45a9 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-type-param TSESTree - Error 1`] = ` +"TSError +> 1 | declare function f<1>(): void; + | ^ Type parameter declaration expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0d57d7e26a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot index 4a3c6fc890f..02d0f0be04a 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 89f8ab5e347..db8ca71596d 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,45 @@ exports[`AST Fixtures declaration TSDeclareFunction empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot index 1a4b2942e3f..b621f52027b 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: true, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot index e5478271a49..f2de95210fa 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,45 @@ exports[`AST Fixtures declaration TSDeclareFunction generator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot index 272852bf6bb..eef7af8af21 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -23,7 +25,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [21, 22], loc: { @@ -33,7 +37,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [24, 25], loc: { @@ -43,7 +49,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [27, 28], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot index cfed52f085e..a5f9bb2ff41 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,82 @@ exports[`AST Fixtures declaration TSDeclareFunction param-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot index da937eccc13..7b4383d832f 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -23,7 +25,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot index 81f8c45d656..45d4a64b961 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,58 @@ exports[`AST Fixtures declaration TSDeclareFunction param-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot index 792faca0535..fa8ec36adb3 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot index bddda38b36f..291cdb6599d 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,63 @@ exports[`AST Fixtures declaration TSDeclareFunction returnType AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [24, 28], + loc: { + start: { column: 24, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index 6af698ad0b9..acf12bd81e2 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -30,7 +32,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [21, 22], loc: { @@ -52,7 +56,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [24, 25], loc: { @@ -74,7 +80,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "V", + optional: false, range: [27, 28], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index 711d27f25cf..6a9a1fce530 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -16,7 +16,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [17, 20], loc: { @@ -34,7 +36,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { @@ -57,8 +61,11 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [24, 25], - loc: { - start: { column: 24, line: 1 }, @@ -66,8 +73,7 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - }, - }, - out: false, -+ name: 'U', - +- range: [24, 25], loc: { start: { column: 24, line: 1 }, @@ -80,7 +86,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [27, 28], - loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index 5ee44430806..15316bd31a9 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -30,7 +32,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index a683f16a878..e1e39ac6154 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -16,7 +16,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-one AST Alignment generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [17, 20], loc: { @@ -34,7 +36,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-one AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot index dd3182b826a..98e4d655fb3 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot @@ -7,11 +7,14 @@ Program { TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [9, 12], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot index 7f5b5b1b141..3de9bc65960 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,63 @@ exports[`AST Fixtures declaration TSDeclareFunction without-declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts index ea37a1e874f..50cc07ec424 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts @@ -5,9 +5,7 @@ import type { BlockStatement } from '../../statement/BlockStatement/spec'; // TODO(#1852) - async + declare are semantically invalid together export interface TSDeclareFunction extends FunctionBase { type: AST_NODE_TYPES.TSDeclareFunction; - // TODO(#1852) - breaking change enforce this is always `null` like `TSEmptyBodyFunctionExpression` - body?: BlockStatement; - // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` - declare?: boolean; + body: BlockStatement | undefined; + declare: boolean; expression: false; } diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/fixture.ts new file mode 100644 index 00000000000..7f23a59e1c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/fixture.ts @@ -0,0 +1 @@ +@decl enum Test {} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..fdb865b6c32 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..7e24abcf6f6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ decorator TSESTree - Error 1`] = ` +"TSError +> 1 | @decl enum Test {} + | ^^^^^ Decorators are not valid here. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..4851229263b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ decorator Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..fdb865b6c32 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..f0a67ebe105 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ decorator Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..69fc4aef147 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot index 89896499476..4d532e2b649 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body TSESTree - Error 1`] = ` +"TSError +> 1 | enum Foo; + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..4d1d30b58b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..676c0503e37 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot index 0653a9025ef..31015b7ff4e 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id TSESTree - Error 1`] = ` +"TSError +> 1 | enum {} + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..5fb97329274 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..1cf8f0ab899 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 15a27efccaf..764dad5e9a4 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSEnumDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSEnumDeclaration _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | enum 1 {} + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..dd5c6175008 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot index 5f55ba23c4d..45c1e395be0 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot @@ -7,9 +7,12 @@ Program { TSEnumDeclaration { type: "TSEnumDeclaration", const: true, + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [11, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot index 95d4c8f6b4a..c9480e42c3a 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,43 @@ exports[`AST Fixtures declaration TSEnumDeclaration const AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', + const: true, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + members: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 19285542064..b4e7d92295e 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -6,10 +6,13 @@ Program { body: [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, declare: true, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [13, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 5085b6b4609..3926e3f88cc 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,43 @@ exports[`AST Fixtures declaration TSEnumDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + members: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index cf40de4a0f5..2c454bcfcd8 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,13 @@ Program { body: [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [5, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 2ce5c714db1..86d2f4844f4 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,43 @@ exports[`AST Fixtures declaration TSEnumDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [], + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index 9cfcde23d9c..29f98e4e129 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,13 @@ Program { body: [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [5, 8], loc: { @@ -19,9 +23,12 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index b707fc5d46b..7137394a11b 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,66 @@ exports[`AST Fixtures declaration TSEnumDeclaration with-member-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + ], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts index 9a0df845c5d..1625063426c 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts @@ -2,7 +2,6 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; import type { TSEnumMember } from '../../element/TSEnumMember/spec'; import type { Identifier } from '../../expression/Identifier/spec'; -import type { Modifier } from '../../unions/Modifier'; export interface TSEnumDeclaration extends BaseNode { type: AST_NODE_TYPES.TSEnumDeclaration; @@ -12,16 +11,14 @@ export interface TSEnumDeclaration extends BaseNode { * const enum Foo {...} * ``` */ - // TODO(#5020) - make this `false` if it is not `const` - const?: boolean; + const: boolean; /** * Whether this is a `declare`d enum. * ``` * declare enum Foo {...} * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The enum name. */ @@ -30,6 +27,4 @@ export interface TSEnumDeclaration extends BaseNode { * 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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..d5cc0b77735 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/1-TSESTree-Error.shot index 3593291fdb2..7104057f55f 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid TSESTree - Error 1`] = ` +"TSError +> 1 | import F = 1; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..463142c713f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b19940abe31 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..cda96c9ac3d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b8f9e5be4e4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..d9472dcc7b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..3c24250cf63 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot index b5dc03a804c..622b5fb5c39 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id TSESTree - Error 1`] = ` +"TSError +> 1 | import = A.B; + | ^ Declaration or statement expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..3f9e697fc06 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6dcc0a59954 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/1-TSESTree-Error.shot index cb33fd8279b..01d898e8806 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference TSESTree - Error 1`] = `[TSError: '=' expected.]`; +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference TSESTree - Error 1`] = ` +"TSError +> 1 | import F; + | ^ '=' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7a3b4167a3b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot index bf7a3fe7315..6b87f8acb07 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [7, 8], loc: { @@ -17,14 +19,15 @@ Program { }, }, importKind: "value", - isExport: false, moduleReference: TSQualifiedName { type: "TSQualifiedName", left: TSQualifiedName { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [11, 12], loc: { @@ -34,7 +37,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [13, 14], loc: { @@ -51,7 +56,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot index 88ec007b237..c67dc9cb5da 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,96 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSImportEqualsDeclaration { + type: 'TSImportEqualsDeclaration', + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + 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', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + 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', +- decorators: Array [], + name: 'C', +- optional: false, + + 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-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot index e0c1fbc6a87..1af8164565d 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [7, 8], loc: { @@ -17,10 +19,11 @@ Program { }, }, importKind: "value", - isExport: false, moduleReference: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [11, 12], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot index 0cb17969d4f..f86cbe219c4 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,54 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSImportEqualsDeclaration { + type: 'TSImportEqualsDeclaration', + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: 'value', ++ isExport: false, + moduleReference: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + 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/external-module-ref-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot index 808994ac561..114d1f13924 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [7, 8], loc: { @@ -17,7 +19,6 @@ Program { }, }, importKind: "value", - isExport: false, moduleReference: TSExternalModuleReference { type: "TSExternalModuleReference", expression: Literal { 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 index 098a19b4d7f..1e4827fc528 100644 --- 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 @@ -46,7 +46,7 @@ Program { }, }, ], - sourceType: "script", + sourceType: "module", range: [0, 27], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot index 864ce14bb37..abd647535f7 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref- type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [7, 8], loc: { @@ -21,7 +23,7 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref- }, }, importKind: 'value', - isExport: false, ++ isExport: false, moduleReference: TSExternalModuleReference { type: 'TSExternalModuleReference', expression: Literal { @@ -50,8 +52,7 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref- }, }, ], -- sourceType: 'module', -+ sourceType: 'script', + sourceType: 'module', range: [0, 27], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts index d4db9a64168..15fd64f11ad 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts @@ -22,12 +22,4 @@ export interface TSImportEqualsDeclaration extends BaseNode { 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_/decorator/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/fixture.ts new file mode 100644 index 00000000000..c6b88c003fb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/fixture.ts @@ -0,0 +1 @@ +@decl interface Test {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..a9513b747ea --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..de2011df9ce --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ decorator TSESTree - Error 1`] = ` +"TSError +> 1 | @decl interface Test {} + | ^^^^^ Decorators are not valid here. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..fb137780f45 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ decorator Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..a9513b747ea --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..6018ccd90e0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ decorator Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..12baf6e0738 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot index 128274dff58..ab7e5c43958 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body TSESTree - Error 1`] = ` +"TSError +> 1 | interface F; + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..6caba1ae72c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..add92930a37 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..6eb1bf9104f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..e06bfcc1a1c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot index d640ad78d53..2c69569d0fe 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-id TSESTree - Error 1`] = ` +"TSError +> 1 | interface {} + | ^ Interface must be given a name. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..bbce8c51c4d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..936edbec8c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..5846179dd56 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..e7b584a9cd2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..c429168c288 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..64f544addb3 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 7b6a2f0a666..4c5a9b4b098 100644 --- 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 @@ -1,3 +1,8 @@ // 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'.]`; +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | interface 1 {} + | ^ Interface name cannot be '1'. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..5470a1ec04e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..69166a9fa11 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot index e48629574cf..b84a281982b 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = ` +"TSError +> 1 | interface F<1> {} + | ^ Type parameter declaration expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..5f1be010c62 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 70ec89ee02e..97c82621d04 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index c5bfaba693b..f283ed85e49 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,52 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [20, 22], + loc: { + start: { column: 20, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + declare: true, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index 35856879162..4c78898903e 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 14, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 42bc3c4eb68..81a856aecb1 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,52 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot index 98cd5c06786..9486b7754d6 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 30, line: 1 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [20, 21], loc: { @@ -40,7 +43,9 @@ Program { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [23, 24], loc: { @@ -59,7 +64,9 @@ Program { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [26, 27], loc: { @@ -77,7 +84,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot index 793c00b7e98..5a1f33b4a95 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm end: { column: 30, line: 1 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [20, 21], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [23, 24], loc: { @@ -69,7 +74,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [26, 27], loc: { @@ -87,7 +94,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot index a9113c856a8..d05004fd0b0 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [20, 21], loc: { @@ -39,7 +42,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot index fe6cf12f1a5..a33d62920a1 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignme end: { column: 24, line: 1 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignme + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [20, 21], loc: { @@ -45,7 +48,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignme ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index cb387218512..81de6defaa5 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { @@ -35,7 +39,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [12, 13], loc: { @@ -57,7 +63,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [15, 16], loc: { @@ -79,7 +87,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "V", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index 4b1dec3a269..d9d73d0a5b5 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali end: { column: 23, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [12, 13], - loc: { @@ -62,7 +68,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [15, 16], - loc: { @@ -85,7 +93,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [18, 19], - loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index f3ce068e927..4d08ac3f08a 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 17, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { @@ -35,7 +39,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index 8470b26ba84..b32db7edb88 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one AST Alig end: { column: 17, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [12, 13], - loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index 1438312b63c..9ea6e2ce08f 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [16, 20], loc: { @@ -22,6 +24,9 @@ Program { end: { column: 6, line: 2 }, }, }, + optional: false, + readonly: false, + static: false, range: [16, 21], loc: { @@ -37,9 +42,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index 8e0b58b2efe..63acdce107d 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,78 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [16, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [12, 23], + loc: { + start: { column: 12, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts index a75c769daf9..9a35efc7c15 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts @@ -7,8 +7,6 @@ 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 */ @@ -16,21 +14,17 @@ export interface TSInterfaceDeclaration extends BaseNode { /** * Whether the interface was `declare`d, `undefined` otherwise */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The types this interface `extends` */ - extends?: TSInterfaceHeritage[]; + extends: TSInterfaceHeritage[]; /** * The name of this interface */ id: Identifier; - // TODO(#4759) - breaking change remove this - implements?: TSInterfaceHeritage[]; /** * The generic type parameters declared for the interface. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..9848b6e55cd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-TSESTree-Error.shot index 082a7d854c2..60094efbe41 100644 --- 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 @@ -1,3 +1,8 @@ // 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'.]`; +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-invalid-id TSESTree - Error 1`] = ` +"TSError +> 1 | module 1 {} + | ^ Namespace name cannot be '1'. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..1ed7cf1aba5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..c7c0b7ca1d4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/1-TSESTree-Error.shot index 0a8a833a27a..d6c0dfba3f3 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-missing-body TSESTree - Error 1`] = ` +"TSError +> 1 | module F; + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f8381f6dde3 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..0cc4df30bc5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/1-TSESTree-Error.shot index 6a1c0b8eebf..a3fd19de9bd 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-declare-no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-declare-no-body TSESTree - Error 1`] = ` +"TSError +> 1 | declare namespace F; + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..62ff96dfe97 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..3dc7480d32a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/1-TSESTree-Error.shot index bdb99cfb914..d390e8f8ba9 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-id-literal TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-id-literal TSESTree - Error 1`] = ` +"TSError +> 1 | namespace 'a' {} + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..354b7482759 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..be52f2461a2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/1-TSESTree-Error.shot index 3fbcf961cfa..c857310223a 100644 --- 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 @@ -1,3 +1,8 @@ // 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'.]`; +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-invalid-id TSESTree - Error 1`] = ` +"TSError +> 1 | namespace 1 {} + | ^ Namespace name cannot be '1'. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..1a3abc42ed7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4e9e941de86 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/1-TSESTree-Error.shot index 33a26d312ca..d01edfb1d18 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-no-body TSESTree - Error 1`] = ` +"TSError +> 1 | namespace F; + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..2c9165727c1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot index 620efabfacd..3741aeb7940 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot @@ -20,7 +20,9 @@ Program { global: true, id: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [8, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot index 5dc4161ad9a..9fcac3c8efd 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot @@ -24,7 +24,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration global AST Alignment - AST global: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [8, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot index d24ddaae90d..e712b655ec3 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot @@ -7,6 +7,7 @@ Program { TSModuleDeclaration { type: "TSModuleDeclaration", declare: true, + global: false, id: Literal { type: "Literal", raw: "'a'", diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot index 46729a48255..177d41ec23b 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot @@ -11,6 +11,7 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body AST TSModuleDeclaration { type: 'TSModuleDeclaration', declare: true, +- global: false, id: Literal { type: 'Literal', raw: '\\'a\\'', diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot index ac074fe5c98..125af1ea1c7 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot index 75dd7304dfa..3fc7f8b34f9 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-declare AST Alignme }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot index 7f00836de0d..4d0056f41a9 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 11, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot index 36a5fb1365f..433612e4520 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier AST A end: { column: 11, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot index 4017d7afc49..d0488ece67a 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,8 @@ Program { end: { column: 13, line: 1 }, }, }, + declare: false, + global: false, id: Literal { type: "Literal", raw: "'a'", diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot index 66e35bee13d..e28f27ef39a 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,8 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal AST Alig end: { column: 13, line: 1 }, }, }, +- declare: false, +- global: false, id: Literal { type: 'Literal', raw: '\\'a\\'', diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot index abf76fd1619..70ecf48cc22 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot @@ -20,9 +20,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [11, 12], loc: { @@ -38,9 +42,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [9, 10], loc: { @@ -56,9 +64,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot index 9c2311d4b6f..ade25ba03e2 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot @@ -24,9 +24,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name A end: { column: 15, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [11, 12], loc: { @@ -42,9 +46,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name A end: { column: 15, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [9, 10], loc: { @@ -60,9 +68,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name A end: { column: 15, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..26936650860 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-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/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot index 49ee11415db..5d292ad1879 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..374070330ed --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-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 index 48f1c28a6f6..9e710ee89f4 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare AST Alig }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..2e47480e044 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-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/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot index 86b030f02fd..5b2c8774fa9 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 14, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..1fb07e00228 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-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 index 1d16afdfbbb..eeadb154ca4 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier AS end: { column: 14, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot index ec61e55c1a6..b7deac52f60 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot @@ -6,64 +6,70 @@ Program { body: [ TSModuleDeclaration { type: "TSModuleDeclaration", - body: TSModuleDeclaration { - type: "TSModuleDeclaration", - body: TSModuleDeclaration { - type: "TSModuleDeclaration", - body: TSModuleBlock { - type: "TSModuleBlock", - body: [], + body: TSModuleBlock { + type: "TSModuleBlock", + body: [], - range: [16, 18], + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + declare: false, + global: false, + id: TSQualifiedName { + type: "TSQualifiedName", + left: TSQualifiedName { + type: "TSQualifiedName", + left: Identifier { + type: "Identifier", + decorators: [], + name: "A", + optional: false, + + range: [10, 11], loc: { - start: { column: 16, line: 1 }, - end: { column: 18, line: 1 }, + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, }, }, - id: Identifier { + right: Identifier { type: "Identifier", - name: "C", + decorators: [], + name: "B", + optional: false, - range: [14, 15], + range: [12, 13], loc: { - start: { column: 14, line: 1 }, - end: { column: 15, line: 1 }, + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, }, }, - kind: "namespace", - range: [14, 18], + range: [10, 13], loc: { - start: { column: 14, line: 1 }, - end: { column: 18, line: 1 }, + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, }, }, - id: Identifier { + right: Identifier { type: "Identifier", - name: "B", + decorators: [], + name: "C", + optional: false, - range: [12, 13], + range: [14, 15], loc: { - start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, }, }, - kind: "namespace", - - range: [12, 18], - loc: { - start: { column: 12, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "A", - range: [10, 11], + range: [10, 15], loc: { start: { column: 10, line: 1 }, - end: { column: 11, line: 1 }, + end: { column: 15, line: 1 }, }, }, kind: "namespace", diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot index 5a99e367a51..b3800ab8096 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot @@ -10,64 +10,105 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-nam body: Array [ TSModuleDeclaration { type: 'TSModuleDeclaration', - body: TSModuleDeclaration { - type: 'TSModuleDeclaration', - body: TSModuleDeclaration { - type: 'TSModuleDeclaration', - body: TSModuleBlock { - type: 'TSModuleBlock', - body: Array [], +- body: TSModuleBlock { +- type: 'TSModuleBlock', +- body: Array [], +- +- range: [16, 18], +- loc: { +- start: { column: 16, line: 1 }, +- end: { column: 18, line: 1 }, +- }, +- }, +- declare: false, +- global: false, +- id: TSQualifiedName { +- type: 'TSQualifiedName', +- left: TSQualifiedName { +- type: 'TSQualifiedName', +- left: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'A', +- optional: false, ++ body: TSModuleDeclaration { ++ type: 'TSModuleDeclaration', ++ body: TSModuleDeclaration { ++ type: 'TSModuleDeclaration', ++ body: TSModuleBlock { ++ type: 'TSModuleBlock', ++ body: Array [], - range: [16, 18], +- range: [10, 11], ++ range: [16, 18], loc: { - start: { column: 16, line: 1 }, - end: { column: 18, line: 1 }, +- start: { column: 10, line: 1 }, +- end: { column: 11, line: 1 }, ++ start: { column: 16, line: 1 }, ++ end: { column: 18, line: 1 }, }, }, - id: Identifier { +- right: Identifier { ++ id: Identifier { type: 'Identifier', - name: 'C', +- decorators: Array [], +- name: 'B', +- optional: false, ++ name: 'C', - range: [14, 15], +- range: [12, 13], ++ range: [14, 15], loc: { - start: { column: 14, line: 1 }, - end: { column: 15, line: 1 }, +- start: { column: 12, line: 1 }, +- end: { column: 13, line: 1 }, ++ start: { column: 14, line: 1 }, ++ end: { column: 15, line: 1 }, }, }, -- kind: 'namespace', - range: [14, 18], +- range: [10, 13], ++ range: [14, 18], loc: { - start: { column: 14, line: 1 }, - end: { column: 18, line: 1 }, +- start: { column: 10, line: 1 }, +- end: { column: 13, line: 1 }, ++ start: { column: 14, line: 1 }, ++ end: { column: 18, line: 1 }, }, }, - id: Identifier { +- right: Identifier { ++ id: Identifier { type: 'Identifier', - name: 'B', +- decorators: Array [], +- name: 'C', +- optional: false, ++ name: 'B', - range: [12, 13], +- range: [14, 15], ++ range: [12, 13], loc: { - start: { column: 12, line: 1 }, - end: { column: 13, line: 1 }, +- start: { column: 14, line: 1 }, +- end: { column: 15, line: 1 }, ++ start: { column: 12, line: 1 }, ++ end: { column: 13, line: 1 }, }, }, -- kind: 'namespace', - range: [12, 18], - loc: { - start: { column: 12, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - id: Identifier { - type: 'Identifier', - name: 'A', - - range: [10, 11], +- range: [10, 15], ++ 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 }, +- end: { column: 15, line: 1 }, ++ end: { column: 11, line: 1 }, }, }, - kind: 'namespace', diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/fixture.ts new file mode 100644 index 00000000000..e4db463ec8f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/fixture.ts @@ -0,0 +1 @@ +namespace abd.def {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..ad7361c18b2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: false, + global: false, + id: TSQualifiedName { + type: "TSQualifiedName", + left: Identifier { + type: "Identifier", + decorators: [], + name: "abd", + optional: false, + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + decorators: [], + name: "def", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + kind: "namespace", + + 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/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..bb31b17d363 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "abd", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "def", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..f778aa86d3a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/3-Babel-AST.shot @@ -0,0 +1,64 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "def", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "abd", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, 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/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..8f26fcfe867 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "abd", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "def", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..47d7105c32d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSModuleDeclaration { + type: 'TSModuleDeclaration', +- body: TSModuleBlock { +- type: 'TSModuleBlock', +- body: Array [], +- +- range: [18, 20], +- loc: { +- start: { column: 18, line: 1 }, +- end: { column: 20, line: 1 }, +- }, +- }, +- declare: false, +- global: false, +- id: TSQualifiedName { +- type: 'TSQualifiedName', +- left: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'abd', +- optional: false, ++ body: TSModuleDeclaration { ++ type: 'TSModuleDeclaration', ++ body: TSModuleBlock { ++ type: 'TSModuleBlock', ++ body: Array [], + +- range: [10, 13], ++ range: [18, 20], + loc: { +- start: { column: 10, line: 1 }, +- end: { column: 13, line: 1 }, ++ start: { column: 18, line: 1 }, ++ end: { column: 20, line: 1 }, + }, + }, +- right: Identifier { ++ id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'def', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + +- range: [10, 17], ++ range: [14, 20], ++ loc: { ++ start: { column: 14, line: 1 }, ++ end: { column: 20, line: 1 }, ++ }, ++ }, ++ id: Identifier { ++ type: 'Identifier', ++ name: 'abd', ++ ++ range: [10, 13], + loc: { + start: { column: 10, line: 1 }, +- end: { column: 17, line: 1 }, ++ end: { column: 13, line: 1 }, + }, + }, +- kind: 'namespace', + + 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/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/6-AST-Alignment-Tokens.shot similarity index 50% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/6-AST-Alignment-Tokens.shot index fd832b249e4..657e47e2dc1 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/fixture.ts new file mode 100644 index 00000000000..aa16edb5ae5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/fixture.ts @@ -0,0 +1 @@ +namespace abc.def.ghi {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..8626f6f94c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + declare: false, + global: false, + id: TSQualifiedName { + type: "TSQualifiedName", + left: TSQualifiedName { + type: "TSQualifiedName", + left: Identifier { + type: "Identifier", + decorators: [], + name: "abc", + optional: false, + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + decorators: [], + name: "def", + optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + decorators: [], + name: "ghi", + optional: false, + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [10, 21], + loc: { + start: { column: 10, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + kind: "namespace", + + 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/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..5591f2e7a89 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice TSESTree - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "abc", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "def", + + range: [14, 17], + loc: { + start: { column: 14, 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: "ghi", + + range: [18, 21], + loc: { + start: { column: 18, 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/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..088cae325e5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "ghi", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "def", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 24], + loc: { + start: { column: 14, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "abc", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, 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/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..be52f742f11 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice Babel - Tokens 1`] = ` +[ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "abc", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "def", + + range: [14, 17], + loc: { + start: { column: 14, 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: "ghi", + + range: [18, 21], + loc: { + start: { column: 18, 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/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..c2b715d7443 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,131 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSModuleDeclaration { + type: 'TSModuleDeclaration', +- body: TSModuleBlock { +- type: 'TSModuleBlock', +- body: Array [], +- +- range: [22, 24], +- loc: { +- start: { column: 22, line: 1 }, +- end: { column: 24, line: 1 }, +- }, +- }, +- declare: false, +- global: false, +- id: TSQualifiedName { +- type: 'TSQualifiedName', +- left: TSQualifiedName { +- type: 'TSQualifiedName', +- left: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'abc', +- optional: false, ++ body: TSModuleDeclaration { ++ type: 'TSModuleDeclaration', ++ body: TSModuleDeclaration { ++ type: 'TSModuleDeclaration', ++ body: TSModuleBlock { ++ type: 'TSModuleBlock', ++ body: Array [], + +- range: [10, 13], ++ range: [22, 24], + loc: { +- start: { column: 10, line: 1 }, +- end: { column: 13, line: 1 }, ++ start: { column: 22, line: 1 }, ++ end: { column: 24, line: 1 }, + }, + }, +- right: Identifier { ++ id: Identifier { + type: 'Identifier', +- decorators: Array [], +- name: 'def', +- optional: false, ++ name: 'ghi', + +- range: [14, 17], ++ range: [18, 21], + loc: { +- start: { column: 14, line: 1 }, +- end: { column: 17, line: 1 }, ++ start: { column: 18, line: 1 }, ++ end: { column: 21, line: 1 }, + }, + }, + +- range: [10, 17], ++ range: [18, 24], + loc: { +- start: { column: 10, line: 1 }, +- end: { column: 17, line: 1 }, ++ start: { column: 18, line: 1 }, ++ end: { column: 24, line: 1 }, + }, + }, +- right: Identifier { ++ id: Identifier { + type: 'Identifier', +- decorators: Array [], +- name: 'ghi', +- optional: false, ++ name: 'def', + +- range: [18, 21], ++ range: [14, 17], + loc: { +- start: { column: 18, line: 1 }, +- end: { column: 21, line: 1 }, ++ start: { column: 14, line: 1 }, ++ end: { column: 17, line: 1 }, + }, + }, + +- range: [10, 21], ++ range: [14, 24], ++ loc: { ++ start: { column: 14, line: 1 }, ++ end: { column: 24, line: 1 }, ++ }, ++ }, ++ id: Identifier { ++ type: 'Identifier', ++ name: 'abc', ++ ++ range: [10, 13], + loc: { + start: { column: 10, line: 1 }, +- end: { column: 21, line: 1 }, ++ end: { column: 13, line: 1 }, + }, + }, +- kind: 'namespace', + + 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/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..f0ac1cd2c04 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice 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 3afa8aee8c6..97319591f9e 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts @@ -3,21 +3,11 @@ import type { BaseNode } from '../../base/BaseNode'; import type { Identifier } from '../../expression/Identifier/spec'; import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; import type { TSModuleBlock } from '../../special/TSModuleBlock/spec'; -import type { Modifier } from '../../unions/Modifier'; +import type { TSQualifiedName } from '../../type/spec'; +import type { Literal } from '../../unions/Literal'; export type TSModuleDeclarationKind = 'global' | 'module' | 'namespace'; -/* -TODO(#4966) - we currently emit this due to bad parser handling of nested modules -namespace Foo.Bar {} -^^^^^^^^^^^^^^^^^^^^ TSModuleDeclaration - ^^^^^^ TSModuleDeclaration - ^^ TSModuleBlock - -This should instead emit a TSQualifiedName for the `id` and not emit an inner TSModuleDeclaration -*/ -type ModuleBody_TODOFixThis = TSModuleBlock | TSModuleDeclaration; - interface TSModuleDeclarationBase extends BaseNode { type: AST_NODE_TYPES.TSModuleDeclaration; /** @@ -28,13 +18,13 @@ interface TSModuleDeclarationBase extends BaseNode { * module 'a' {} * ``` */ - id: Identifier | StringLiteral; + id: Identifier | Literal | TSQualifiedName; /** * 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?: ModuleBody_TODOFixThis; + body?: TSModuleBlock; /** * Whether this is a global declaration * ``` @@ -42,17 +32,14 @@ interface TSModuleDeclarationBase extends BaseNode { * ``` */ // TODO - remove this in the next major (we have `.kind` now) - global?: boolean; + global: boolean; /** * Whether the module is `declare`d * ``` * declare namespace F {} * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; - // TODO(#4759) - breaking change remove this - modifiers?: Modifier[]; + declare: boolean; /** * The keyword used to define this module declaration @@ -73,12 +60,9 @@ interface TSModuleDeclarationBase extends BaseNode { export interface TSModuleDeclarationNamespace extends TSModuleDeclarationBase { kind: 'namespace'; // namespaces cannot have literal IDs - id: Identifier; + id: Identifier | TSQualifiedName; // namespaces must always have a body - body: ModuleBody_TODOFixThis; - - // TODO - remove this in the next major (we have `.kind` now) - global?: undefined; + body: TSModuleBlock; } export interface TSModuleDeclarationGlobal extends TSModuleDeclarationBase { @@ -88,18 +72,10 @@ export interface TSModuleDeclarationGlobal extends TSModuleDeclarationBase { body: TSModuleBlock; // this will always be an Identifier with name `global` id: Identifier; - - // note - it's not syntactically required to have `declare`, but it semantically required - - // TODO - remove this in the next major (we have `.kind` now) - global: true; } interface TSModuleDeclarationModuleBase extends TSModuleDeclarationBase { kind: 'module'; - - // TODO - remove this in the next major (we have `.kind` now) - global?: undefined; } export type TSModuleDeclarationModule = @@ -129,7 +105,7 @@ export interface TSModuleDeclarationModuleWithIdentifierId kind: 'module'; id: Identifier; // modules with an Identifier must always have a body - body: ModuleBody_TODOFixThis; + body: TSModuleBlock; } export type TSModuleDeclaration = diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..300850581d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot index e47c9aa7c25..904fa17bbda 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ missing-id TSESTree - Error 1`] = ` +"TSError +> 1 | export as namespace; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0b5d774603f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f2641cc64de --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 3e11b470029..54f1d45efe4 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; +exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | export as namespace 1; + | ^ Identifier expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..defe8a17bba --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot index 8fd4754eac4..766421336b4 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSNamespaceExportDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [20, 21], loc: { diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot index 6cd11e1f4b3..21c15688f30 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,40 @@ exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSNamespaceExportDeclaration { + type: 'TSNamespaceExportDeclaration', + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/fixture.ts new file mode 100644 index 00000000000..8c24b75c66c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/fixture.ts @@ -0,0 +1 @@ +@decl type Test = {}; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..635e4f5a1cf --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..1392b9b0742 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ decorator TSESTree - Error 1`] = ` +"TSError +> 1 | @decl type Test = {}; + | ^^^^^ Decorators are not valid here. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..43ad98f601b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ decorator Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..635e4f5a1cf --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..f99acadf19a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ decorator Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b18ec532458 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-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/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..99587163b89 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f7c419205f7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot index 7eaf3f0bba4..dc83090da35 100644 --- 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 @@ -1,3 +1,8 @@ // 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'.]`; +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ non-identifier-name TSESTree - Error 1`] = ` +"TSError +> 1 | type 1 = 2; + | ^ Type alias name cannot be '1'. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7ccef6da61f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..bb7b44f3afe --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/1-TSESTree-Error.shot index b11bc95c96d..eb6164b79a2 100644 --- 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 @@ -1,3 +1,8 @@ // 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.]`; +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ non-identifier-type-parameter TSESTree - Error 1`] = ` +"TSError +> 1 | type T<1> = 2; + | ^ Type parameter declaration expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..ad412071cc1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-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/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 9c87ddf606f..636050c43af 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { declare: true, id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 890509a8dcb..253e63408e6 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index 34001d72f46..42782e8b3a3 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [5, 6], loc: { @@ -45,7 +48,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index 939521199a6..9bfe5c01694 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many AST Ali body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [5, 6], loc: { @@ -49,7 +52,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [7, 8], - loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index afaff66bb43..1dbed91e698 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [5, 6], loc: { @@ -45,7 +48,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [7, 8], loc: { @@ -67,7 +72,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "V", + optional: false, range: [10, 11], loc: { @@ -89,7 +96,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "W", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index 9ea3fc2ca74..b6e1bc8938a 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [5, 6], loc: { @@ -49,7 +52,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [7, 8], - loc: { @@ -72,7 +77,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [10, 11], - loc: { @@ -95,7 +102,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'W', +- optional: false, - - range: [13, 14], - loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot index 9e3c3e98eeb..5d3c83b6631 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [5, 6], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot index 9cc16a451ec..fe331054c0f 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration valid AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts index 15ab0a40c13..6d7232344b2 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts @@ -12,8 +12,7 @@ export interface TSTypeAliasDeclaration extends BaseNode { * declare type T = 1; * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The name of the type. */ @@ -24,7 +23,6 @@ export interface TSTypeAliasDeclaration extends BaseNode { typeAnnotation: TypeNode; /** * The generic type parameters declared for the type. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/fixture.ts new file mode 100644 index 00000000000..8c24b75c66c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/fixture.ts @@ -0,0 +1 @@ +@decl type Test = {}; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6dbe967b047 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..fb0803d0ca0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ decorator TSESTree - Error 1`] = ` +"TSError +> 1 | @decl type Test = {}; + | ^^^^^ Decorators are not valid here. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..27f74be3902 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ decorator Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..6dbe967b047 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ decorator Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..2076158e5e7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/decorator/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ decorator Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..5e6f7bc3288 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-TSESTree-Error.shot index 3f61a7ec4bd..a644ecb1372 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-with-value TSESTree - Error 1`] = `[TSError: Variable declaration expected.]`; +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-with-value TSESTree - Error 1`] = ` +"TSError +> 1 | const = 1; + | ^ Variable declaration expected. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..830f2f4e93c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-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/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..7a42d0e079b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-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/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot index 6537d529262..dedcabc0bbf 100644 --- 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 @@ -1,3 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value TSESTree - Error 1`] = ` +"TSError +> 1 | const; + | ^^^^^^ A variable declaration list must have at least one variable declarator. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..cd2401b6862 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-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/_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 index cd2401b6862..89f5785e4c7 100644 --- 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 @@ -1,3 +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"`; +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/fixture.ts new file mode 100644 index 00000000000..c53e6c27952 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/fixture.ts @@ -0,0 +1 @@ +const; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..18d3755b6a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ no-variables Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..318ceeec614 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ no-variables TSESTree - Error 1`] = ` +"TSError +> 1 | const; + | ^^^^^^ A variable declaration list must have at least one variable declarator. + 2 |" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..5ce744c9338 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ no-variables Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..18d3755b6a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ no-variables Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..8ff6adabf68 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/no-variables/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ no-variables Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot index c59f8219bb5..0bf57620c6e 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [6, 7], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [0, 12], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot index 65c9ece0d43..d997027ffab 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot index f8e86b5f8ba..0c7705ede31 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [6, 7], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [0, 12], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot index 56007597c38..077480be9fd 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 8ea6a51268d..a60c9f86f53 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 005dc078e1d..87e680ef9a2 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: true, + kind: 'let', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot index 227feb50980..9795f20c91c 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [4, 5], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [0, 10], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot index 2697799a415..b275669e12a 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot index d8d3f10c6e7..0374c31feb5 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [4, 5], loc: { @@ -28,6 +31,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [0, 6], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot index 8082a31f808..7df64b552f6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot index 7b317b58121..569b7e4d6b3 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [4, 5], loc: { @@ -29,9 +32,12 @@ Program { }, VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, range: [7, 8], loc: { @@ -49,9 +55,12 @@ Program { }, VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "z", + optional: false, range: [10, 11], loc: { @@ -68,6 +77,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [0, 12], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot index 10b9167907c..f7e6ff872f0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,101 @@ exports[`AST Fixtures declaration VariableDeclaration multiple-declarations AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + init: null, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'z', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: null, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot index dd577b588de..a0dc5de12b9 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [4, 5], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [0, 10], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot index b107c9499d4..f9ec50b22b4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot index 384ae11b364..9c8cd46cb97 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [4, 5], loc: { @@ -28,6 +31,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [0, 6], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot index b8594239a06..af47a7b5819 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts index 4bc9b0f4854..70ed40f52e6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -20,8 +20,7 @@ export interface VariableDeclaration extends BaseNode { * declare const x = 1; * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The keyword used to declare the variable(s) * ``` diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts similarity index 100% rename from packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts rename to packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f314b35255b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..77e891766df --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value TSESTree - Error 1`] = ` +"TSError + 1 | abstract class Foo { +> 2 | abstract accessor foo: number = 1; + | ^ Abstract property cannot have an initializer. + 3 | } + 4 |" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..4e826d92c94 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value Error Alignment 1`] = `"No errors"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..f314b35255b --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..f248419e4f7 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-accessor-with-value Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts new file mode 100644 index 00000000000..de0095c3531 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/fixture.ts @@ -0,0 +1,3 @@ +abstract class Foo { + abstract property = 1; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..24fbc900989 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value Babel - Error 1`] = `[SyntaxError: Property 'property' cannot have an initializer because it is marked abstract. (2:20)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..8fc5278de62 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value TSESTree - Error 1`] = ` +"TSError + 1 | abstract class Foo { +> 2 | abstract property = 1; + | ^ Abstract property cannot have an initializer. + 3 | } + 4 |" +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7e77cd5d46e --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..24fbc900989 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value Babel - Error 1`] = `[SyntaxError: Property 'property' cannot have an initializer because it is marked abstract. (2:20)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..137837e3e8f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-abstract-property-with-value/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-abstract-property-with-value Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..071d521919f --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Babel - Error 1`] = `[SyntaxError: This member cannot have an 'override' modifier because its containing class does not extend another class. (2:2)]`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..27d6eef74b0 --- /dev/null +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures element AccessorProperty _error_ modifier-override-with-no-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts index 5dc28758b4e..673c8d7991f 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/fixture.ts @@ -1,3 +1,3 @@ class Foo { - accessor 1 = 2; + accessor [1 + 1] = 2; } diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot index 8545a8f1b73..2ecff14d0fc 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot @@ -6,55 +6,85 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ AccessorProperty { type: "AccessorProperty", - computed: false, + computed: true, declare: false, - key: Literal { - type: "Literal", - raw: "1", - value: 1, + decorators: [], + definite: false, + key: BinaryExpression { + type: "BinaryExpression", + left: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + operator: "+", + right: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, - range: [23, 24], + range: [24, 29], loc: { - start: { column: 11, line: 2 }, - end: { column: 12, line: 2 }, + start: { column: 12, line: 2 }, + end: { column: 17, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", raw: "2", value: 2, - range: [27, 28], + range: [33, 34], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 21, line: 2 }, + end: { column: 22, line: 2 }, }, }, - range: [14, 29], + range: [14, 35], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, }, }, ], - range: [10, 31], + range: [10, 37], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,9 +92,10 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, - range: [0, 31], + range: [0, 37], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -73,7 +104,7 @@ Program { ], sourceType: "script", - range: [0, 32], + range: [0, 38], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot index 897c1151ab2..a208741af8b 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/2-TSESTree-Tokens.shot @@ -42,9 +42,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - T end: { column: 10, line: 2 }, }, }, - Numeric { - type: "Numeric", - value: "1", + Punctuator { + type: "Punctuator", + value: "[", range: [23, 24], loc: { @@ -52,41 +52,81 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex TSESTree - T end: { column: 12, line: 2 }, }, }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "+", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "=", - range: [25, 26], + range: [31, 32], loc: { - start: { column: 13, line: 2 }, - end: { column: 14, line: 2 }, + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, }, }, Numeric { type: "Numeric", value: "2", - range: [27, 28], + range: [33, 34], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 21, line: 2 }, + end: { column: 22, line: 2 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [28, 29], + range: [34, 35], loc: { - start: { column: 16, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [30, 31], + range: [36, 37], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot index d26beba1271..63474559676 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/3-Babel-AST.shot @@ -11,16 +11,37 @@ Program { body: [ ClassAccessorProperty { type: "ClassAccessorProperty", - computed: false, - key: Literal { - type: "Literal", - raw: "1", - value: 1, + computed: true, + key: BinaryExpression { + type: "BinaryExpression", + left: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + operator: "+", + right: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, - range: [23, 24], + range: [24, 29], loc: { - start: { column: 11, line: 2 }, - end: { column: 12, line: 2 }, + start: { column: 12, line: 2 }, + end: { column: 17, line: 2 }, }, }, static: false, @@ -29,22 +50,22 @@ Program { raw: "2", value: 2, - range: [27, 28], + range: [33, 34], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 21, line: 2 }, + end: { column: 22, line: 2 }, }, }, - range: [14, 29], + range: [14, 35], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, }, }, ], - range: [10, 31], + range: [10, 37], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +83,7 @@ Program { }, superClass: null, - range: [0, 31], + range: [0, 37], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +92,7 @@ Program { ], sourceType: "script", - range: [0, 32], + range: [0, 38], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot index 4a6b377b092..97f643020bd 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/4-Babel-Tokens.shot @@ -42,9 +42,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - Toke end: { column: 10, line: 2 }, }, }, - Numeric { - type: "Numeric", - value: "1", + Punctuator { + type: "Punctuator", + value: "[", range: [23, 24], loc: { @@ -52,41 +52,81 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex Babel - Toke end: { column: 12, line: 2 }, }, }, + Numeric { + type: "Numeric", + value: "1", + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "+", + + range: [26, 27], + loc: { + start: { column: 14, line: 2 }, + end: { column: 15, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [29, 30], + loc: { + start: { column: 17, line: 2 }, + end: { column: 18, line: 2 }, + }, + }, Punctuator { type: "Punctuator", value: "=", - range: [25, 26], + range: [31, 32], loc: { - start: { column: 13, line: 2 }, - end: { column: 14, line: 2 }, + start: { column: 19, line: 2 }, + end: { column: 20, line: 2 }, }, }, Numeric { type: "Numeric", value: "2", - range: [27, 28], + range: [33, 34], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 21, line: 2 }, + end: { column: 22, line: 2 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [28, 29], + range: [34, 35], loc: { - start: { column: 16, line: 2 }, - end: { column: 17, line: 2 }, + start: { column: 22, line: 2 }, + end: { column: 23, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [30, 31], + range: [36, 37], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot index b6b30dd18c6..32c9bea08d3 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,50 +18,79 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen - type: 'AccessorProperty', + ClassAccessorProperty { + type: 'ClassAccessorProperty', - computed: false, + computed: true, - declare: false, - key: Literal { - type: 'Literal', - raw: '1', - value: 1, +- decorators: Array [], +- definite: false, + key: BinaryExpression { + type: 'BinaryExpression', + left: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [24, 25], + loc: { + start: { column: 12, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + operator: '+', + right: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, - range: [23, 24], + range: [24, 29], loc: { - start: { column: 11, line: 2 }, - end: { column: 12, line: 2 }, + start: { column: 12, line: 2 }, + end: { column: 17, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', raw: '2', value: 2, - range: [27, 28], + range: [33, 34], loc: { - start: { column: 15, line: 2 }, - end: { column: 16, line: 2 }, + start: { column: 21, line: 2 }, + end: { column: 22, line: 2 }, }, }, - range: [14, 29], + range: [14, 35], loc: { start: { column: 2, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 23, line: 2 }, }, }, ], - range: [10, 31], + range: [10, 37], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,9 +98,10 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, - range: [0, 31], + range: [0, 37], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -79,7 +110,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen ], sourceType: 'script', - range: [0, 32], + range: [0, 38], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot index 2b3269d8cd0..903c3ee2140 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "1", @@ -24,7 +27,9 @@ Program { end: { column: 13, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +57,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +71,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 33], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot index bd3b115af80..f4e4e3be0f2 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment + type: 'ClassAccessorProperty', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '1', @@ -30,7 +33,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment end: { column: 13, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +63,13 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +77,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 33], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot index b19f7768a48..1ea0bf7cc10 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "'prop'", @@ -24,7 +27,9 @@ Program { end: { column: 18, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +57,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +71,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 44], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot index 0cbe6bb62c4..580ab471f03 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment + type: 'ClassAccessorProperty', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\'prop\\'', @@ -30,7 +33,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment end: { column: 18, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +63,13 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +77,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 44], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts index e69de29bb2d..5dc28758b4e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + accessor 1 = 2; +} diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot index c1024f11503..0d55a562b17 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot @@ -3,13 +3,90 @@ exports[`AST Fixtures element AccessorProperty key-number TSESTree - AST 1`] = ` Program { type: "Program", - body: [], + body: [ + ClassDeclaration { + type: "ClassDeclaration", + abstract: false, + body: ClassBody { + type: "ClassBody", + body: [ + AccessorProperty { + type: "AccessorProperty", + computed: false, + declare: false, + decorators: [], + definite: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + optional: false, + override: false, + readonly: false, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + declare: false, + decorators: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "Foo", + optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: [], + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], sourceType: "script", - range: [0, 0], + range: [0, 32], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, }, } `; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot index ec11bb8381d..b4eb3d8a715 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/2-TSESTree-Tokens.shot @@ -1,3 +1,96 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty key-number TSESTree - Tokens 1`] = `[]`; +exports[`AST Fixtures element AccessorProperty key-number TSESTree - Tokens 1`] = ` +[ + 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: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot index 96f034cf05c..a0583eeb7cf 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/3-Babel-AST.shot @@ -3,13 +3,78 @@ exports[`AST Fixtures element AccessorProperty key-number Babel - AST 1`] = ` Program { type: "Program", - body: [], + body: [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: [ + ClassAccessorProperty { + type: "ClassAccessorProperty", + computed: false, + key: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + static: false, + value: Literal { + type: "Literal", + raw: "2", + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + 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, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], sourceType: "script", - range: [0, 0], + range: [0, 32], loc: { start: { column: 0, line: 1 }, - end: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, }, } `; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot index 0a1c0c86992..599d99fb007 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/4-Babel-Tokens.shot @@ -1,3 +1,96 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures element AccessorProperty key-number Babel - Tokens 1`] = `[]`; +exports[`AST Fixtures element AccessorProperty key-number Babel - Tokens 1`] = ` +[ + 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: "accessor", + + range: [14, 22], + loc: { + start: { column: 2, line: 2 }, + end: { column: 10, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [25, 26], + loc: { + start: { column: 13, line: 2 }, + end: { column: 14, line: 2 }, + }, + }, + Numeric { + type: "Numeric", + value: "2", + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [28, 29], + loc: { + start: { column: 16, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot index 55fd7a3d475..632c9be206b 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [ +- AccessorProperty { +- type: 'AccessorProperty', ++ ClassAccessorProperty { ++ type: 'ClassAccessorProperty', + computed: false, +- declare: false, +- decorators: Array [], +- definite: false, + key: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [23, 24], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +- optional: false, +- override: false, +- readonly: false, + static: false, + value: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [27, 28], + loc: { + start: { column: 15, line: 2 }, + end: { column: 16, line: 2 }, + }, + }, + + range: [14, 29], + loc: { + start: { column: 2, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + ], + + range: [10, 31], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot index 26abb22016e..d3096826ba0 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "foo", @@ -23,7 +26,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +56,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,6 +70,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 34], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot index 100c519c06c..78ff86db859 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'foo', @@ -29,7 +32,9 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -57,9 +62,13 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,6 +76,7 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 34], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts index 808470d5b6a..1a96d899ee8 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/fixture.ts @@ -1,3 +1,3 @@ class Foo { - accessor 'prop' = 'value'; + accessor 'quoted-prop' = 'value'; } diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot index 0cc093d094f..8534f85e05c 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,48 +14,56 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", - raw: "'prop'", - value: "prop", + raw: "'quoted-prop'", + value: "quoted-prop", - range: [23, 29], + range: [23, 36], loc: { start: { column: 11, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 24, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", raw: "'value'", value: "value", - range: [32, 39], + range: [39, 46], loc: { - start: { column: 20, line: 2 }, - end: { column: 27, line: 2 }, + start: { column: 27, line: 2 }, + end: { column: 34, line: 2 }, }, }, - range: [14, 40], + range: [14, 47], loc: { start: { column: 2, line: 2 }, - end: { column: 28, line: 2 }, + end: { column: 35, line: 2 }, }, }, ], - range: [10, 42], + range: [10, 49], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,9 +71,10 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, - range: [0, 42], + range: [0, 49], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -73,7 +83,7 @@ Program { ], sourceType: "script", - range: [0, 43], + range: [0, 50], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot index 2afc4cac40a..9b9176fa61e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/2-TSESTree-Tokens.shot @@ -44,49 +44,49 @@ exports[`AST Fixtures element AccessorProperty key-string TSESTree - Tokens 1`] }, String { type: "String", - value: "'prop'", + value: "'quoted-prop'", - range: [23, 29], + range: [23, 36], loc: { start: { column: 11, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 24, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "=", - range: [30, 31], + range: [37, 38], loc: { - start: { column: 18, line: 2 }, - end: { column: 19, line: 2 }, + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, }, }, String { type: "String", value: "'value'", - range: [32, 39], + range: [39, 46], loc: { - start: { column: 20, line: 2 }, - end: { column: 27, line: 2 }, + start: { column: 27, line: 2 }, + end: { column: 34, line: 2 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [39, 40], + range: [46, 47], loc: { - start: { column: 27, line: 2 }, - end: { column: 28, line: 2 }, + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [41, 42], + range: [48, 49], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot index 1d213162cd9..1f5f801f0a0 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/3-Babel-AST.shot @@ -14,13 +14,13 @@ Program { computed: false, key: Literal { type: "Literal", - raw: "'prop'", - value: "prop", + raw: "'quoted-prop'", + value: "quoted-prop", - range: [23, 29], + range: [23, 36], loc: { start: { column: 11, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 24, line: 2 }, }, }, static: false, @@ -29,22 +29,22 @@ Program { raw: "'value'", value: "value", - range: [32, 39], + range: [39, 46], loc: { - start: { column: 20, line: 2 }, - end: { column: 27, line: 2 }, + start: { column: 27, line: 2 }, + end: { column: 34, line: 2 }, }, }, - range: [14, 40], + range: [14, 47], loc: { start: { column: 2, line: 2 }, - end: { column: 28, line: 2 }, + end: { column: 35, line: 2 }, }, }, ], - range: [10, 42], + range: [10, 49], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, @@ -62,7 +62,7 @@ Program { }, superClass: null, - range: [0, 42], + range: [0, 49], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -71,7 +71,7 @@ Program { ], sourceType: "script", - range: [0, 43], + range: [0, 50], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot index b3c3aa19fab..4f18e3e3172 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/4-Babel-Tokens.shot @@ -44,49 +44,49 @@ exports[`AST Fixtures element AccessorProperty key-string Babel - Tokens 1`] = ` }, String { type: "String", - value: "'prop'", + value: "'quoted-prop'", - range: [23, 29], + range: [23, 36], loc: { start: { column: 11, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 24, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "=", - range: [30, 31], + range: [37, 38], loc: { - start: { column: 18, line: 2 }, - end: { column: 19, line: 2 }, + start: { column: 25, line: 2 }, + end: { column: 26, line: 2 }, }, }, String { type: "String", value: "'value'", - range: [32, 39], + range: [39, 46], loc: { - start: { column: 20, line: 2 }, - end: { column: 27, line: 2 }, + start: { column: 27, line: 2 }, + end: { column: 34, line: 2 }, }, }, Punctuator { type: "Punctuator", value: ";", - range: [39, 40], + range: [46, 47], loc: { - start: { column: 27, line: 2 }, - end: { column: 28, line: 2 }, + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [41, 42], + range: [48, 49], loc: { start: { column: 0, line: 3 }, end: { column: 1, line: 3 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot index 79f2d5ffd63..fa04c5159f0 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,48 +20,56 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', - raw: '\\'prop\\'', - value: 'prop', + raw: '\\'quoted-prop\\'', + value: 'quoted-prop', - range: [23, 29], + range: [23, 36], loc: { start: { column: 11, line: 2 }, - end: { column: 17, line: 2 }, + end: { column: 24, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', raw: '\\'value\\'', value: 'value', - range: [32, 39], + range: [39, 46], loc: { - start: { column: 20, line: 2 }, - end: { column: 27, line: 2 }, + start: { column: 27, line: 2 }, + end: { column: 34, line: 2 }, }, }, - range: [14, 40], + range: [14, 47], loc: { start: { column: 2, line: 2 }, - end: { column: 28, line: 2 }, + end: { column: 35, line: 2 }, }, }, ], - range: [10, 42], + range: [10, 49], loc: { start: { column: 10, line: 1 }, end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,9 +77,10 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, - range: [0, 42], + range: [0, 49], loc: { start: { column: 0, line: 1 }, end: { column: 1, line: 3 }, @@ -79,7 +89,7 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` ], sourceType: 'script', - range: [0, 43], + range: [0, 50], loc: { start: { column: 0, line: 1 }, end: { column: 0, line: 4 }, diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 75bdc0edd24..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,90 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - AST 1`] = ` -Program { - type: "Program", - body: [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: [ - TSAbstractAccessorProperty { - type: "TSAbstractAccessorProperty", - computed: false, - declare: false, - key: Identifier { - type: "Identifier", - name: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - override: false, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: null, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index 52b20d04368..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value TSESTree - Tokens 1`] = ` -[ - Identifier { - type: "Identifier", - value: "abstract", - - range: [0, 8], - loc: { - start: { column: 0, line: 1 }, - end: { column: 8, line: 1 }, - }, - }, - Keyword { - type: "Keyword", - value: "class", - - range: [9, 14], - loc: { - start: { column: 9, line: 1 }, - end: { column: 14, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [19, 20], - loc: { - start: { column: 19, line: 1 }, - end: { column: 20, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ":", - - range: [44, 45], - loc: { - start: { column: 23, line: 2 }, - end: { column: 24, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-AST.shot deleted file mode 100644 index 94c61988d3b..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - AST 1`] = ` -Program { - type: "Program", - body: [ - ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: [ - ClassAccessorProperty { - type: "ClassAccessorProperty", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - static: false, - typeAnnotation: TSTypeAnnotation { - type: "TSTypeAnnotation", - typeAnnotation: TSNumberKeyword { - type: "TSNumberKeyword", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - value: Literal { - type: "Literal", - raw: "1", - value: 1, - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: "script", - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, -} -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index ee7c1781984..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value Babel - Tokens 1`] = ` -[ - Identifier { - type: "Identifier", - value: "abstract", - - range: [0, 8], - loc: { - start: { column: 0, line: 1 }, - end: { column: 8, line: 1 }, - }, - }, - Keyword { - type: "Keyword", - value: "class", - - range: [9, 14], - loc: { - start: { column: 9, line: 1 }, - end: { column: 14, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "Foo", - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [19, 20], - loc: { - start: { column: 19, line: 1 }, - end: { column: 20, line: 1 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [23, 31], - loc: { - start: { column: 2, line: 2 }, - end: { column: 10, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "accessor", - - range: [32, 40], - loc: { - start: { column: 11, line: 2 }, - end: { column: 19, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "foo", - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ":", - - range: [44, 45], - loc: { - start: { column: 23, line: 2 }, - end: { column: 24, line: 2 }, - }, - }, - Identifier { - type: "Identifier", - value: "number", - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "=", - - range: [53, 54], - loc: { - start: { column: 32, line: 2 }, - end: { column: 33, line: 2 }, - }, - }, - Numeric { - type: "Numeric", - value: "1", - - range: [55, 56], - loc: { - start: { column: 34, line: 2 }, - end: { column: 35, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [56, 57], - loc: { - start: { column: 35, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [58, 59], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 3 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot deleted file mode 100644 index 27b36ea8b18..00000000000 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot +++ /dev/null @@ -1,108 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST Alignment - AST 1`] = ` -"Snapshot Diff: -- TSESTree -+ Babel - - Program { - type: 'Program', - body: Array [ - ClassDeclaration { - type: 'ClassDeclaration', - abstract: true, - body: ClassBody { - type: 'ClassBody', - body: Array [ -- TSAbstractAccessorProperty { -- type: 'TSAbstractAccessorProperty', -+ ClassAccessorProperty { -+ type: 'ClassAccessorProperty', -+ abstract: true, - computed: false, -- declare: false, - key: Identifier { - type: 'Identifier', - name: 'foo', - - range: [41, 44], - loc: { - start: { column: 20, line: 2 }, - end: { column: 23, line: 2 }, - }, - }, -- override: false, - static: false, - typeAnnotation: TSTypeAnnotation { - type: 'TSTypeAnnotation', - typeAnnotation: TSNumberKeyword { - type: 'TSNumberKeyword', - - range: [46, 52], - loc: { - start: { column: 25, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, - - range: [44, 52], - loc: { - start: { column: 23, line: 2 }, - end: { column: 31, line: 2 }, - }, - }, -- value: null, -+ value: Literal { -+ type: 'Literal', -+ raw: '1', -+ value: 1, -+ -+ range: [55, 56], -+ loc: { -+ start: { column: 34, line: 2 }, -+ end: { column: 35, line: 2 }, -+ }, -+ }, - - range: [23, 57], - loc: { - start: { column: 2, line: 2 }, - end: { column: 36, line: 2 }, - }, - }, - ], - - range: [19, 59], - loc: { - start: { column: 19, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - id: Identifier { - type: 'Identifier', - name: 'Foo', - - range: [15, 18], - loc: { - start: { column: 15, line: 1 }, - end: { column: 18, line: 1 }, - }, - }, - superClass: null, - - range: [0, 59], - loc: { - start: { column: 0, line: 1 }, - end: { column: 1, line: 3 }, - }, - }, - ], - sourceType: 'script', - - range: [0, 60], - loc: { - start: { column: 0, line: 1 }, - end: { column: 0, line: 4 }, - }, - }" -`; diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot index 41f1a89bdc7..4bb778c38dd 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "TSAbstractAccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [41, 44], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -60,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [15, 18], loc: { @@ -70,6 +80,7 @@ Program { end: { column: 18, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 55], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot index cecb46eb91f..b5860513edf 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [41, 44], loc: { @@ -31,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - end: { column: 23, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -67,9 +73,13 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [15, 18], loc: { @@ -77,6 +87,7 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - end: { column: 18, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 55], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot index c16fab78a95..8ca9138a75c 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [31, 34], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 22, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -59,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -69,6 +80,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 45], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot index 76e4314a3c6..806a8428363 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - + type: 'ClassAccessorProperty', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [31, 34], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - end: { column: 22, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -65,9 +72,13 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -75,6 +86,7 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 45], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot index 105774fea63..22e205327b3 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [44, 47], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: true, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,9 +72,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot index 7949a056f9a..4586e088951 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [44, 47], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - end: { column: 23, line: 2 }, }, }, +- optional: false, override: true, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -57,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,9 +78,12 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot index 0ee458fa617..c24e007d6eb 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [31, 34], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 22, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +59,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +73,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 41], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot index fd302779cf1..d3111bb3ed9 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -20,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [31, 34], loc: { @@ -30,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - end: { column: 22, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +65,13 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +79,7 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 41], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot index 8dd908291b3..9a3c69f5795 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "protected", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [33, 36], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 24, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +59,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +73,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 43], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot index c26ec2b5985..821908cd72a 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -20,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment accessibility: 'protected', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [33, 36], loc: { @@ -30,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment end: { column: 24, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +65,13 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +79,7 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 43], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot index 375fcf037db..1143bdf8ab3 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [30, 33], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 21, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +59,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +73,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot index 9eb4ac8ef9b..b5c95aa7471 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -20,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [30, 33], loc: { @@ -30,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A end: { column: 21, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +65,13 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +79,7 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot index 1f6d0b40e2d..926da373f7d 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [32, 35], loc: { @@ -23,6 +28,7 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -52,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +72,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 42], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot index 7f48bba2e58..1b4e86bf4f6 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [32, 35], loc: { @@ -29,6 +34,7 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - end: { column: 23, line: 2 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -58,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +78,7 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 42], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot index 2e8ce280183..2aadec8144a 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [30, 33], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 21, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,6 +72,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot index c5c6c8589ee..1786d890224 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [30, 33], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A end: { column: 21, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: Literal { type: 'Literal', @@ -57,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,6 +78,7 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot index 7ee5d769dd2..8caab469b2c 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -41,9 +48,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -51,6 +62,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 30], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot index b08e790e91d..000f205df51 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -47,9 +54,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -57,6 +68,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 30], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot index e127d4593df..52315ed9439 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,6 +72,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot index 0bc31a58020..e676e4e254e 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -57,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,6 +78,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot index a1e4c4fac77..4941754c2d0 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -59,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -69,6 +80,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot index d5ff97f0998..92b38783bb6 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -65,9 +72,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -75,6 +86,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot index 6d4fd50a3c3..7ddb1aff409 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -69,9 +76,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -79,6 +90,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 46], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot index a0d4ea6a1c6..429343b6582 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -75,9 +82,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -85,6 +96,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 46], diff --git a/packages/ast-spec/src/element/Property/spec.ts b/packages/ast-spec/src/element/Property/spec.ts index c96a7a26e37..e10b6b46435 100644 --- a/packages/ast-spec/src/element/Property/spec.ts +++ b/packages/ast-spec/src/element/Property/spec.ts @@ -21,7 +21,7 @@ interface PropertyBase extends BaseNode { computed: boolean; method: boolean; shorthand: boolean; - optional?: boolean; + optional: boolean; kind: 'get' | 'init' | 'set'; } diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts index 97d8e49fcd9..9dd1ddeee69 100644 --- a/packages/ast-spec/src/element/TSEnumMember/spec.ts +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -11,8 +11,8 @@ interface TSEnumMemberBase extends BaseNode { id: | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) | PropertyNameNonComputed; - initializer?: Expression; - computed?: boolean; + initializer: Expression | undefined; + computed: boolean; } /** @@ -33,7 +33,7 @@ export interface TSEnumMemberComputedName extends TSEnumMemberBase { export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { id: PropertyNameNonComputed; - computed?: false; + computed: false; } export type TSEnumMember = diff --git a/packages/ast-spec/src/element/TSIndexSignature/spec.ts b/packages/ast-spec/src/element/TSIndexSignature/spec.ts index 38002bec295..4f514e75714 100644 --- a/packages/ast-spec/src/element/TSIndexSignature/spec.ts +++ b/packages/ast-spec/src/element/TSIndexSignature/spec.ts @@ -7,9 +7,8 @@ import type { Parameter } from '../../unions/Parameter'; export interface TSIndexSignature extends BaseNode { type: AST_NODE_TYPES.TSIndexSignature; parameters: Parameter[]; - typeAnnotation?: TSTypeAnnotation; - readonly?: boolean; - accessibility?: Accessibility; - export?: boolean; - static?: boolean; + typeAnnotation: TSTypeAnnotation | undefined; + readonly: boolean; + accessibility: Accessibility | undefined; + static: boolean; } diff --git a/packages/ast-spec/src/element/TSMethodSignature/spec.ts b/packages/ast-spec/src/element/TSMethodSignature/spec.ts index 5ca7cbead3e..9f75ee603c9 100644 --- a/packages/ast-spec/src/element/TSMethodSignature/spec.ts +++ b/packages/ast-spec/src/element/TSMethodSignature/spec.ts @@ -12,17 +12,16 @@ import type { interface TSMethodSignatureBase extends BaseNode { type: AST_NODE_TYPES.TSMethodSignature; - key: PropertyName; + accessibility: Accessibility | undefined; computed: boolean; - params: Parameter[]; - optional?: boolean; - returnType?: TSTypeAnnotation; - readonly?: boolean; - typeParameters?: TSTypeParameterDeclaration; - accessibility?: Accessibility; - export?: boolean; - static?: boolean; + key: PropertyName; kind: 'get' | 'method' | 'set'; + optional: boolean; + params: Parameter[]; + readonly: boolean; + returnType: TSTypeAnnotation | undefined; + static: boolean; + typeParameters: TSTypeParameterDeclaration | undefined; } export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { diff --git a/packages/ast-spec/src/element/TSPropertySignature/spec.ts b/packages/ast-spec/src/element/TSPropertySignature/spec.ts index a3f91ac2680..e695085ca40 100644 --- a/packages/ast-spec/src/element/TSPropertySignature/spec.ts +++ b/packages/ast-spec/src/element/TSPropertySignature/spec.ts @@ -2,7 +2,6 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { Accessibility } from '../../base/Accessibility'; import type { BaseNode } from '../../base/BaseNode'; import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; -import type { Expression } from '../../unions/Expression'; import type { PropertyName, PropertyNameComputed, @@ -12,14 +11,12 @@ import type { interface TSPropertySignatureBase extends BaseNode { type: AST_NODE_TYPES.TSPropertySignature; key: PropertyName; - optional?: boolean; + optional: boolean; computed: boolean; - typeAnnotation?: TSTypeAnnotation; - initializer?: Expression; - readonly?: boolean; - static?: boolean; - export?: boolean; - accessibility?: Accessibility; + typeAnnotation: TSTypeAnnotation | undefined; + readonly: boolean; + static: boolean; + accessibility: Accessibility | undefined; } export interface TSPropertySignatureComputedName diff --git a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts index 347ee854137..8532636554a 100644 --- a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts +++ b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts @@ -14,6 +14,6 @@ export interface ArrowFunctionExpression extends BaseNode { body: BlockStatement | Expression; async: boolean; expression: boolean; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; + returnType: TSTypeAnnotation | undefined; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/expression/BinaryExpression/BinaryOperatorToText.ts b/packages/ast-spec/src/expression/BinaryExpression/BinaryOperatorToText.ts new file mode 100644 index 00000000000..b19373f54d2 --- /dev/null +++ b/packages/ast-spec/src/expression/BinaryExpression/BinaryOperatorToText.ts @@ -0,0 +1,35 @@ +import type { SyntaxKind } from 'typescript'; + +// the members of ts.BinaryOperator +export interface BinaryOperatorToText { + [SyntaxKind.InstanceOfKeyword]: 'instanceof'; + [SyntaxKind.InKeyword]: 'in'; + + // math + [SyntaxKind.AsteriskAsteriskToken]: '**'; + [SyntaxKind.AsteriskToken]: '*'; + [SyntaxKind.SlashToken]: '/'; + [SyntaxKind.PercentToken]: '%'; + [SyntaxKind.PlusToken]: '+'; + [SyntaxKind.MinusToken]: '-'; + + // bitwise + [SyntaxKind.AmpersandToken]: '&'; + [SyntaxKind.BarToken]: '|'; + [SyntaxKind.CaretToken]: '^'; + [SyntaxKind.LessThanLessThanToken]: '<<'; + [SyntaxKind.GreaterThanGreaterThanToken]: '>>'; + [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>'; + + // logical + [SyntaxKind.AmpersandAmpersandToken]: '&&'; + [SyntaxKind.BarBarToken]: '||'; + [SyntaxKind.LessThanToken]: '<'; + [SyntaxKind.LessThanEqualsToken]: '<='; + [SyntaxKind.GreaterThanToken]: '>'; + [SyntaxKind.GreaterThanEqualsToken]: '>='; + [SyntaxKind.EqualsEqualsToken]: '=='; + [SyntaxKind.EqualsEqualsEqualsToken]: '==='; + [SyntaxKind.ExclamationEqualsEqualsToken]: '!=='; + [SyntaxKind.ExclamationEqualsToken]: '!='; +} diff --git a/packages/ast-spec/src/expression/BinaryExpression/spec.ts b/packages/ast-spec/src/expression/BinaryExpression/spec.ts index fa43c88bcf5..d42f1d4e77f 100644 --- a/packages/ast-spec/src/expression/BinaryExpression/spec.ts +++ b/packages/ast-spec/src/expression/BinaryExpression/spec.ts @@ -2,10 +2,14 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; import type { PrivateIdentifier } from '../../special/PrivateIdentifier/spec'; import type { Expression } from '../../unions/Expression'; +import type { ValueOf } from '../../utils'; +import type { BinaryOperatorToText } from './BinaryOperatorToText'; + +export * from './BinaryOperatorToText'; export interface BinaryExpression extends BaseNode { type: AST_NODE_TYPES.BinaryExpression; - operator: string; + operator: ValueOf; left: Expression | PrivateIdentifier; right: Expression; } diff --git a/packages/ast-spec/src/expression/CallExpression/spec.ts b/packages/ast-spec/src/expression/CallExpression/spec.ts index bd71773a1be..b7569c9892e 100644 --- a/packages/ast-spec/src/expression/CallExpression/spec.ts +++ b/packages/ast-spec/src/expression/CallExpression/spec.ts @@ -8,6 +8,10 @@ export interface CallExpression extends BaseNode { type: AST_NODE_TYPES.CallExpression; callee: LeftHandSideExpression; arguments: CallExpressionArgument[]; - typeParameters?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; + optional: boolean; } diff --git a/packages/ast-spec/src/expression/ClassExpression/spec.ts b/packages/ast-spec/src/expression/ClassExpression/spec.ts index dfe6c0d1b41..dbd4936f67c 100644 --- a/packages/ast-spec/src/expression/ClassExpression/spec.ts +++ b/packages/ast-spec/src/expression/ClassExpression/spec.ts @@ -3,7 +3,7 @@ import type { ClassBase } from '../../base/ClassBase'; export interface ClassExpression extends ClassBase { type: AST_NODE_TYPES.ClassExpression; - abstract?: undefined; - declare?: undefined; - decorators?: undefined; + abstract: false; + declare: false; + decorators: []; } diff --git a/packages/ast-spec/src/expression/Identifier/spec.ts b/packages/ast-spec/src/expression/Identifier/spec.ts index 384922a061a..d18ba7b9b99 100644 --- a/packages/ast-spec/src/expression/Identifier/spec.ts +++ b/packages/ast-spec/src/expression/Identifier/spec.ts @@ -6,7 +6,7 @@ import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; export interface Identifier extends BaseNode { type: AST_NODE_TYPES.Identifier; name: string; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/fixture.ts b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/fixture.ts new file mode 100644 index 00000000000..b91b27f0f8f --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/fixture.ts @@ -0,0 +1,5 @@ +import( + "./source.json", + {assert: {type: "json"}}, + extraArgument +); diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..3cdc1c9783c --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ extra-arguments Babel - Error 1`] = `[SyntaxError: \`import()\` requires exactly one or two arguments. (1:0)]`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..a18d1fd05d6 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ extra-arguments TSESTree - Error 1`] = ` +"TSError + 2 | "./source.json", + 3 | {assert: {type: "json"}}, +> 4 | extraArgument + | ^^^^^^^^^^^^^ Dynamic import requires exactly one or two arguments. + 5 | ); + 6 |" +`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..69fd583b79f --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ extra-arguments Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..3cdc1c9783c --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ extra-arguments Babel - Error 1`] = `[SyntaxError: \`import()\` requires exactly one or two arguments. (1:0)]`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..69fd583b79f --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/extra-arguments/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ extra-arguments Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/fixture.ts b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/fixture.ts new file mode 100644 index 00000000000..6f375fea965 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/fixture.ts @@ -0,0 +1 @@ +import(); diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..8b27d717875 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ no-arguments Babel - Error 1`] = `[SyntaxError: \`import()\` requires exactly one or two arguments. (1:0)]`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..b76c8be6e53 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ no-arguments TSESTree - Error 1`] = ` +"TSError +> 1 | import(); + | ^^^^^^^^ Dynamic import requires exactly one or two arguments. + 2 |" +`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..a767b5a6468 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ no-arguments Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..8b27d717875 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ no-arguments Babel - Error 1`] = `[SyntaxError: \`import()\` requires exactly one or two arguments. (1:0)]`; diff --git a/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..a767b5a6468 --- /dev/null +++ b/packages/ast-spec/src/expression/ImportExpression/fixtures/_error_/no-arguments/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ImportExpression _error_ no-arguments Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/NewExpression/spec.ts b/packages/ast-spec/src/expression/NewExpression/spec.ts index 1ee93ef507d..51aea284158 100644 --- a/packages/ast-spec/src/expression/NewExpression/spec.ts +++ b/packages/ast-spec/src/expression/NewExpression/spec.ts @@ -8,5 +8,8 @@ export interface NewExpression extends BaseNode { type: AST_NODE_TYPES.NewExpression; callee: LeftHandSideExpression; arguments: CallExpressionArgument[]; - typeParameters?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; } diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/fixture.ts new file mode 100644 index 00000000000..876119b3990 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/fixture.ts @@ -0,0 +1 @@ +({get foo();}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..71aabcc7954 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-getter-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:11)]`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..16431b24f4d --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-getter-body TSESTree - Error 1`] = ` +"TSError +> 1 | ({get foo();}) + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..d2dd4f91eab --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-getter-body Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..71aabcc7954 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-getter-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:11)]`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..bc5201f9cee --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-getter-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-getter-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/fixture.ts new file mode 100644 index 00000000000..433743dbdf0 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/fixture.ts @@ -0,0 +1 @@ +({method();}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..83750d60313 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-method-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:10)]`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..d5072a95357 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-method-body TSESTree - Error 1`] = ` +"TSError +> 1 | ({method();}) + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..cb8ca32066b --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-method-body Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..83750d60313 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-method-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:10)]`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..37626ca0238 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-method-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-method-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/fixture.ts b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/fixture.ts new file mode 100644 index 00000000000..7f9318e62fd --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/fixture.ts @@ -0,0 +1 @@ +({set foo(value);}) diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..340728334fd --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-setter-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:16)]`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..b775e8717cb --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-setter-body TSESTree - Error 1`] = ` +"TSError +> 1 | ({set foo(value);}) + | ^ '{' expected. + 2 |" +`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7691ccccd84 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-setter-body Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..340728334fd --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-setter-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:16)]`; diff --git a/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..21d1ea67346 --- /dev/null +++ b/packages/ast-spec/src/expression/ObjectExpression/fixtures/_error_/missing-setter-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures expression ObjectExpression _error_ missing-setter-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts b/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts index c0a9f9fd99b..064dd30612f 100644 --- a/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts +++ b/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts @@ -6,5 +6,8 @@ import type { Expression } from '../../unions/Expression'; export interface TSInstantiationExpression extends BaseNode { type: AST_NODE_TYPES.TSInstantiationExpression; expression: Expression; - typeParameters: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot index bd2b5ff603e..4fa6709d6a5 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [0, 3], loc: { @@ -24,7 +26,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [14, 17], loc: { @@ -50,7 +54,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [28, 31], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot index 0d7d689095e..c3381385760 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,100 @@ exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot index 6b30696c30b..44e6ea89118 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -50,7 +50,9 @@ Program { }, test: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot index a35b55978ba..b8284df201f 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,89 @@ exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ConditionalExpression { + type: 'ConditionalExpression', + alternate: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [23, 29], + loc: { + start: { column: 23, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [11, 29], + loc: { + start: { column: 11, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + consequent: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + test: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot index 190beb7c0dd..725f2226368 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -34,7 +34,9 @@ Program { }, test: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [1, 4], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot index 45e35dfc272..8d2c36f9f1a 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,89 @@ exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ConditionalExpression { + type: 'ConditionalExpression', + alternate: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + consequent: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + test: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + + range: [1, 12], + loc: { + start: { column: 1, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot index 680a51ad16a..40146d0cb3a 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot index c167cbcb46b..caa4c4e0517 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,58 @@ exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot index 0775d6c2219..64e87002566 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [0, 3], loc: { @@ -26,7 +28,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [16, 20], loc: { @@ -34,6 +38,9 @@ Program { end: { column: 20, line: 1 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot index 8e025552275..edf9cfe837c 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,114 @@ exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '\\'value\\'', + value: 'value', + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [16, 29], + loc: { + start: { column: 16, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + + range: [14, 31], + loc: { + start: { column: 14, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot index 0c9eb9f1468..cc7c01444f0 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot index eb993d611eb..9d2bc98de48 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,120 @@ exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot index 06455ebe104..ba8636aaab2 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot index a21b35204c9..7d464b640eb 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + operator: '===', + right: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [9, 27], + loc: { + start: { column: 9, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot index 1ffb8d1525b..98075319cc3 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [1, 4], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot index 28594822212..d616143c031 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + operator: '===', + right: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts index b7726f7f140..ec7b71c8e2b 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts @@ -1 +1 @@ -({ prop: 'string' } satisfies { prop: string }); +({ prop: 'string' }) satisfies { prop: string }; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot index 8dbdf850e40..8dd52c055f8 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [3, 7], loc: { @@ -26,6 +28,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -61,52 +64,57 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { type: "TSStringKeyword", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [36, 44], + range: [37, 45], loc: { - start: { column: 36, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [32, 44], + range: [33, 45], loc: { - start: { column: 32, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, }, }, ], - range: [30, 46], + range: [31, 47], loc: { - start: { column: 30, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, }, }, - range: [1, 46], + range: [0, 47], loc: { - start: { column: 1, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, }, }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot index f6e62fda8a7..f7f9d748d61 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -62,70 +62,70 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-paren end: { column: 19, line: 1 }, }, }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, Identifier { type: "Identifier", value: "satisfies", - range: [20, 29], + range: [21, 30], loc: { - start: { column: 20, line: 1 }, - end: { column: 29, line: 1 }, + start: { column: 21, line: 1 }, + end: { column: 30, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 30, line: 1 }, - end: { column: 31, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, }, }, Identifier { type: "Identifier", value: "prop", - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [36, 37], + range: [37, 38], loc: { - start: { column: 36, line: 1 }, - end: { column: 37, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, }, }, Identifier { type: "Identifier", value: "string", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [45, 46], - loc: { - start: { column: 45, line: 1 }, - end: { column: 46, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - range: [46, 47], loc: { start: { column: 46, line: 1 }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot index 59da487f065..d0798a51c94 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/3-Babel-AST.shot @@ -63,10 +63,10 @@ Program { type: "Identifier", name: "prop", - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, typeAnnotation: TSTypeAnnotation { @@ -74,39 +74,39 @@ Program { typeAnnotation: TSStringKeyword { type: "TSStringKeyword", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [36, 44], + range: [37, 45], loc: { - start: { column: 36, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [32, 44], + range: [33, 45], loc: { - start: { column: 32, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, }, }, ], - range: [30, 46], + range: [31, 47], loc: { - start: { column: 30, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, }, }, - range: [1, 46], + range: [0, 47], loc: { - start: { column: 1, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, }, }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot index 1aa182f5d2d..04ef14bf645 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/4-Babel-Tokens.shot @@ -62,70 +62,70 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-paren end: { column: 19, line: 1 }, }, }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, Identifier { type: "Identifier", value: "satisfies", - range: [20, 29], + range: [21, 30], loc: { - start: { column: 20, line: 1 }, - end: { column: 29, line: 1 }, + start: { column: 21, line: 1 }, + end: { column: 30, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 30, line: 1 }, - end: { column: 31, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, }, }, Identifier { type: "Identifier", value: "prop", - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [36, 37], + range: [37, 38], loc: { - start: { column: 36, line: 1 }, - end: { column: 37, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, }, }, Identifier { type: "Identifier", value: "string", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [45, 46], - loc: { - start: { column: 45, line: 1 }, - end: { column: 46, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - range: [46, 47], loc: { start: { column: 46, line: 1 }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot index bad308efe92..fe43005e4eb 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,139 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\'string\\'', + value: 'string', + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [37, 45], + loc: { + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [33, 45], + loc: { + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + + range: [31, 47], + loc: { + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts index b7726f7f140..ec7b71c8e2b 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts @@ -1 +1 @@ -({ prop: 'string' } satisfies { prop: string }); +({ prop: 'string' }) satisfies { prop: string }; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot index c73bf6bd05d..33b08222c86 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, range: [3, 7], loc: { @@ -26,6 +28,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -61,52 +64,57 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop", + optional: false, - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { type: "TSStringKeyword", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [36, 44], + range: [37, 45], loc: { - start: { column: 36, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [32, 44], + range: [33, 45], loc: { - start: { column: 32, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, }, }, ], - range: [30, 46], + range: [31, 47], loc: { - start: { column: 30, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, }, }, - range: [1, 46], + range: [0, 47], loc: { - start: { column: 1, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, }, }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot index 18e9568f78b..a022fc363e0 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/2-TSESTree-Tokens.shot @@ -62,70 +62,70 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-paren end: { column: 19, line: 1 }, }, }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, Identifier { type: "Identifier", value: "satisfies", - range: [20, 29], + range: [21, 30], loc: { - start: { column: 20, line: 1 }, - end: { column: 29, line: 1 }, + start: { column: 21, line: 1 }, + end: { column: 30, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 30, line: 1 }, - end: { column: 31, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, }, }, Identifier { type: "Identifier", value: "prop", - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [36, 37], + range: [37, 38], loc: { - start: { column: 36, line: 1 }, - end: { column: 37, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, }, }, Identifier { type: "Identifier", value: "string", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [45, 46], - loc: { - start: { column: 45, line: 1 }, - end: { column: 46, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - range: [46, 47], loc: { start: { column: 46, line: 1 }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot index 0131efff0cb..3ea078f4e99 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/3-Babel-AST.shot @@ -63,10 +63,10 @@ Program { type: "Identifier", name: "prop", - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, typeAnnotation: TSTypeAnnotation { @@ -74,39 +74,39 @@ Program { typeAnnotation: TSStringKeyword { type: "TSStringKeyword", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [36, 44], + range: [37, 45], loc: { - start: { column: 36, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, }, }, - range: [32, 44], + range: [33, 45], loc: { - start: { column: 32, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, }, }, ], - range: [30, 46], + range: [31, 47], loc: { - start: { column: 30, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, }, }, - range: [1, 46], + range: [0, 47], loc: { - start: { column: 1, line: 1 }, - end: { column: 46, line: 1 }, + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, }, }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot index 319139b4a84..a1d5ac276a7 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/4-Babel-Tokens.shot @@ -62,70 +62,70 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-paren end: { column: 19, line: 1 }, }, }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, Identifier { type: "Identifier", value: "satisfies", - range: [20, 29], + range: [21, 30], loc: { - start: { column: 20, line: 1 }, - end: { column: 29, line: 1 }, + start: { column: 21, line: 1 }, + end: { column: 30, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "{", - range: [30, 31], + range: [31, 32], loc: { - start: { column: 30, line: 1 }, - end: { column: 31, line: 1 }, + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, }, }, Identifier { type: "Identifier", value: "prop", - range: [32, 36], + range: [33, 37], loc: { - start: { column: 32, line: 1 }, - end: { column: 36, line: 1 }, + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, }, }, Punctuator { type: "Punctuator", value: ":", - range: [36, 37], + range: [37, 38], loc: { - start: { column: 36, line: 1 }, - end: { column: 37, line: 1 }, + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, }, }, Identifier { type: "Identifier", value: "string", - range: [38, 44], + range: [39, 45], loc: { - start: { column: 38, line: 1 }, - end: { column: 44, line: 1 }, + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, }, }, Punctuator { type: "Punctuator", value: "}", - range: [45, 46], - loc: { - start: { column: 45, line: 1 }, - end: { column: 46, line: 1 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - range: [46, 47], loc: { start: { column: 46, line: 1 }, diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot index 982ccda73a2..add1ea89b36 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,139 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\'string\\'', + value: 'string', + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [37, 45], + loc: { + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [33, 45], + loc: { + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + + range: [31, 47], + loc: { + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts index e3438484d9d..b673ca5f0db 100644 --- a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts @@ -6,7 +6,11 @@ import type { TemplateLiteral } from '../TemplateLiteral/spec'; export interface TaggedTemplateExpression extends BaseNode { type: AST_NODE_TYPES.TaggedTemplateExpression; - typeParameters?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; + tag: LeftHandSideExpression; quasi: TemplateLiteral; } diff --git a/packages/ast-spec/src/expression/YieldExpression/spec.ts b/packages/ast-spec/src/expression/YieldExpression/spec.ts index 1f07e4f78e3..00c64731e73 100644 --- a/packages/ast-spec/src/expression/YieldExpression/spec.ts +++ b/packages/ast-spec/src/expression/YieldExpression/spec.ts @@ -5,5 +5,5 @@ import type { Expression } from '../../unions/Expression'; export interface YieldExpression extends BaseNode { type: AST_NODE_TYPES.YieldExpression; delegate: boolean; - argument?: Expression; + argument: Expression | undefined; } diff --git a/packages/ast-spec/src/index.ts b/packages/ast-spec/src/index.ts index ba9ee680000..3ca95ed6417 100644 --- a/packages/ast-spec/src/index.ts +++ b/packages/ast-spec/src/index.ts @@ -1,5 +1,6 @@ export * from './base/Accessibility'; export * from './base/BaseNode'; // this is exported so that the `types` package can merge the decl and add the `parent` property +export * from './base/NodeOrTokenData'; export * from './base/OptionalRangeAndLoc'; export * from './base/Position'; export * from './base/Range'; @@ -26,7 +27,6 @@ export * from './unions/JSXTagNameExpression'; export * from './unions/LeftHandSideExpression'; export * from './unions/Literal'; export * from './unions/LiteralExpression'; -export * from './unions/Modifier'; export * from './unions/Node'; export * from './unions/ObjectLiteralElement'; export * from './unions/Parameter'; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx new file mode 100644 index 00000000000..2bb647ef340 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx @@ -0,0 +1,11 @@ +declare namespace JSX { + interface IntrinsicElements { + foo: any; + 'foo-bar:baz-bam': any; + } +} + +// @ts-expect-error -- https://github.com/typescript-eslint/typescript-eslint/issues/7166 +const componentBasic = ; +// @ts-expect-error -- https://github.com/typescript-eslint/typescript-eslint/issues/7166 +const componentDashed = ; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..ba010bda2df --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,323 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, + + range: [60, 63], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + optional: false, + readonly: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [65, 68], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [63, 68], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [60, 69], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: "'foo-bar:baz-bam'", + value: "foo-bar:baz-bam", + + range: [74, 91], + loc: { + start: { column: 4, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + optional: false, + readonly: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [93, 96], + loc: { + start: { column: 23, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + + range: [91, 96], + loc: { + start: { column: 21, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + + range: [74, 97], + loc: { + start: { column: 4, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + ], + + range: [54, 101], + loc: { + start: { column: 30, line: 2 }, + end: { column: 3, line: 5 }, + }, + }, + declare: false, + extends: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "IntrinsicElements", + optional: false, + + range: [36, 53], + loc: { + start: { column: 12, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [26, 101], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 5 }, + }, + }, + ], + + range: [22, 103], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 6 }, + }, + }, + declare: true, + global: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "JSX", + optional: false, + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + kind: "namespace", + + range: [0, 103], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 6 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "componentBasic", + optional: false, + + range: [201, 215], + loc: { + start: { column: 6, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "foo", + + range: [219, 222], + loc: { + start: { column: 24, line: 9 }, + end: { column: 27, line: 9 }, + }, + }, + selfClosing: true, + + range: [218, 225], + loc: { + start: { column: 23, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + + range: [218, 225], + loc: { + start: { column: 23, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + + range: [201, 225], + loc: { + start: { column: 6, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [195, 226], + loc: { + start: { column: 0, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "componentDashed", + optional: false, + + range: [323, 338], + loc: { + start: { column: 6, line: 11 }, + end: { column: 21, line: 11 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "baz-bam", + + range: [350, 357], + loc: { + start: { column: 33, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "foo-bar", + + range: [342, 349], + loc: { + start: { column: 25, line: 11 }, + end: { column: 32, line: 11 }, + }, + }, + + range: [342, 357], + loc: { + start: { column: 25, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + selfClosing: true, + + range: [341, 360], + loc: { + start: { column: 24, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + + range: [341, 360], + loc: { + start: { column: 24, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + + range: [323, 360], + loc: { + start: { column: 6, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [317, 361], + loc: { + start: { column: 0, line: 11 }, + end: { column: 44, line: 11 }, + }, + }, + ], + sourceType: "script", + + range: [0, 362], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 12 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7d73f939d7a --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,356 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed TSESTree - Tokens 1`] = ` +[ + 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: "JSX", + + range: [18, 21], + loc: { + start: { column: 18, 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "interface", + + range: [26, 35], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "IntrinsicElements", + + range: [36, 53], + loc: { + start: { column: 12, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [54, 55], + loc: { + start: { column: 30, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [60, 63], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [63, 64], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [65, 68], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [68, 69], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + String { + type: "String", + value: "'foo-bar:baz-bam'", + + range: [74, 91], + loc: { + start: { column: 4, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [91, 92], + loc: { + start: { column: 21, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [93, 96], + loc: { + start: { column: 23, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [96, 97], + loc: { + start: { column: 26, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [100, 101], + loc: { + start: { column: 2, line: 5 }, + end: { column: 3, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [102, 103], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [195, 200], + loc: { + start: { column: 0, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + Identifier { + type: "Identifier", + value: "componentBasic", + + range: [201, 215], + loc: { + start: { column: 6, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [216, 217], + loc: { + start: { column: 21, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [218, 219], + loc: { + start: { column: 23, line: 9 }, + end: { column: 24, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "foo", + + range: [219, 222], + loc: { + start: { column: 24, line: 9 }, + end: { column: 27, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [223, 224], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [224, 225], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [225, 226], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [317, 322], + loc: { + start: { column: 0, line: 11 }, + end: { column: 5, line: 11 }, + }, + }, + Identifier { + type: "Identifier", + value: "componentDashed", + + range: [323, 338], + loc: { + start: { column: 6, line: 11 }, + end: { column: 21, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [339, 340], + loc: { + start: { column: 22, line: 11 }, + end: { column: 23, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [341, 342], + loc: { + start: { column: 24, line: 11 }, + end: { column: 25, line: 11 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo-bar", + + range: [342, 349], + loc: { + start: { column: 25, line: 11 }, + end: { column: 32, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [349, 350], + loc: { + start: { column: 32, line: 11 }, + end: { column: 33, line: 11 }, + }, + }, + Identifier { + type: "Identifier", + value: "baz-bam", + + range: [350, 357], + loc: { + start: { column: 33, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [358, 359], + loc: { + start: { column: 41, line: 11 }, + end: { column: 42, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [359, 360], + loc: { + start: { column: 42, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [360, 361], + loc: { + start: { column: 43, line: 11 }, + end: { column: 44, line: 11 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..e065c2a0f7f --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/3-Babel-AST.shot @@ -0,0 +1,299 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "foo", + + range: [60, 63], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [65, 68], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [63, 68], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [60, 69], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: "'foo-bar:baz-bam'", + value: "foo-bar:baz-bam", + + range: [74, 91], + loc: { + start: { column: 4, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSAnyKeyword { + type: "TSAnyKeyword", + + range: [93, 96], + loc: { + start: { column: 23, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + + range: [91, 96], + loc: { + start: { column: 21, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + + range: [74, 97], + loc: { + start: { column: 4, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + ], + + range: [54, 101], + loc: { + start: { column: 30, line: 2 }, + end: { column: 3, line: 5 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "IntrinsicElements", + + range: [36, 53], + loc: { + start: { column: 12, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [26, 101], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 5 }, + }, + }, + ], + + range: [22, 103], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 6 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "JSX", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 103], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 6 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "componentBasic", + + range: [201, 215], + loc: { + start: { column: 6, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "foo", + + range: [219, 222], + loc: { + start: { column: 24, line: 9 }, + end: { column: 27, line: 9 }, + }, + }, + selfClosing: true, + + range: [218, 225], + loc: { + start: { column: 23, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + + range: [218, 225], + loc: { + start: { column: 23, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + + range: [201, 225], + loc: { + start: { column: 6, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + kind: "const", + + range: [195, 226], + loc: { + start: { column: 0, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "componentDashed", + + range: [323, 338], + loc: { + start: { column: 6, line: 11 }, + end: { column: 21, line: 11 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "baz-bam", + + range: [350, 357], + loc: { + start: { column: 33, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "foo-bar", + + range: [342, 349], + loc: { + start: { column: 25, line: 11 }, + end: { column: 32, line: 11 }, + }, + }, + + range: [342, 357], + loc: { + start: { column: 25, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + selfClosing: true, + + range: [341, 360], + loc: { + start: { column: 24, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + + range: [341, 360], + loc: { + start: { column: 24, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + + range: [323, 360], + loc: { + start: { column: 6, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + ], + kind: "const", + + range: [317, 361], + loc: { + start: { column: 0, line: 11 }, + end: { column: 44, line: 11 }, + }, + }, + ], + sourceType: "script", + + range: [0, 362], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 12 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..80a517390c0 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,356 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed Babel - Tokens 1`] = ` +[ + 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: "JSX", + + range: [18, 21], + loc: { + start: { column: 18, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [26, 35], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "IntrinsicElements", + + range: [36, 53], + loc: { + start: { column: 12, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [54, 55], + loc: { + start: { column: 30, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [60, 63], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [63, 64], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [65, 68], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [68, 69], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + String { + type: "String", + value: "'foo-bar:baz-bam'", + + range: [74, 91], + loc: { + start: { column: 4, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [91, 92], + loc: { + start: { column: 21, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [93, 96], + loc: { + start: { column: 23, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [96, 97], + loc: { + start: { column: 26, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [100, 101], + loc: { + start: { column: 2, line: 5 }, + end: { column: 3, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [102, 103], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [195, 200], + loc: { + start: { column: 0, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + Identifier { + type: "Identifier", + value: "componentBasic", + + range: [201, 215], + loc: { + start: { column: 6, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [216, 217], + loc: { + start: { column: 21, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [218, 219], + loc: { + start: { column: 23, line: 9 }, + end: { column: 24, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "foo", + + range: [219, 222], + loc: { + start: { column: 24, line: 9 }, + end: { column: 27, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [223, 224], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [224, 225], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [225, 226], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [317, 322], + loc: { + start: { column: 0, line: 11 }, + end: { column: 5, line: 11 }, + }, + }, + Identifier { + type: "Identifier", + value: "componentDashed", + + range: [323, 338], + loc: { + start: { column: 6, line: 11 }, + end: { column: 21, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [339, 340], + loc: { + start: { column: 22, line: 11 }, + end: { column: 23, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [341, 342], + loc: { + start: { column: 24, line: 11 }, + end: { column: 25, line: 11 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "foo-bar", + + range: [342, 349], + loc: { + start: { column: 25, line: 11 }, + end: { column: 32, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [349, 350], + loc: { + start: { column: 32, line: 11 }, + end: { column: 33, line: 11 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "baz-bam", + + range: [350, 357], + loc: { + start: { column: 33, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [358, 359], + loc: { + start: { column: 41, line: 11 }, + end: { column: 42, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [359, 360], + loc: { + start: { column: 42, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [360, 361], + loc: { + start: { column: 43, line: 11 }, + end: { column: 44, line: 11 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..eb7b0cfaf14 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,327 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSModuleDeclaration { + type: 'TSModuleDeclaration', + body: TSModuleBlock { + type: 'TSModuleBlock', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [60, 63], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [65, 68], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [63, 68], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [60, 69], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Literal { + type: 'Literal', + raw: '\\'foo-bar:baz-bam\\'', + value: 'foo-bar:baz-bam', + + range: [74, 91], + loc: { + start: { column: 4, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [93, 96], + loc: { + start: { column: 23, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + + range: [91, 96], + loc: { + start: { column: 21, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + + range: [74, 97], + loc: { + start: { column: 4, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + ], + + range: [54, 101], + loc: { + start: { column: 30, line: 2 }, + end: { column: 3, line: 5 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'IntrinsicElements', +- optional: false, + + range: [36, 53], + loc: { + start: { column: 12, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + + range: [26, 101], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 5 }, + }, + }, + ], + + range: [22, 103], + loc: { + start: { column: 22, line: 1 }, + end: { column: 1, line: 6 }, + }, + }, + declare: true, +- global: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'JSX', +- optional: false, + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +- kind: 'namespace', + + range: [0, 103], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 6 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'componentBasic', +- optional: false, + + range: [201, 215], + loc: { + start: { column: 6, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + init: JSXElement { + type: 'JSXElement', + children: Array [], + closingElement: null, + openingElement: JSXOpeningElement { + type: 'JSXOpeningElement', + attributes: Array [], + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'foo', + + range: [219, 222], + loc: { + start: { column: 24, line: 9 }, + end: { column: 27, line: 9 }, + }, + }, + selfClosing: true, + + range: [218, 225], + loc: { + start: { column: 23, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + + range: [218, 225], + loc: { + start: { column: 23, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + + range: [201, 225], + loc: { + start: { column: 6, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [195, 226], + loc: { + start: { column: 0, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'componentDashed', +- optional: false, + + range: [323, 338], + loc: { + start: { column: 6, line: 11 }, + end: { column: 21, line: 11 }, + }, + }, + init: JSXElement { + type: 'JSXElement', + children: Array [], + closingElement: null, + openingElement: JSXOpeningElement { + type: 'JSXOpeningElement', + attributes: Array [], + name: JSXNamespacedName { + type: 'JSXNamespacedName', + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'baz-bam', + + range: [350, 357], + loc: { + start: { column: 33, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + namespace: JSXIdentifier { + type: 'JSXIdentifier', + name: 'foo-bar', + + range: [342, 349], + loc: { + start: { column: 25, line: 11 }, + end: { column: 32, line: 11 }, + }, + }, + + range: [342, 357], + loc: { + start: { column: 25, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + selfClosing: true, + + range: [341, 360], + loc: { + start: { column: 24, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + + range: [341, 360], + loc: { + start: { column: 24, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + + range: [323, 360], + loc: { + start: { column: 6, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [317, 361], + loc: { + start: { column: 0, line: 11 }, + end: { column: 44, line: 11 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 362], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 12 }, + }, + }" +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..bae78f1bc5c --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component-dashed/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,366 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component-dashed 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 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'namespace', + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'JSX', + + range: [18, 21], + loc: { + start: { column: 18, 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 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [26, 35], + loc: { + start: { column: 2, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'IntrinsicElements', + + range: [36, 53], + loc: { + start: { column: 12, line: 2 }, + end: { column: 29, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [54, 55], + loc: { + start: { column: 30, line: 2 }, + end: { column: 31, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'foo', + + range: [60, 63], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [63, 64], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [65, 68], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [68, 69], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + String { + type: 'String', + value: '\\'foo-bar:baz-bam\\'', + + range: [74, 91], + loc: { + start: { column: 4, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [91, 92], + loc: { + start: { column: 21, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'any', + + range: [93, 96], + loc: { + start: { column: 23, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [96, 97], + loc: { + start: { column: 26, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [100, 101], + loc: { + start: { column: 2, line: 5 }, + end: { column: 3, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [102, 103], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'const', + + range: [195, 200], + loc: { + start: { column: 0, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'componentBasic', + + range: [201, 215], + loc: { + start: { column: 6, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [216, 217], + loc: { + start: { column: 21, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [218, 219], + loc: { + start: { column: 23, line: 9 }, + end: { column: 24, line: 9 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'foo', + + range: [219, 222], + loc: { + start: { column: 24, line: 9 }, + end: { column: 27, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [223, 224], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [224, 225], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [225, 226], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'const', + + range: [317, 322], + loc: { + start: { column: 0, line: 11 }, + end: { column: 5, line: 11 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'componentDashed', + + range: [323, 338], + loc: { + start: { column: 6, line: 11 }, + end: { column: 21, line: 11 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [339, 340], + loc: { + start: { column: 22, line: 11 }, + end: { column: 23, line: 11 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [341, 342], + loc: { + start: { column: 24, line: 11 }, + end: { column: 25, line: 11 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'foo-bar', + + range: [342, 349], + loc: { + start: { column: 25, line: 11 }, + end: { column: 32, line: 11 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [349, 350], + loc: { + start: { column: 32, line: 11 }, + end: { column: 33, line: 11 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'baz-bam', + + range: [350, 357], + loc: { + start: { column: 33, line: 11 }, + end: { column: 40, line: 11 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [358, 359], + loc: { + start: { column: 41, line: 11 }, + end: { column: 42, line: 11 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [359, 360], + loc: { + start: { column: 42, line: 11 }, + end: { column: 43, line: 11 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [360, 361], + loc: { + start: { column: 43, line: 11 }, + end: { column: 44, line: 11 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx new file mode 100644 index 00000000000..04117403f02 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/fixture.tsx @@ -0,0 +1,10 @@ +const x = ; +const y = ; + +interface NamespacePropComponentProps { + "a:b": string; +} + +function NamespacePropComponent(props: NamespacePropComponentProps) { + return
{props["a:b"]}
; +} diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..71bbf93d494 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,509 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component TSESTree - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "x", + optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [34, 37], + loc: { + start: { column: 34, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""tight spacing"", + value: "tight spacing", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + + range: [34, 53], + loc: { + start: { column: 34, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + selfClosing: true, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [6, 56], + loc: { + start: { column: 6, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [0, 57], + loc: { + start: { column: 0, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + definite: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "y", + optional: false, + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 34, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""loose spacing"", + value: "loose spacing", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + + range: [92, 113], + loc: { + start: { column: 34, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + selfClosing: true, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [64, 116], + loc: { + start: { column: 6, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + ], + declare: false, + kind: "const", + + range: [58, 117], + loc: { + start: { column: 0, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + optional: false, + readonly: false, + static: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [168, 176], + loc: { + start: { column: 9, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [163, 177], + loc: { + start: { column: 4, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [157, 179], + loc: { + start: { column: 38, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + declare: false, + extends: [], + id: Identifier { + type: "Identifier", + decorators: [], + name: "NamespacePropComponentProps", + optional: false, + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + + range: [119, 179], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [ + ReturnStatement { + type: "ReturnStatement", + argument: JSXElement { + type: "JSXElement", + children: [ + JSXExpressionContainer { + type: "JSXExpressionContainer", + expression: MemberExpression { + type: "MemberExpression", + computed: true, + object: Identifier { + type: "Identifier", + decorators: [], + name: "props", + optional: false, + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + + range: [268, 280], + loc: { + start: { column: 17, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [267, 281], + loc: { + start: { column: 16, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + closingElement: JSXClosingElement { + type: "JSXClosingElement", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + + range: [281, 287], + loc: { + start: { column: 30, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + selfClosing: false, + + range: [262, 267], + loc: { + start: { column: 11, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + + range: [262, 287], + loc: { + start: { column: 11, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + + range: [255, 288], + loc: { + start: { column: 4, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + ], + + range: [249, 290], + loc: { + start: { column: 68, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + declare: false, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + decorators: [], + name: "NamespacePropComponent", + optional: false, + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + params: [ + Identifier { + type: "Identifier", + decorators: [], + name: "props", + optional: false, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "NamespacePropComponentProps", + optional: false, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [218, 247], + loc: { + start: { column: 37, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [213, 247], + loc: { + start: { column: 32, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + ], + + range: [181, 290], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: "script", + + range: [0, 291], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 11 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..9352a620aac --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,586 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component TSESTree - Tokens 1`] = ` +[ + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + JSXText { + type: "JSXText", + value: ""tight spacing"", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [54, 55], + loc: { + start: { column: 54, line: 1 }, + end: { column: 55, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [55, 56], + loc: { + start: { column: 55, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 56, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [58, 63], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [66, 67], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [68, 69], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [94, 95], + loc: { + start: { column: 36, line: 2 }, + end: { column: 37, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [97, 98], + loc: { + start: { column: 39, line: 2 }, + end: { column: 40, line: 2 }, + }, + }, + JSXText { + type: "JSXText", + value: ""loose spacing"", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [114, 115], + loc: { + start: { column: 56, line: 2 }, + end: { column: 57, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [115, 116], + loc: { + start: { column: 57, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [116, 117], + loc: { + start: { column: 58, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "interface", + + range: [119, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [157, 158], + loc: { + start: { column: 38, line: 4 }, + end: { column: 39, line: 4 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [168, 169], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [176, 177], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [178, 179], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [181, 189], + loc: { + start: { column: 0, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [212, 213], + loc: { + start: { column: 31, line: 8 }, + end: { column: 32, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [213, 218], + loc: { + start: { column: 32, line: 8 }, + end: { column: 37, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [218, 219], + loc: { + start: { column: 37, line: 8 }, + end: { column: 38, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [247, 248], + loc: { + start: { column: 66, line: 8 }, + end: { column: 67, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [249, 250], + loc: { + start: { column: 68, line: 8 }, + end: { column: 69, line: 8 }, + }, + }, + Keyword { + type: "Keyword", + value: "return", + + range: [255, 261], + loc: { + start: { column: 4, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [262, 263], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [266, 267], + loc: { + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [267, 268], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [273, 274], + loc: { + start: { column: 22, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [279, 280], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [280, 281], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [281, 282], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [282, 283], + loc: { + start: { column: 31, line: 9 }, + end: { column: 32, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [286, 287], + loc: { + start: { column: 35, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [287, 288], + loc: { + start: { column: 36, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [289, 290], + loc: { + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7582f7301e5 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/3-Babel-AST.shot @@ -0,0 +1,485 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component Babel - AST 1`] = ` +Program { + type: "Program", + body: [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [34, 37], + loc: { + start: { column: 34, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""tight spacing"", + value: "tight spacing", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + + range: [34, 53], + loc: { + start: { column: 34, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + selfClosing: true, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [6, 56], + loc: { + start: { column: 6, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 57], + loc: { + start: { column: 0, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + init: JSXElement { + type: "JSXElement", + children: [], + closingElement: null, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [ + JSXAttribute { + type: "JSXAttribute", + name: JSXNamespacedName { + type: "JSXNamespacedName", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + namespace: JSXIdentifier { + type: "JSXIdentifier", + name: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 34, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + value: Literal { + type: "Literal", + raw: ""loose spacing"", + value: "loose spacing", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + + range: [92, 113], + loc: { + start: { column: 34, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + ], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + selfClosing: true, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [64, 116], + loc: { + start: { column: 6, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + ], + kind: "const", + + range: [58, 117], + loc: { + start: { column: 0, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [168, 176], + loc: { + start: { column: 9, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [163, 177], + loc: { + start: { column: 4, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [157, 179], + loc: { + start: { column: 38, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + + range: [119, 179], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: [ + ReturnStatement { + type: "ReturnStatement", + argument: JSXElement { + type: "JSXElement", + children: [ + JSXExpressionContainer { + type: "JSXExpressionContainer", + expression: MemberExpression { + type: "MemberExpression", + computed: true, + object: Identifier { + type: "Identifier", + name: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: "Literal", + raw: ""a:b"", + value: "a:b", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + + range: [268, 280], + loc: { + start: { column: 17, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [267, 281], + loc: { + start: { column: 16, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + closingElement: JSXClosingElement { + type: "JSXClosingElement", + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + + range: [281, 287], + loc: { + start: { column: 30, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + openingElement: JSXOpeningElement { + type: "JSXOpeningElement", + attributes: [], + name: JSXIdentifier { + type: "JSXIdentifier", + name: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + selfClosing: false, + + range: [262, 267], + loc: { + start: { column: 11, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + + range: [262, 287], + loc: { + start: { column: 11, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + + range: [255, 288], + loc: { + start: { column: 4, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + ], + + range: [249, 290], + loc: { + start: { column: 68, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + params: [ + Identifier { + type: "Identifier", + name: "props", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [218, 247], + loc: { + start: { column: 37, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [213, 247], + loc: { + start: { column: 32, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + ], + + range: [181, 290], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: "script", + + range: [0, 291], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 11 }, + }, +} +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..afdd8792c20 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,586 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component Babel - Tokens 1`] = ` +[ + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "a", + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "b", + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + String { + type: "String", + value: ""tight spacing"", + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [54, 55], + loc: { + start: { column: 54, line: 1 }, + end: { column: 55, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [55, 56], + loc: { + start: { column: 55, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [56, 57], + loc: { + start: { column: 56, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [58, 63], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [66, 67], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [68, 69], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "NamespacePropComponent", + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "a", + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [94, 95], + loc: { + start: { column: 36, line: 2 }, + end: { column: 37, line: 2 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "b", + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [97, 98], + loc: { + start: { column: 39, line: 2 }, + end: { column: 40, line: 2 }, + }, + }, + String { + type: "String", + value: ""loose spacing"", + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [114, 115], + loc: { + start: { column: 56, line: 2 }, + end: { column: 57, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [115, 116], + loc: { + start: { column: 57, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [116, 117], + loc: { + start: { column: 58, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [119, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [157, 158], + loc: { + start: { column: 38, line: 4 }, + end: { column: 39, line: 4 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [168, 169], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [176, 177], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [178, 179], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [181, 189], + loc: { + start: { column: 0, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponent", + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [212, 213], + loc: { + start: { column: 31, line: 8 }, + end: { column: 32, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [213, 218], + loc: { + start: { column: 32, line: 8 }, + end: { column: 37, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [218, 219], + loc: { + start: { column: 37, line: 8 }, + end: { column: 38, line: 8 }, + }, + }, + Identifier { + type: "Identifier", + value: "NamespacePropComponentProps", + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [247, 248], + loc: { + start: { column: 66, line: 8 }, + end: { column: 67, line: 8 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [249, 250], + loc: { + start: { column: 68, line: 8 }, + end: { column: 69, line: 8 }, + }, + }, + Keyword { + type: "Keyword", + value: "return", + + range: [255, 261], + loc: { + start: { column: 4, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [262, 263], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [266, 267], + loc: { + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [267, 268], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + Identifier { + type: "Identifier", + value: "props", + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "[", + + range: [273, 274], + loc: { + start: { column: 22, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + String { + type: "String", + value: ""a:b"", + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "]", + + range: [279, 280], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [280, 281], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [281, 282], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "/", + + range: [282, 283], + loc: { + start: { column: 31, line: 9 }, + end: { column: 32, line: 9 }, + }, + }, + JSXIdentifier { + type: "JSXIdentifier", + value: "div", + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [286, 287], + loc: { + start: { column: 35, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [287, 288], + loc: { + start: { column: 36, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [289, 290], + loc: { + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..45ffcb1a231 --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,513 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: JSXElement { + type: 'JSXElement', + children: Array [], + closingElement: null, + openingElement: JSXOpeningElement { + type: 'JSXOpeningElement', + attributes: Array [ + JSXAttribute { + type: 'JSXAttribute', + name: JSXNamespacedName { + type: 'JSXNamespacedName', + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'b', + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + namespace: JSXIdentifier { + type: 'JSXIdentifier', + name: 'a', + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [34, 37], + loc: { + start: { column: 34, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '"tight spacing"', + value: 'tight spacing', + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + + range: [34, 53], + loc: { + start: { column: 34, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + ], + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'NamespacePropComponent', + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + selfClosing: true, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [10, 56], + loc: { + start: { column: 10, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + + range: [6, 56], + loc: { + start: { column: 6, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 57], + loc: { + start: { column: 0, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + init: JSXElement { + type: 'JSXElement', + children: Array [], + closingElement: null, + openingElement: JSXOpeningElement { + type: 'JSXOpeningElement', + attributes: Array [ + JSXAttribute { + type: 'JSXAttribute', + name: JSXNamespacedName { + type: 'JSXNamespacedName', + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'b', + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + namespace: JSXIdentifier { + type: 'JSXIdentifier', + name: 'a', + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 34, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '"loose spacing"', + value: 'loose spacing', + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + + range: [92, 113], + loc: { + start: { column: 34, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + ], + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'NamespacePropComponent', + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, + selfClosing: true, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [68, 116], + loc: { + start: { column: 10, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + + range: [64, 116], + loc: { + start: { column: 6, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [58, 117], + loc: { + start: { column: 0, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Literal { + type: 'Literal', + raw: '"a:b"', + value: 'a:b', + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [168, 176], + loc: { + start: { column: 9, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [163, 177], + loc: { + start: { column: 4, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [157, 179], + loc: { + start: { column: 38, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'NamespacePropComponentProps', +- optional: false, + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + + range: [119, 179], + loc: { + start: { column: 0, line: 4 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: JSXElement { + type: 'JSXElement', + children: Array [ + JSXExpressionContainer { + type: 'JSXExpressionContainer', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'props', +- optional: false, + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '"a:b"', + value: 'a:b', + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + + range: [268, 280], + loc: { + start: { column: 17, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [267, 281], + loc: { + start: { column: 16, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + closingElement: JSXClosingElement { + type: 'JSXClosingElement', + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'div', + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + + range: [281, 287], + loc: { + start: { column: 30, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + openingElement: JSXOpeningElement { + type: 'JSXOpeningElement', + attributes: Array [], + name: JSXIdentifier { + type: 'JSXIdentifier', + name: 'div', + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + selfClosing: false, + + range: [262, 267], + loc: { + start: { column: 11, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + + range: [262, 287], + loc: { + start: { column: 11, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + + range: [255, 288], + loc: { + start: { column: 4, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + ], + + range: [249, 290], + loc: { + start: { column: 68, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'NamespacePropComponent', +- optional: false, + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'props', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'NamespacePropComponentProps', +- optional: false, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [218, 247], + loc: { + start: { column: 37, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + + range: [213, 247], + loc: { + start: { column: 32, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + ], + + range: [181, 290], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 291], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 11 }, + }, + }" +`; diff --git a/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..2a72ccaf2fe --- /dev/null +++ b/packages/ast-spec/src/jsx/JSXNamespacedName/fixtures/component/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,604 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures jsx JSXNamespacedName component 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 }, + }, + }, + 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 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'NamespacePropComponent', + + range: [11, 33], + loc: { + start: { column: 11, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'a', + + range: [34, 35], + loc: { + start: { column: 34, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'b', + + range: [36, 37], + loc: { + start: { column: 36, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, +- JSXText { +- type: 'JSXText', ++ String { ++ type: 'String', + value: '"tight spacing"', + + range: [38, 53], + loc: { + start: { column: 38, line: 1 }, + end: { column: 53, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [54, 55], + loc: { + start: { column: 54, line: 1 }, + end: { column: 55, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [55, 56], + loc: { + start: { column: 55, line: 1 }, + end: { column: 56, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [56, 57], + loc: { + start: { column: 56, line: 1 }, + end: { column: 57, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'const', + + range: [58, 63], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'y', + + range: [64, 65], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [66, 67], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [68, 69], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'NamespacePropComponent', + + range: [69, 91], + loc: { + start: { column: 11, line: 2 }, + end: { column: 33, line: 2 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'a', + + range: [92, 93], + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [94, 95], + loc: { + start: { column: 36, line: 2 }, + end: { column: 37, line: 2 }, + }, + }, +- Identifier { +- type: 'Identifier', ++ JSXIdentifier { ++ type: 'JSXIdentifier', + value: 'b', + + range: [96, 97], + loc: { + start: { column: 38, line: 2 }, + end: { column: 39, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [97, 98], + loc: { + start: { column: 39, line: 2 }, + end: { column: 40, line: 2 }, + }, + }, +- JSXText { +- type: 'JSXText', ++ String { ++ type: 'String', + value: '"loose spacing"', + + range: [98, 113], + loc: { + start: { column: 40, line: 2 }, + end: { column: 55, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [114, 115], + loc: { + start: { column: 56, line: 2 }, + end: { column: 57, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [115, 116], + loc: { + start: { column: 57, line: 2 }, + end: { column: 58, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [116, 117], + loc: { + start: { column: 58, line: 2 }, + end: { column: 59, line: 2 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [119, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'NamespacePropComponentProps', + + range: [129, 156], + loc: { + start: { column: 10, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [157, 158], + loc: { + start: { column: 38, line: 4 }, + end: { column: 39, line: 4 }, + }, + }, + String { + type: 'String', + value: '"a:b"', + + range: [163, 168], + loc: { + start: { column: 4, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [168, 169], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'string', + + range: [170, 176], + loc: { + start: { column: 11, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [176, 177], + loc: { + start: { column: 17, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [178, 179], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'function', + + range: [181, 189], + loc: { + start: { column: 0, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'NamespacePropComponent', + + range: [190, 212], + loc: { + start: { column: 9, line: 8 }, + end: { column: 31, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '(', + + range: [212, 213], + loc: { + start: { column: 31, line: 8 }, + end: { column: 32, line: 8 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'props', + + range: [213, 218], + loc: { + start: { column: 32, line: 8 }, + end: { column: 37, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ':', + + range: [218, 219], + loc: { + start: { column: 37, line: 8 }, + end: { column: 38, line: 8 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'NamespacePropComponentProps', + + range: [220, 247], + loc: { + start: { column: 39, line: 8 }, + end: { column: 66, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ')', + + range: [247, 248], + loc: { + start: { column: 66, line: 8 }, + end: { column: 67, line: 8 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [249, 250], + loc: { + start: { column: 68, line: 8 }, + end: { column: 69, line: 8 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'return', + + range: [255, 261], + loc: { + start: { column: 4, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [262, 263], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'div', + + range: [263, 266], + loc: { + start: { column: 12, line: 9 }, + end: { column: 15, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [266, 267], + loc: { + start: { column: 15, line: 9 }, + end: { column: 16, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [267, 268], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'props', + + range: [268, 273], + loc: { + start: { column: 17, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '[', + + range: [273, 274], + loc: { + start: { column: 22, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + String { + type: 'String', + value: '"a:b"', + + range: [274, 279], + loc: { + start: { column: 23, line: 9 }, + end: { column: 28, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ']', + + range: [279, 280], + loc: { + start: { column: 28, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [280, 281], + loc: { + start: { column: 29, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '<', + + range: [281, 282], + loc: { + start: { column: 30, line: 9 }, + end: { column: 31, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '/', + + range: [282, 283], + loc: { + start: { column: 31, line: 9 }, + end: { column: 32, line: 9 }, + }, + }, + JSXIdentifier { + type: 'JSXIdentifier', + value: 'div', + + range: [283, 286], + loc: { + start: { column: 32, line: 9 }, + end: { column: 35, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '>', + + range: [286, 287], + loc: { + start: { column: 35, line: 9 }, + end: { column: 36, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [287, 288], + loc: { + start: { column: 36, line: 9 }, + end: { column: 37, line: 9 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [289, 290], + loc: { + start: { column: 0, line: 10 }, + end: { column: 1, line: 10 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts index 710fade02fa..1c4ca8af452 100644 --- a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts +++ b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts @@ -7,7 +7,11 @@ import type { JSXSpreadAttribute } from '../JSXSpreadAttribute/spec'; export interface JSXOpeningElement extends BaseNode { type: AST_NODE_TYPES.JSXOpeningElement; - typeParameters?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; + selfClosing: boolean; name: JSXTagNameExpression; attributes: (JSXAttribute | JSXSpreadAttribute)[]; diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot index d8e74a7e7fa..a2a4ac63734 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -32,7 +33,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "configurable", + optional: false, range: [90, 102], loc: { @@ -58,7 +61,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [116, 117], loc: { @@ -67,6 +72,7 @@ Program { }, }, kind: "get", + optional: false, override: false, static: false, value: FunctionExpression { @@ -92,7 +98,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "_x", + optional: false, range: [138, 140], loc: { @@ -122,6 +130,7 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -148,9 +157,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Point", + optional: false, range: [79, 84], loc: { @@ -158,6 +171,7 @@ Program { end: { column: 11, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 147], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot index ef60deece6e..3e8af6cefa6 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -36,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'configurable', +- optional: false, range: [90, 102], loc: { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [116, 117], loc: { @@ -71,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac }, }, kind: 'get', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -96,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_x', +- optional: false, range: [138, 140], loc: { @@ -126,6 +134,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -152,9 +161,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Point', +- optional: false, range: [79, 84], loc: { @@ -162,6 +175,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 11, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 147], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot index 36589a0f64a..4073209596d 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -26,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [96, 99], loc: { @@ -36,6 +39,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -66,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [90, 93], loc: { @@ -92,7 +98,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [122, 125], loc: { @@ -101,6 +109,7 @@ Program { }, }, kind: "get", + optional: false, override: false, static: true, value: FunctionExpression { @@ -126,7 +135,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "_bar", + optional: false, range: [146, 150], loc: { @@ -156,6 +167,7 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -182,9 +194,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Other", + optional: false, range: [79, 84], loc: { @@ -192,6 +208,7 @@ Program { end: { column: 11, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot index 3235fe1f39e..2689d71f89b 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -30,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [96, 99], loc: { @@ -40,6 +43,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -70,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [90, 93], loc: { @@ -96,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [122, 125], loc: { @@ -105,6 +113,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac }, }, kind: 'get', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -130,7 +139,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_bar', +- optional: false, range: [146, 150], loc: { @@ -160,6 +171,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -186,9 +198,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Other', +- optional: false, range: [79, 84], loc: { @@ -196,6 +212,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 11, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot index d41b2280b54..01308cfc10d 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "hidden", + optional: false, range: [86, 92], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "z", + optional: false, range: [99, 100], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "get", + optional: false, override: false, static: false, value: FunctionExpression { @@ -69,7 +75,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "_z", + optional: false, range: [121, 123], loc: { @@ -99,6 +107,7 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -125,9 +134,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [79, 80], loc: { @@ -135,6 +148,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 130], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 41706b97b2e..3f92666a625 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'hidden', +- optional: false, range: [86, 92], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'z', +- optional: false, range: [99, 100], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins }, }, kind: 'get', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -73,7 +79,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_z', +- optional: false, range: [121, 123], loc: { @@ -103,6 +111,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -129,9 +138,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'P', +- optional: false, range: [79, 80], loc: { @@ -139,6 +152,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 130], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot index 533cf3cde41..b2257234533 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "adminonly", + optional: false, range: [89, 98], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, range: [112, 113], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "set", + optional: false, override: false, static: true, value: FunctionExpression { @@ -71,7 +77,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "_y", + optional: false, range: [128, 130], loc: { @@ -89,7 +97,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [133, 134], loc: { @@ -119,13 +129,16 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [114, 115], loc: { @@ -156,9 +169,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "User", + optional: false, range: [79, 83], loc: { @@ -166,6 +183,7 @@ Program { end: { column: 10, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 141], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 1ca322e0c3f..019fc0221c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'adminonly', +- optional: false, range: [89, 98], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, range: [112, 113], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta }, }, kind: 'set', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -75,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_y', +- optional: false, range: [128, 130], loc: { @@ -93,7 +101,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta operator: '=', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [133, 134], loc: { @@ -123,13 +133,16 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [114, 115], loc: { @@ -160,9 +173,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'User', +- optional: false, range: [79, 83], loc: { @@ -170,6 +187,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta end: { column: 10, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 141], diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot index 36cf688cf9d..27cde7cfb1d 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 18, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, range: [82, 83], loc: { @@ -39,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot index 681409dd0ec..0544e38863c 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameter-whitesp end: { column: 18, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, range: [82, 83], loc: { @@ -43,7 +46,9 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameter-whitesp - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot index 591f2b9207c..856ad229ef1 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 42, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, range: [82, 83], loc: { @@ -57,7 +60,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot index 2567fb6d198..28879c1e23d 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameters AST Al end: { column: 42, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, range: [82, 83], loc: { @@ -61,7 +64,9 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameters AST Al - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/fixture.ts b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts similarity index 100% rename from packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/fixture.ts rename to packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..365be7ab31e --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..fd0e954ee51 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | export abstract class AbstractSocket { +> 4 | abstract constructor(); + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..2015736a7f2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor Error Alignment 1`] = `"No errors"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..365be7ab31e --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..c2e76b6b75d --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-constructor Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6c591d66392 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor Babel - Error 1`] = `[SyntaxError: 'static' modifier cannot be used with 'abstract' modifier. (4:11)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot index bb695d9a0b1..500f8130606 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | export abstract class AbstractSocket { +> 4 | abstract static constructor(); + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..37fb30a105a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot index 37fb30a105a..fc418fa8c4b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-abstract-static-constructor Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..e48b2228671 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property Babel - Error 1`] = `[SyntaxError: Property 'foo' cannot have an initializer because it is marked abstract. (4:24)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot index 8afa44f7c60..2c3eef0e00a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | abstract class SpecializedComponent extends SomeComponent { +> 4 | abstract override foo = 1; + | ^ Abstract property cannot have an initializer. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..6de99caccfc --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot index 6de99caccfc..6afce871c92 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-class-with-override-property Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..67e8635916b --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface Babel - Error 1`] = `[SyntaxError: 'abstract' modifier can only appear on a class, method, or property declaration. (3:7)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot index 43e910b9175..c9a5983adf1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export abstract interface I { + | ^^^^^^^^ 'abstract' modifier can only appear on a class, method, or property declaration. + 4 | }" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..15c7f73220a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot index 15c7f73220a..67a613a53ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/abstract-interface/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ abstract-interface Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6e36fa86066 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ await-without-async-function Babel - Error 1`] = `[SyntaxError: Unexpected reserved word 'await'. (4:14)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..e281e0edf2a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/await-without-async-function/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ await-without-async-function Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..40321a29047 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-private-identifier-field-with-accessibility-error Babel - Error 1`] = `[SyntaxError: Private elements cannot have an accessibility modifier ('private'). (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..772471f96e2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-private-identifier-field-with-accessibility-error Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..e61bb7cf0b4 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-constructor-and-type-parameters Babel - Error 1`] = `[SyntaxError: Type parameters cannot appear on a constructor declaration. (4:13)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..aa6535da513 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-constructor-and-type-parameters Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..721146dd0f0 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter-properties Babel - Error 1`] = `[SyntaxError: Unexpected keyword 'export'. (4:16)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot index 2eb5b884fbe..e685ce389b5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter-properties TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter-properties TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | class Foo { +> 4 | constructor(export a: string) { + | ^^^^^^ 'export' modifier cannot appear on a parameter. + 5 | + 6 | } + 7 | }" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..1cc73e1213a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter-properties Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/3-Alignment-Error.shot index 1cc73e1213a..08681e3fc52 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter-properties Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-export-parameter-properties Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..61594867ce5 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-implements-and-extends Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "," (3:57)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-TSESTree-Error.shot index 4c840077279..66677cbe399 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-implements-and-extends TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-implements-and-extends TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class ClassWithParentAndInterface implements MyInterface extends MyOtherClass {} + | ^^^^^^^^^^^^^^^^^^^^ 'extends' clause must precede 'implements' clause. + 4 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..8ca376cb924 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-implements-and-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/3-Alignment-Error.shot index 8ca376cb924..fe9a7f7eec3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-implements-and-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-implements-and-extends Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..11599244d24 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties Babel - Error 1`] = `[SyntaxError: Unexpected reserved word 'static'. (4:16)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot index 4a14ecee200..54b7990c831 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | class Foo { +> 4 | constructor(static a: string) { + | ^^^^^^ 'static' modifier cannot appear on a parameter. + 5 | + 6 | } + 7 | }" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..588fc5dd036 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot index 588fc5dd036..d5010c61e43 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-static-parameter-properties Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..060e140c20f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-two-methods-computed-constructor Babel - Error 1`] = `[SyntaxError: Type parameters cannot appear on a constructor declaration. (4:15)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..81cc16ee83c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ class-with-two-methods-computed-constructor Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..203ef841fa3 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ const-assertions Babel - Error 1`] = `[SyntaxError: Identifier 'x' has already been declared. (13:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..a69ed0ed1cd --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/const-assertions/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ const-assertions Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..92ac5f9b3f8 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-named-enum-computed-number Babel - Error 1`] = `[SyntaxError: Unexpected token (4:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..9ab87939ed9 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-named-enum-computed-number Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..54dece81c98 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-named-enum-computed-string Babel - Error 1`] = `[SyntaxError: Unexpected token (4:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..b81dfe8ab3e --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-string/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-named-enum-computed-string Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..bf5d8d4312f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-named-enum-computed-var-ref Babel - Error 1`] = `[SyntaxError: Unexpected token (4:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..d0503e6badc --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-named-enum-computed-var-ref Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..d16d6e9f798 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-with-import-assertions Babel - Error 1`] = `[SyntaxError: A JSON module can only be imported with \`default\`. (3:9)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..a9ca6bf4e92 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ export-with-import-assertions Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..fb7591e2089 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ import-type-error Babel - Error 1`] = `[SyntaxError: A type-only import can specify a default import or named bindings, but not both. (3:0)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..886a5e2d5b0 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/import-type-error/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ import-type-error Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..824f587f17a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility Babel - Error 1`] = `[SyntaxError: A parameter property is only allowed in a constructor implementation. (4:9)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot index fda3178b272..db761981b7e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Test { +> 4 | new (public x, private y); + | ^^^^^^ A parameter property is only allowed in a constructor implementation. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..d39bd1e45e7 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot index d39bd1e45e7..f863933783d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures basics _error_ interface-with-construct-signature-with-parameter-accessibility Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..613bd109cea --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ new-target-in-arrow-function-body Babel - Error 1`] = `[SyntaxError: \`new.target\` can only be used in functions or class properties. (3:16)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..af2bc132861 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ new-target-in-arrow-function-body Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..86beac1b20b --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ var-with-definite-assignment Babel - Error 1`] = `[SyntaxError: Missing initializer in const declaration. (3:16)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..3dcc38e0603 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics _error_ var-with-definite-assignment Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-AST.shot deleted file mode 100644 index 517f8d05bce..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/1-TSESTree-AST.shot +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor TSESTree - AST 1`] = ` -Program { - type: "Program", - body: [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: [], - declaration: ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: [ - TSAbstractMethodDefinition { - type: "TSAbstractMethodDefinition", - computed: false, - key: Identifier { - type: "Identifier", - name: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - kind: "constructor", - override: false, - static: false, - value: TSEmptyBodyFunctionExpression { - type: "TSEmptyBodyFunctionExpression", - async: false, - body: null, - expression: false, - generator: false, - id: null, - params: [], - - range: [134, 137], - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - - range: [114, 137], - loc: { - start: { column: 2, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - ], - - range: [110, 139], - loc: { - start: { column: 37, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - superClass: null, - - range: [80, 139], - loc: { - start: { column: 7, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - exportKind: "value", - source: null, - specifiers: [], - - range: [73, 139], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - ], - sourceType: "module", - - range: [73, 140], - loc: { - start: { column: 0, line: 3 }, - end: { column: 0, line: 6 }, - }, -} -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/2-TSESTree-Tokens.shot deleted file mode 100644 index efedccbc060..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/2-TSESTree-Tokens.shot +++ /dev/null @@ -1,116 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor TSESTree - Tokens 1`] = ` -[ - Keyword { - type: "Keyword", - value: "export", - - range: [73, 79], - loc: { - start: { column: 0, line: 3 }, - end: { column: 6, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [80, 88], - loc: { - start: { column: 7, line: 3 }, - end: { column: 15, line: 3 }, - }, - }, - Keyword { - type: "Keyword", - value: "class", - - range: [89, 94], - loc: { - start: { column: 16, line: 3 }, - end: { column: 21, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [110, 111], - loc: { - start: { column: 37, line: 3 }, - end: { column: 38, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [114, 122], - loc: { - start: { column: 2, line: 4 }, - end: { column: 10, line: 4 }, - }, - }, - Identifier { - type: "Identifier", - value: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [134, 135], - loc: { - start: { column: 22, line: 4 }, - end: { column: 23, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [135, 136], - loc: { - start: { column: 23, line: 4 }, - end: { column: 24, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [136, 137], - loc: { - start: { column: 24, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [138, 139], - loc: { - start: { column: 0, line: 5 }, - end: { column: 1, line: 5 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/3-Babel-AST.shot deleted file mode 100644 index a53c2df0e58..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/3-Babel-AST.shot +++ /dev/null @@ -1,98 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor Babel - AST 1`] = ` -Program { - type: "Program", - body: [ - ExportNamedDeclaration { - type: "ExportNamedDeclaration", - assertions: [], - declaration: ClassDeclaration { - type: "ClassDeclaration", - abstract: true, - body: ClassBody { - type: "ClassBody", - body: [ - MethodDefinition { - type: "MethodDefinition", - abstract: true, - computed: false, - key: Identifier { - type: "Identifier", - name: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - kind: "constructor", - static: false, - value: FunctionExpression { - type: "FunctionExpression", - async: false, - expression: false, - generator: false, - id: null, - params: [], - - range: [134, 137], - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - - range: [114, 137], - loc: { - start: { column: 2, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - ], - - range: [110, 139], - loc: { - start: { column: 37, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - id: Identifier { - type: "Identifier", - name: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - superClass: null, - - range: [80, 139], - loc: { - start: { column: 7, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - exportKind: "value", - source: null, - specifiers: [], - - range: [73, 139], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - ], - sourceType: "module", - - range: [73, 140], - loc: { - start: { column: 0, line: 3 }, - end: { column: 0, line: 6 }, - }, -} -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/4-Babel-Tokens.shot deleted file mode 100644 index a495e97a9ca..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/4-Babel-Tokens.shot +++ /dev/null @@ -1,116 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor Babel - Tokens 1`] = ` -[ - Keyword { - type: "Keyword", - value: "export", - - range: [73, 79], - loc: { - start: { column: 0, line: 3 }, - end: { column: 6, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [80, 88], - loc: { - start: { column: 7, line: 3 }, - end: { column: 15, line: 3 }, - }, - }, - Keyword { - type: "Keyword", - value: "class", - - range: [89, 94], - loc: { - start: { column: 16, line: 3 }, - end: { column: 21, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "AbstractSocket", - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "{", - - range: [110, 111], - loc: { - start: { column: 37, line: 3 }, - end: { column: 38, line: 3 }, - }, - }, - Identifier { - type: "Identifier", - value: "abstract", - - range: [114, 122], - loc: { - start: { column: 2, line: 4 }, - end: { column: 10, line: 4 }, - }, - }, - Identifier { - type: "Identifier", - value: "constructor", - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "(", - - range: [134, 135], - loc: { - start: { column: 22, line: 4 }, - end: { column: 23, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ")", - - range: [135, 136], - loc: { - start: { column: 23, line: 4 }, - end: { column: 24, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: ";", - - range: [136, 137], - loc: { - start: { column: 24, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - Punctuator { - type: "Punctuator", - value: "}", - - range: [138, 139], - loc: { - start: { column: 0, line: 5 }, - end: { column: 1, line: 5 }, - }, - }, -] -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/5-AST-Alignment-AST.shot deleted file mode 100644 index d6d511ccbfd..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/5-AST-Alignment-AST.shot +++ /dev/null @@ -1,108 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor AST Alignment - AST 1`] = ` -"Snapshot Diff: -- TSESTree -+ Babel - - Program { - type: 'Program', - body: Array [ - ExportNamedDeclaration { - type: 'ExportNamedDeclaration', - assertions: Array [], - declaration: ClassDeclaration { - type: 'ClassDeclaration', - abstract: true, - body: ClassBody { - type: 'ClassBody', - body: Array [ -- TSAbstractMethodDefinition { -- type: 'TSAbstractMethodDefinition', -+ MethodDefinition { -+ type: 'MethodDefinition', -+ abstract: true, - computed: false, - key: Identifier { - type: 'Identifier', - name: 'constructor', - - range: [123, 134], - loc: { - start: { column: 11, line: 4 }, - end: { column: 22, line: 4 }, - }, - }, - kind: 'constructor', -- override: false, - static: false, -- value: TSEmptyBodyFunctionExpression { -- type: 'TSEmptyBodyFunctionExpression', -+ value: FunctionExpression { -+ type: 'FunctionExpression', - async: false, -- body: null, - expression: false, - generator: false, - id: null, - params: Array [], - - range: [134, 137], - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - - range: [114, 137], - loc: { - start: { column: 2, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, - ], - - range: [110, 139], - loc: { - start: { column: 37, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - id: Identifier { - type: 'Identifier', - name: 'AbstractSocket', - - range: [95, 109], - loc: { - start: { column: 22, line: 3 }, - end: { column: 36, line: 3 }, - }, - }, - superClass: null, - - range: [80, 139], - loc: { - start: { column: 7, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - exportKind: 'value', - source: null, - specifiers: Array [], - - range: [73, 139], - loc: { - start: { column: 0, line: 3 }, - end: { column: 1, line: 5 }, - }, - }, - ], - sourceType: 'module', - - range: [73, 140], - loc: { - start: { column: 0, line: 3 }, - end: { column: 0, line: 6 }, - }, - }" -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/6-AST-Alignment-Tokens.shot deleted file mode 100644 index b5d33dfde11..00000000000 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/snapshots/6-AST-Alignment-Tokens.shot +++ /dev/null @@ -1,6 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constructor AST Alignment - Token 1`] = ` -"Snapshot Diff: -Compared values have no visual difference." -`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot index 7f16295a0ea..d9de87c19aa 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,12 @@ Program { TSAbstractMethodDefinition { type: "TSAbstractMethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "createSocket", + optional: false, range: [123, 135], loc: { @@ -27,12 +30,14 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: TSEmptyBodyFunctionExpression { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -41,17 +46,7 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Promise", - - range: [139, 146], - loc: { - start: { column: 27, line: 4 }, - end: { column: 34, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSStringKeyword { @@ -71,6 +66,18 @@ Program { end: { column: 42, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Promise", + optional: false, + + range: [139, 146], + loc: { + start: { column: 27, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, range: [139, 154], loc: { @@ -107,9 +114,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "AbstractSocket", + optional: false, range: [95, 109], loc: { @@ -117,6 +128,7 @@ Program { end: { column: 36, line: 3 }, }, }, + implements: [], superClass: null, range: [80, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot index cc059ebdd97..0ab1de91b9e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot @@ -23,9 +23,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method + type: 'MethodDefinition', + abstract: true, computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'createSocket', +- optional: false, range: [123, 135], loc: { @@ -34,6 +37,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method }, }, kind: 'method', +- optional: false, - override: false, static: false, - value: TSEmptyBodyFunctionExpression { @@ -42,6 +46,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -50,17 +55,18 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Promise', - - range: [139, 146], - loc: { - start: { column: 27, line: 4 }, - end: { column: 34, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Promise', ++ ++ range: [139, 146], ++ loc: { ++ start: { column: 27, line: 4 }, ++ end: { column: 34, line: 4 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSStringKeyword { @@ -78,6 +84,18 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method loc: { start: { column: 34, line: 4 }, end: { column: 42, line: 4 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Promise', +- optional: false, +- +- range: [139, 146], +- loc: { +- start: { column: 27, line: 4 }, +- end: { column: 34, line: 4 }, }, }, @@ -116,9 +134,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractSocket', +- optional: false, range: [95, 109], loc: { @@ -126,6 +148,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method end: { column: 36, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [80, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot index 6c1840dc9e4..b8501ee7b5b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [105, 108], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 14, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -38,9 +44,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [121, 124], loc: { @@ -48,7 +58,9 @@ Program { end: { column: 14, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -84,9 +96,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [88, 91], loc: { @@ -94,6 +110,7 @@ Program { end: { column: 18, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot index 4989b7b35d1..4948c148db4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [105, 108], loc: { @@ -31,7 +35,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 14, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -48,9 +54,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [121, 124], loc: { @@ -58,7 +68,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 14, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -94,9 +106,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [88, 91], loc: { @@ -104,6 +120,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 18, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot index 9fad85e674f..8fd60959945 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot @@ -15,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [121, 124], loc: { @@ -25,6 +29,7 @@ Program { end: { column: 30, line: 4 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -62,9 +67,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [88, 91], loc: { @@ -72,6 +81,7 @@ Program { end: { column: 18, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot index c7d5ecccd10..ee46582f5bd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot @@ -22,9 +22,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [121, 124], loc: { @@ -32,6 +36,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon end: { column: 30, line: 4 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -69,9 +74,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [88, 91], loc: { @@ -79,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon end: { column: 18, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot index fd55179386c..a96aff8a977 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop1", + optional: false, range: [118, 123], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,9 +62,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop2", + optional: false, range: [152, 157], loc: { @@ -66,7 +76,9 @@ Program { end: { column: 24, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -99,9 +111,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop3", + optional: false, range: [193, 198], loc: { @@ -109,7 +125,9 @@ Program { end: { column: 31, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -141,9 +159,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop4", + optional: false, range: [236, 241], loc: { @@ -151,6 +173,7 @@ Program { end: { column: 33, line: 7 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -185,9 +208,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop5", + optional: false, range: [286, 291], loc: { @@ -195,6 +222,7 @@ Program { end: { column: 40, line: 8 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -232,9 +260,13 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "AbstractDeclProps", + optional: false, range: [88, 105], loc: { @@ -242,6 +274,7 @@ Program { end: { column: 32, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 302], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot index e96ac30a3b5..74e0cfac27b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot @@ -18,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop1', +- optional: false, range: [118, 123], loc: { @@ -28,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -63,9 +69,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert + abstract: true, computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop2', +- optional: false, range: [152, 157], loc: { @@ -73,7 +83,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 24, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -109,9 +121,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop3', +- optional: false, range: [193, 198], loc: { @@ -119,7 +135,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 31, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -154,9 +172,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert + abstract: true, computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop4', +- optional: false, range: [236, 241], loc: { @@ -164,6 +186,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 33, line: 7 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -201,9 +224,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop5', +- optional: false, range: [286, 291], loc: { @@ -211,6 +238,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 40, line: 8 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -248,9 +276,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 1, line: 9 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractDeclProps', +- optional: false, range: [88, 105], loc: { @@ -258,6 +290,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 32, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 302], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot index 36e577536e3..391e52d7197 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "createSocket", + optional: false, range: [114, 126], loc: { @@ -34,6 +37,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -42,17 +46,7 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Promise", - - range: [131, 138], - loc: { - start: { column: 19, line: 4 }, - end: { column: 26, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSStringKeyword { @@ -72,6 +66,18 @@ Program { end: { column: 34, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Promise", + optional: false, + + range: [131, 138], + loc: { + start: { column: 19, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, range: [131, 146], loc: { @@ -108,9 +114,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "AbstractSocket", + optional: false, range: [95, 109], loc: { @@ -118,6 +128,7 @@ Program { end: { column: 36, line: 3 }, }, }, + implements: [], superClass: null, range: [80, 149], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot index ea291f87cbe..b706fb052fb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'createSocket', +- optional: false, range: [114, 126], loc: { @@ -40,6 +43,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -48,17 +52,18 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Promise', - - range: [131, 138], - loc: { - start: { column: 19, line: 4 }, - end: { column: 26, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Promise', ++ ++ range: [131, 138], ++ loc: { ++ start: { column: 19, line: 4 }, ++ end: { column: 26, line: 4 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSStringKeyword { @@ -78,7 +83,19 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method end: { column: 34, line: 4 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Promise', +- optional: false, +- range: [131, 138], +- loc: { +- start: { column: 19, line: 4 }, +- end: { column: 26, line: 4 }, +- }, +- }, +- range: [131, 146], loc: { start: { column: 19, line: 4 }, @@ -114,9 +131,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractSocket', +- optional: false, range: [95, 109], loc: { @@ -124,6 +145,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method end: { column: 36, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [80, 149], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot index a8f2d099a99..c1365d8d10e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot @@ -13,9 +13,12 @@ Program { TSAbstractMethodDefinition { type: "TSAbstractMethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "show", + optional: false, range: [153, 157], loc: { @@ -24,12 +27,14 @@ Program { }, }, kind: "method", + optional: false, override: true, static: false, value: TSEmptyBodyFunctionExpression { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -56,9 +61,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "SpecializedComponent", + optional: false, range: [88, 108], loc: { @@ -66,9 +75,12 @@ Program { end: { column: 35, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "SomeComponent", + optional: false, range: [117, 130], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot index a2123358d04..ef2f2ca4f2c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method + type: 'MethodDefinition', + abstract: true, computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'show', +- optional: false, range: [153, 157], loc: { @@ -31,6 +34,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method }, }, kind: 'method', +- optional: false, override: true, static: false, - value: TSEmptyBodyFunctionExpression { @@ -39,6 +43,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -65,9 +70,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [88, 108], loc: { @@ -75,9 +84,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method end: { column: 35, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [117, 130], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot index 66dc57f9ca4..e11949b56e6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "asserted2", + optional: false, range: [77, 86], loc: { @@ -31,7 +34,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "n", + optional: false, range: [111, 112], loc: { @@ -60,7 +65,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "n", + optional: false, range: [95, 96], loc: { @@ -100,6 +107,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 117], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot index 59f0d0c3ecd..54b416cc358 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,131 @@ exports[`AST Fixtures legacy-fixtures basics angle-bracket-type-assertion-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'asserted2', +- optional: false, + + range: [77, 86], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + init: TSTypeAssertion { + type: 'TSTypeAssertion', + expression: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'n', +- optional: false, + + range: [111, 112], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [104, 113], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ], + + range: [100, 115], + loc: { + start: { column: 27, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'n', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [95, 115], + loc: { + start: { column: 22, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [89, 116], + loc: { + start: { column: 16, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + + range: [77, 116], + loc: { + start: { column: 4, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot index cfebc39d3f1..0ac4e6b2c8c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -56,6 +59,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 92], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot index bebd2e1766f..84875d060dd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,83 @@ exports[`AST Fixtures legacy-fixtures basics angle-bracket-type-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [79, 82], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: TSTypeAssertion { + type: 'TSTypeAssertion', + expression: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [90, 91], + loc: { + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [85, 91], + loc: { + start: { column: 12, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [79, 91], + loc: { + start: { column: 6, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot index f48e3a53980..5343015ddd2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: [], name: "k", + optional: false, range: [82, 83], loc: { @@ -49,6 +51,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "k", optional: true, diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot index ca850e74214..bbd26b80e71 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,99 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-optional-parameter AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'k', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + operator: '+', + right: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'k', + optional: true, + + range: [75, 77], + loc: { + start: { column: 2, line: 3 }, + end: { column: 4, line: 3 }, + }, + }, + ], + + range: [74, 87], + loc: { + start: { column: 1, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + optional: false, + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot index c86c5ea688a..c417079cd49 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [100, 101], loc: { @@ -45,14 +47,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [80, 81], loc: { @@ -88,7 +94,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [84, 85], loc: { @@ -119,7 +127,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [74, 75], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index 7f4ad90fdb0..4d9cc58af3a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -20,7 +20,9 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [100, 101], loc: { @@ -49,14 +51,18 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [80, 81], loc: { @@ -92,7 +98,9 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [84, 85], loc: { @@ -123,7 +131,9 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'X', +- optional: false, - - range: [74, 75], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot index a0bf4fc41ac..acff3916587 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot @@ -22,11 +22,14 @@ Program { end: { column: 25, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [89, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot index 6db212a6049..cf09dbcceea 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,75 @@ exports[`AST Fixtures legacy-fixtures basics async-function-expression AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: FunctionExpression { + type: 'FunctionExpression', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [96, 98], + loc: { + start: { column: 23, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [89, 93], + loc: { + start: { column: 16, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + params: Array [], + + range: [74, 98], + loc: { + start: { column: 1, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + optional: false, + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot index 954ff56842f..e0143b85dbb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot @@ -15,9 +15,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [103, 106], loc: { @@ -44,6 +47,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [99, 115], @@ -57,9 +61,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [122, 125], loc: { @@ -86,6 +93,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [118, 134], @@ -99,9 +107,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "fooBar", + optional: false, range: [143, 149], loc: { @@ -128,6 +139,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [137, 161], @@ -144,11 +156,14 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [88, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot index f37f21626eb..d97c7ec99c2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,194 @@ exports[`AST Fixtures legacy-fixtures basics async-function-with-var-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [103, 106], + loc: { + start: { column: 6, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\'foo\\'', + value: 'foo', + + range: [109, 114], + loc: { + start: { column: 12, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [103, 114], + loc: { + start: { column: 6, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [99, 115], + loc: { + start: { column: 2, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [122, 125], + loc: { + start: { column: 6, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\'bar\\'', + value: 'bar', + + range: [128, 133], + loc: { + start: { column: 12, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [122, 133], + loc: { + start: { column: 6, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [118, 134], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fooBar', +- optional: false, + + range: [143, 149], + loc: { + start: { column: 8, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\'fooBar\\'', + value: 'fooBar', + + range: [152, 160], + loc: { + start: { column: 17, line: 6 }, + end: { column: 25, line: 6 }, + }, + }, + + range: [143, 160], + loc: { + start: { column: 8, line: 6 }, + end: { column: 25, line: 6 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [137, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 26, line: 6 }, + }, + }, + ], + + range: [95, 163], + loc: { + start: { column: 22, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [88, 92], + loc: { + start: { column: 15, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + params: Array [], + + range: [73, 163], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 164], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot index dae801b4eb5..6313e008f58 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -78,7 +83,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [89, 90], loc: { @@ -114,7 +121,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -168,7 +177,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [119, 120], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot index a60f0ce742c..98fb9a32021 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -29,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -84,7 +89,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [89, 90], - loc: { @@ -122,7 +129,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -177,7 +186,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [119, 120], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot index 0add00e20a1..9f701dde246 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -81,7 +86,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot index 33b93128e07..2710a0bc202 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures AST Alignment - AST body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -29,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures AST Alignment - AST + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -88,7 +93,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures AST Alignment - AST + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot index 2a7238338d7..0b739dd9aa9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [74, 75], loc: { @@ -23,7 +25,9 @@ Program { operator: "<", right: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot index 5a48762a733..dcef318b25b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,80 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-expression AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [74, 75], + loc: { + start: { column: 1, line: 3 }, + end: { column: 2, line: 3 }, + }, + }, + operator: '<', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + + range: [74, 79], + loc: { + start: { column: 1, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [84, 91], + loc: { + start: { column: 11, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot index 62a17423cc5..9c68eb96907 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "TSAsExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [74, 75], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot index a4c620a74b8..70b1609db0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-multi-assign AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: TSAsExpression { + type: 'TSAsExpression', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [74, 75], + loc: { + start: { column: 1, line: 3 }, + end: { column: 2, line: 3 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [79, 85], + loc: { + start: { column: 6, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [74, 85], + loc: { + start: { column: 1, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [89, 92], + loc: { + start: { column: 16, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [74, 92], + loc: { + start: { column: 1, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '42', + value: 42, + + range: [96, 98], + loc: { + start: { column: 23, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [73, 99], + loc: { + start: { column: 0, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot index a5279df235d..bbe6bf88a4f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "TSAsExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [73, 74], loc: { @@ -40,7 +42,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [85, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot index 38599adfe7f..7705dd06189 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,88 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-multi AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot index d18ab49c711..47510cad585 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [73, 74], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot index 4b0c8c0b06b..d8af856f0d4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '===', + right: TSAsExpression { + type: 'TSAsExpression', + expression: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [85, 91], + loc: { + start: { column: 12, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [80, 91], + loc: { + start: { column: 7, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot index 94188993637..77bae5e0fa4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -23,7 +26,9 @@ Program { type: "TSAsExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [85, 86], loc: { @@ -55,6 +60,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot index 2f9dfe1a235..a61cfb5f5e7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,84 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-simple AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [79, 82], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [79, 93], + loc: { + start: { column: 6, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot index 4fd32ac8851..2e62c98bccf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot @@ -31,7 +31,9 @@ Program { }, param: Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -98,7 +100,9 @@ Program { }, param: Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnknownKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot index 89b8eb95c59..9436e8fa208 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,157 @@ exports[`AST Fixtures legacy-fixtures basics catch-clause-with-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TryStatement { + type: 'TryStatement', + block: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 1, line: 4 }, + }, + }, + finalizer: null, + handler: CatchClause { + type: 'CatchClause', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [96, 98], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + param: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [91, 94], + loc: { + start: { column: 12, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [89, 94], + loc: { + start: { column: 10, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [88, 94], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [81, 98], + loc: { + start: { column: 2, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 4 }, + }, + }, + TryStatement { + type: 'TryStatement', + block: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [104, 107], + loc: { + start: { column: 4, line: 6 }, + end: { column: 1, line: 7 }, + }, + }, + finalizer: null, + handler: CatchClause { + type: 'CatchClause', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [127, 129], + loc: { + start: { column: 21, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + param: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnknownKeyword { + type: 'TSUnknownKeyword', + + range: [118, 125], + loc: { + start: { column: 12, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [116, 125], + loc: { + start: { column: 10, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [115, 125], + loc: { + start: { column: 9, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [108, 129], + loc: { + start: { column: 2, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [100, 129], + loc: { + start: { column: 0, line: 6 }, + end: { column: 23, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 130], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot index dd4a2c148a6..dc30f9f96cf 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot @@ -31,7 +31,9 @@ Program { }, param: Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot index ff4be300dbe..6aef5769b95 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,88 @@ exports[`AST Fixtures legacy-fixtures basics catch-clause-with-invalid-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TryStatement { + type: 'TryStatement', + block: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 1, line: 4 }, + }, + }, + finalizer: null, + handler: CatchClause { + type: 'CatchClause', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [99, 101], + loc: { + start: { column: 20, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + param: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [91, 97], + loc: { + start: { column: 12, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [89, 97], + loc: { + start: { column: 10, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [88, 97], + loc: { + start: { column: 9, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [81, 101], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 22, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot index 6658448bad0..ba043fdb916 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "ExpressionStatement", expression: Identifier { type: "Identifier", + decorators: [], name: "abstract", + optional: false, range: [73, 81], loc: { @@ -25,6 +27,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -35,9 +38,13 @@ Program { end: { column: 10, line: 4 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [89, 90], loc: { @@ -45,6 +52,7 @@ Program { end: { column: 7, line: 4 }, }, }, + implements: [], superClass: null, range: [83, 93], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot index c36526457e7..107bcb11f9a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,76 @@ exports[`AST Fixtures legacy-fixtures basics class-multi-line-keyword-abstract AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abstract', +- optional: false, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [91, 93], + loc: { + start: { column: 8, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [83, 93], + loc: { + start: { column: 0, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot index cbb19722f69..025639ca14b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "ExpressionStatement", expression: Identifier { type: "Identifier", + decorators: [], name: "declare", + optional: false, range: [73, 80], loc: { @@ -25,6 +27,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -35,9 +38,13 @@ Program { end: { column: 10, line: 4 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [88, 89], loc: { @@ -45,6 +52,7 @@ Program { end: { column: 7, line: 4 }, }, }, + implements: [], superClass: null, range: [82, 92], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot index 91ba03ff880..7b635aa1f26 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,76 @@ exports[`AST Fixtures legacy-fixtures basics class-multi-line-keyword-declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'declare', +- optional: false, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [90, 92], + loc: { + start: { column: 8, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [88, 89], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [82, 92], + loc: { + start: { column: 0, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot index 9ecd4e56189..37b23ebcae1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "priv1", @@ -23,7 +26,9 @@ Program { end: { column: 8, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -55,6 +60,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "priv2", @@ -65,7 +72,9 @@ Program { end: { column: 8, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -106,9 +115,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [128, 139], loc: { @@ -117,6 +129,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -193,6 +206,7 @@ Program { end: { column: 3, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -219,9 +233,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -229,6 +247,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 170], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot index 50e07fdec6a..8db2a072d5d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'priv1', @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 8, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -59,6 +64,8 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'priv2', @@ -69,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 8, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -110,9 +119,12 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [128, 139], loc: { @@ -121,6 +133,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -197,6 +210,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 3, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -223,9 +237,13 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -233,6 +251,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 170], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot index 321258d559b..6325a410ae2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "priv", @@ -23,6 +26,7 @@ Program { end: { column: 16, line: 4 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -60,9 +64,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -70,6 +78,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot index 4a94acfc12a..9a97960820e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'priv', @@ -27,6 +30,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f end: { column: 16, line: 4 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -64,9 +68,13 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -74,6 +82,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot index 3618d7741dc..b92ad626eef 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "count", + optional: false, range: [94, 99], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 14, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: Literal { type: "Literal", @@ -58,7 +65,9 @@ Program { type: "UpdateExpression", argument: Identifier { type: "Identifier", + decorators: [], name: "count", + optional: false, range: [149, 154], loc: { @@ -95,7 +104,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "someCondition", + optional: false, range: [124, 137], loc: { @@ -134,9 +145,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -144,6 +159,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 169], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot index c937657039c..ed9cb590a61 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'count', +- optional: false, range: [94, 99], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - end: { column: 14, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: Literal { type: 'Literal', @@ -62,7 +69,9 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - type: 'UpdateExpression', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'count', +- optional: false, range: [149, 154], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'someCondition', +- optional: false, range: [124, 137], loc: { @@ -138,9 +149,13 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -148,6 +163,7 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 169], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot index 65e19032f44..f579822acb1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [95, 98], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 13, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -57,9 +64,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [124, 127], loc: { @@ -67,7 +78,9 @@ Program { end: { column: 19, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -99,9 +112,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "getBar", + optional: false, range: [146, 152], loc: { @@ -110,6 +126,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -135,7 +152,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [173, 176], loc: { @@ -165,6 +184,7 @@ Program { end: { column: 3, line: 8 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -187,9 +207,12 @@ Program { type: "MethodDefinition", accessibility: "protected", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "setBar", + optional: false, range: [194, 200], loc: { @@ -198,6 +221,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -225,7 +249,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [225, 228], loc: { @@ -243,7 +269,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [231, 234], loc: { @@ -273,13 +301,16 @@ Program { end: { column: 3, line: 11 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -328,9 +359,13 @@ Program { end: { column: 1, line: 12 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -338,6 +373,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 241], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot index 3e92199a42e..bb1a1c4bac1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [95, 98], loc: { @@ -28,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 13, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -61,9 +68,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [124, 127], loc: { @@ -71,7 +82,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 19, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -103,9 +116,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'getBar', +- optional: false, range: [146, 152], loc: { @@ -114,6 +130,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -139,7 +156,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [173, 176], loc: { @@ -169,6 +188,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 3, line: 8 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -191,9 +211,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers type: 'MethodDefinition', accessibility: 'protected', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'setBar', +- optional: false, range: [194, 200], loc: { @@ -202,6 +225,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -229,7 +253,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [225, 228], loc: { @@ -247,7 +273,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers operator: '=', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [231, 234], loc: { @@ -277,13 +305,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 3, line: 11 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -332,9 +363,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 1, line: 12 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -342,6 +377,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 241], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot index 24585ee1091..998b6207d4c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,12 @@ Program { type: "MethodDefinition", accessibility: "protected", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [95, 106], loc: { @@ -24,6 +28,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -39,6 +44,7 @@ Program { end: { column: 28, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -61,6 +67,7 @@ Program { type: "MethodDefinition", accessibility: "public", computed: true, + decorators: [], key: Literal { type: "Literal", raw: "'constructor'", @@ -73,6 +80,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -88,6 +96,7 @@ Program { end: { column: 29, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -114,9 +123,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [79, 80], loc: { @@ -124,6 +137,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 144], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot index 9c0ef5e4b1d..4f9a53a7ec5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier type: 'MethodDefinition', accessibility: 'protected', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [95, 106], loc: { @@ -28,6 +32,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -43,6 +48,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 28, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -65,6 +71,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier type: 'MethodDefinition', accessibility: 'public', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\'constructor\\'', @@ -77,6 +84,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -92,6 +100,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 29, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -118,9 +127,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -128,6 +141,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 144], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot index e225d3f8406..dd0a87e7d3d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [126, 137], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 59, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,10 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: [], override: true, parameter: Identifier { type: "Identifier", + decorators: [], name: "param", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -75,6 +84,7 @@ Program { }, }, readonly: true, + static: false, range: [138, 179], loc: { @@ -105,9 +115,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -115,9 +129,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot index 1fad65fb13d..e9cb84b1934 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [126, 137], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 59, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,10 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], override: true, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'param', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -79,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete }, }, readonly: true, +- static: false, range: [138, 179], loc: { @@ -109,9 +119,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [79, 99], loc: { @@ -119,9 +133,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 26, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot index eb888a48f10..95679527f61 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [126, 137], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -68,16 +73,20 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ TSParameterProperty { type: "TSParameterProperty", + decorators: [], override: true, parameter: Identifier { type: "Identifier", + decorators: [], name: "param", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -103,6 +112,8 @@ Program { end: { column: 36, line: 4 }, }, }, + readonly: false, + static: false, range: [138, 160], loc: { @@ -133,9 +144,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -143,9 +158,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot index fa57caf9773..30ed3a5d2b9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [126, 137], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -72,16 +77,20 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ TSParameterProperty { type: 'TSParameterProperty', +- decorators: Array [], override: true, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'param', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -107,6 +116,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 36, line: 4 }, }, }, +- readonly: false, +- static: false, range: [138, 160], loc: { @@ -137,9 +148,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [79, 99], loc: { @@ -147,9 +162,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 26, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot index 142fe962316..468b1d834e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [85, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 26, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -77,6 +83,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Literal { type: "Literal", raw: "'constructor'", @@ -89,6 +96,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -104,6 +112,7 @@ Program { end: { column: 30, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -148,9 +157,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [79, 80], loc: { @@ -158,6 +171,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 143], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot index 15311f58669..23d2de9832a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [85, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 26, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -81,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\'constructor\\'', @@ -93,6 +100,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -108,6 +116,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 30, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -152,9 +161,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -162,6 +175,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 143], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot index 6f873dd9552..a467ad9004b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop1", + optional: false, range: [101, 106], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,9 +63,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop2", + optional: false, range: [133, 138], loc: { @@ -66,7 +77,9 @@ Program { end: { column: 22, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -98,9 +111,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop3", + optional: false, range: [165, 170], loc: { @@ -108,7 +125,9 @@ Program { end: { column: 22, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -140,9 +159,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop3", + optional: false, range: [199, 204], loc: { @@ -150,6 +173,7 @@ Program { end: { column: 24, line: 7 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -184,9 +208,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop4", + optional: false, range: [240, 245], loc: { @@ -194,6 +222,7 @@ Program { end: { column: 31, line: 8 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -228,9 +257,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop5", + optional: false, range: [279, 284], loc: { @@ -238,7 +271,9 @@ Program { end: { column: 29, line: 9 }, }, }, + optional: false, override: false, + readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -271,9 +306,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop6", + optional: false, range: [327, 332], loc: { @@ -281,6 +320,7 @@ Program { end: { column: 38, line: 10 }, }, }, + optional: false, override: false, readonly: true, static: true, @@ -318,9 +358,13 @@ Program { end: { column: 1, line: 11 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "DeclProps", + optional: false, range: [79, 88], loc: { @@ -328,6 +372,7 @@ Program { end: { column: 15, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 343], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot index 66ba0b55662..07399bd45ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop1', +- optional: false, range: [101, 106], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -60,9 +67,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop2', +- optional: false, range: [133, 138], loc: { @@ -70,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 22, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -102,9 +115,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop3', +- optional: false, range: [165, 170], loc: { @@ -112,7 +129,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 22, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -144,9 +163,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop3', +- optional: false, range: [199, 204], loc: { @@ -154,6 +177,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 24, line: 7 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -188,9 +212,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop4', +- optional: false, range: [240, 245], loc: { @@ -198,6 +226,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 31, line: 8 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -232,9 +261,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop5', +- optional: false, range: [279, 284], loc: { @@ -242,7 +275,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 29, line: 9 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -275,9 +310,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop6', +- optional: false, range: [327, 332], loc: { @@ -285,6 +324,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 38, line: 10 }, }, }, +- optional: false, - override: false, readonly: true, static: true, @@ -322,9 +362,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 1, line: 11 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'DeclProps', +- optional: false, range: [79, 88], loc: { @@ -332,6 +376,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 15, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 343], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot index 463c5cde7de..7f5aeb6fee1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,10 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], definite: true, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [85, 86], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 3, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -60,9 +66,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [79, 80], loc: { @@ -70,6 +80,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot index 12dd36c717a..21ac2c6a3ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,10 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], definite: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [85, 86], loc: { @@ -28,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST end: { column: 3, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -64,9 +70,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [79, 80], loc: { @@ -74,6 +84,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot index 52b855e6931..aec123dc3e0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 80, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "ClassWithParentAndInterface", + optional: false, range: [79, 106], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "MyInterface", + optional: false, range: [139, 150], loc: { @@ -49,7 +56,9 @@ Program { ], superClass: Identifier { type: "Identifier", + decorators: [], name: "MyOtherClass", + optional: false, range: [115, 127], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot index bb0b1427d25..9345b10e985 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A end: { column: 80, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'ClassWithParentAndInterface', +- optional: false, range: [79, 106], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MyInterface', +- optional: false, range: [139, 150], loc: { @@ -55,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A ], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MyOtherClass', +- optional: false, range: [115, 127], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot index cdbec66bb97..137500002d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 43, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [104, 107], loc: { @@ -36,14 +44,16 @@ Program { end: { column: 34, line: 3 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { + superTypeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [108, 109], loc: { @@ -62,7 +72,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "D", + optional: false, range: [111, 112], loc: { @@ -95,7 +107,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [93, 94], loc: { @@ -113,7 +127,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot index baf4e31b33b..1073c725f41 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple end: { column: 43, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [104, 107], loc: { @@ -40,14 +48,17 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple end: { column: 34, line: 3 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { +- superTypeArguments: TSTypeParameterInstantiation { ++ superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [108, 109], loc: { @@ -66,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'D', +- optional: false, range: [111, 112], loc: { @@ -99,7 +112,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [93, 94], loc: { @@ -117,7 +132,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot index 63825cb2349..3e3d64d818c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -36,14 +44,16 @@ Program { end: { column: 24, line: 3 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { + superTypeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [98, 99], loc: { @@ -75,7 +85,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot index ac7c601b7ec..ba394f6be49 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig end: { column: 30, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { @@ -40,14 +48,17 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig end: { column: 24, line: 3 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { +- superTypeArguments: TSTypeParameterInstantiation { ++ superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [98, 99], loc: { @@ -79,7 +90,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot index b6e4b7f8e22..88e4438bb06 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "getBar", + optional: false, range: [87, 93], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 22, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -52,7 +58,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [98, 101], loc: { @@ -70,7 +78,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [94, 95], loc: { @@ -116,9 +126,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -126,6 +140,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot index e9e2c7244b2..e58c25fa024 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'getBar', +- optional: false, range: [87, 93], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A end: { column: 22, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -56,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [98, 101], loc: { @@ -74,7 +82,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { @@ -123,9 +133,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -133,6 +147,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot index 6c852735c5a..952efb71175 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "getBar", + optional: false, range: [87, 93], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 16, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -51,7 +57,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [94, 95], loc: { @@ -97,9 +105,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -107,6 +119,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot index d823b4570e5..ebf99595a80 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'getBar', +- optional: false, range: [87, 93], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align end: { column: 16, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -55,7 +61,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { @@ -104,9 +112,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -114,6 +126,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot index da2c200699a..62bd5c01b74 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 33, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -39,14 +46,16 @@ Program { end: { column: 24, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "S", + optional: false, range: [98, 99], loc: { @@ -65,7 +74,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [101, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot index 41b0e58926b..9ac4c609f85 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi end: { column: 33, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { @@ -45,14 +52,17 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi end: { column: 24, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'S', +- optional: false, range: [98, 99], loc: { @@ -71,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [101, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot index f50ed36f922..056cda75ff6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -39,14 +46,16 @@ Program { end: { column: 24, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "S", + optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot index 74cc49838e1..861c924cb00 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A end: { column: 30, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { @@ -45,14 +52,17 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A end: { column: 24, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'S', +- optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot index 9bf39dac158..c632c3a9afa 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 27, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot index 67f56c86370..cbb9b19f345 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements AST Alignment end: { column: 27, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot index 86ecdb4e040..76c8fca6626 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [85, 88], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 18, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -77,9 +83,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [104, 107], loc: { @@ -88,6 +97,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -103,6 +113,7 @@ Program { end: { column: 13, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -116,7 +127,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [108, 109], loc: { @@ -157,9 +170,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [118, 121], loc: { @@ -168,6 +184,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -183,6 +200,7 @@ Program { end: { column: 10, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -209,9 +227,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [79, 80], loc: { @@ -219,6 +241,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot index 8b3757898e9..cd6eeae54ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [85, 88], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 18, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -81,9 +87,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [104, 107], loc: { @@ -92,6 +101,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -107,6 +117,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 13, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -120,7 +131,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [108, 109], - loc: { @@ -164,9 +177,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [118, 121], loc: { @@ -175,6 +191,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -190,6 +207,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 10, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -216,9 +234,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -226,6 +248,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot index 6b695ed3a9e..b9bbc841343 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 48, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "M", + optional: false, range: [82, 83], loc: { @@ -32,14 +35,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "Base", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [116, 117], loc: { @@ -77,24 +84,16 @@ Program { const: false, constraint: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Constructor", - - range: [94, 105], - loc: { - start: { column: 21, line: 3 }, - end: { column: 32, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "M", + optional: false, range: [106, 107], loc: { @@ -117,6 +116,18 @@ Program { end: { column: 35, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Constructor", + optional: false, + + range: [94, 105], + loc: { + start: { column: 21, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, range: [94, 108], loc: { @@ -127,7 +138,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot index f215d2b9478..18e0e9767af 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig end: { column: 48, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [82, 83], loc: { @@ -36,14 +39,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'Base', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [116, 117], loc: { @@ -81,24 +88,27 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig - const: false, constraint: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Constructor', - - range: [94, 105], - loc: { - start: { column: 21, line: 3 }, - end: { column: 32, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Constructor', ++ ++ range: [94, 105], ++ loc: { ++ start: { column: 21, line: 3 }, ++ end: { column: 32, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [106, 107], loc: { @@ -121,6 +131,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig end: { column: 35, line: 3 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Constructor', +- optional: false, +- +- range: [94, 105], +- loc: { +- start: { column: 21, line: 3 }, +- end: { column: 32, line: 3 }, +- }, +- }, range: [94, 108], loc: { @@ -131,7 +153,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot index e35887f9241..48529cb0405 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot @@ -14,6 +14,7 @@ Program { type: "ReturnStatement", argument: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -24,10 +25,15 @@ Program { end: { column: 30, line: 4 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "Base", + optional: false, range: [145, 149], loc: { @@ -57,11 +63,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "M", + optional: false, range: [82, 83], loc: { @@ -72,14 +81,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "Base", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [117, 118], loc: { @@ -117,17 +130,7 @@ Program { const: false, constraint: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Constructor", - - range: [94, 105], - loc: { - start: { column: 21, line: 3 }, - end: { column: 32, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeLiteral { @@ -148,6 +151,18 @@ Program { end: { column: 36, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Constructor", + optional: false, + + range: [94, 105], + loc: { + start: { column: 21, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, range: [94, 109], loc: { @@ -158,7 +173,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [84, 85], loc: { @@ -191,6 +208,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -201,9 +219,13 @@ Program { end: { column: 41, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [163, 164], loc: { @@ -216,7 +238,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "I", + optional: false, range: [194, 195], loc: { @@ -237,7 +261,9 @@ Program { arguments: [ Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [180, 181], loc: { @@ -248,7 +274,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "M", + optional: false, range: [173, 174], loc: { @@ -257,7 +285,7 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSAnyKeyword { @@ -293,6 +321,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -303,9 +332,13 @@ Program { end: { column: 10, line: 9 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [206, 207], loc: { @@ -313,6 +346,7 @@ Program { end: { column: 7, line: 9 }, }, }, + implements: [], superClass: null, range: [200, 210], @@ -333,9 +367,13 @@ Program { end: { column: 14, line: 10 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "I", + optional: false, range: [221, 222], loc: { @@ -352,9 +390,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Constructor", + optional: false, range: [231, 242], loc: { @@ -370,7 +411,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: [], name: "args", + optional: false, range: [256, 260], loc: { @@ -378,6 +421,8 @@ Program { end: { column: 34, line: 11 }, }, }, + decorators: [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSArrayType { @@ -419,7 +464,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [272, 273], loc: { @@ -457,7 +504,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [243, 244], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot index b113f663f51..4d5c6677152 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot @@ -18,6 +18,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'ReturnStatement', argument: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -28,10 +29,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 30, line: 4 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Base', +- optional: false, range: [145, 149], loc: { @@ -61,11 +67,14 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [82, 83], loc: { @@ -76,14 +85,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'Base', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [117, 118], loc: { @@ -121,17 +134,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS - const: false, constraint: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Constructor', - - range: [94, 105], - loc: { - start: { column: 21, line: 3 }, - end: { column: 32, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Constructor', ++ ++ range: [94, 105], ++ loc: { ++ start: { column: 21, line: 3 }, ++ end: { column: 32, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeLiteral { @@ -150,6 +164,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS loc: { start: { column: 32, line: 3 }, end: { column: 36, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Constructor', +- optional: false, +- +- range: [94, 105], +- loc: { +- start: { column: 21, line: 3 }, +- end: { column: 32, line: 3 }, }, }, @@ -162,7 +188,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { @@ -196,6 +224,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -206,9 +235,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 41, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [163, 164], loc: { @@ -223,7 +256,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'I', +- optional: false, range: [194, 195], loc: { @@ -244,7 +279,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS arguments: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [180, 181], loc: { @@ -255,7 +292,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [173, 174], loc: { @@ -264,7 +303,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSAnyKeyword { @@ -300,6 +340,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -310,9 +351,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 10, line: 9 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [206, 207], loc: { @@ -320,6 +365,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 7, line: 9 }, }, }, +- implements: Array [], superClass: null, range: [200, 210], @@ -340,9 +386,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 14, line: 10 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'I', +- optional: false, range: [221, 222], loc: { @@ -359,9 +409,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Constructor', +- optional: false, range: [231, 242], loc: { @@ -378,7 +431,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'args', +- optional: false, range: [256, 260], loc: { @@ -386,6 +441,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 34, line: 11 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSArrayType { @@ -428,7 +485,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [272, 273], loc: { @@ -466,7 +525,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [243, 244], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot index 8763d72bcca..7fa804c7c58 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "computed1", + optional: false, range: [79, 88], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 98], @@ -51,9 +55,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "computed2", + optional: false, range: [105, 114], loc: { @@ -80,6 +87,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [99, 124], @@ -93,9 +101,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "obj", + optional: false, range: [131, 134], loc: { @@ -111,7 +122,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "member", + optional: false, range: [141, 147], loc: { @@ -121,6 +134,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -145,7 +159,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "member2", + optional: false, range: [161, 168], loc: { @@ -155,6 +171,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -190,6 +207,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [125, 183], @@ -200,15 +218,19 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "computed1", + optional: false, range: [197, 206], loc: { @@ -224,6 +246,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -245,9 +268,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "computed2", + optional: false, range: [215, 224], loc: { @@ -272,6 +298,7 @@ Program { end: { column: 19, line: 11 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -293,6 +320,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Literal { type: "Literal", raw: "1", @@ -312,6 +340,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -333,6 +362,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Literal { type: "Literal", raw: "2", @@ -361,6 +391,7 @@ Program { end: { column: 11, line: 13 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -382,6 +413,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Literal { type: "Literal", raw: "'literal1'", @@ -401,6 +433,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -422,6 +455,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: Literal { type: "Literal", raw: "'literal2'", @@ -450,6 +484,7 @@ Program { end: { column: 20, line: 15 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -471,12 +506,15 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: MemberExpression { type: "MemberExpression", computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "obj", + optional: false, range: [297, 300], loc: { @@ -487,7 +525,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "member", + optional: false, range: [301, 307], loc: { @@ -519,6 +559,7 @@ Program { end: { column: 20, line: 16 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -540,12 +581,15 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: MemberExpression { type: "MemberExpression", computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "obj", + optional: false, range: [318, 321], loc: { @@ -556,7 +600,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "member2", + optional: false, range: [322, 329], loc: { @@ -579,6 +625,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -600,12 +647,15 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: [], key: CallExpression { type: "CallExpression", arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, range: [338, 339], loc: { @@ -638,6 +688,7 @@ Program { end: { column: 13, line: 18 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -664,9 +715,13 @@ Program { end: { column: 1, line: 19 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [190, 191], loc: { @@ -674,6 +729,7 @@ Program { end: { column: 7, line: 9 }, }, }, + implements: [], superClass: null, range: [184, 350], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot index e142bb454dc..6781e3075a2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed1', +- optional: false, range: [79, 88], loc: { @@ -42,6 +45,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, }, ], +- declare: false, kind: 'const', range: [73, 98], @@ -55,9 +59,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [105, 114], loc: { @@ -84,6 +91,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, }, ], +- declare: false, kind: 'const', range: [99, 124], @@ -97,9 +105,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [131, 134], loc: { @@ -115,7 +126,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member', +- optional: false, range: [141, 147], loc: { @@ -125,6 +138,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -149,7 +163,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member2', +- optional: false, range: [161, 168], loc: { @@ -159,6 +175,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -194,6 +211,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, }, ], +- declare: false, kind: 'const', range: [125, 183], @@ -204,15 +222,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed1', +- optional: false, range: [197, 206], loc: { @@ -230,6 +252,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -251,9 +274,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [215, 224], loc: { @@ -278,6 +304,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 19, line: 11 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -299,6 +326,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '1', @@ -320,6 +348,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -341,6 +370,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '2', @@ -369,6 +399,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 11, line: 13 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -390,6 +421,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\'literal1\\'', @@ -411,6 +443,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -432,6 +465,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\'literal2\\'', @@ -460,6 +494,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 20, line: 15 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -481,12 +516,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: MemberExpression { type: 'MemberExpression', computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [297, 300], loc: { @@ -497,7 +535,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member', +- optional: false, range: [301, 307], loc: { @@ -529,6 +569,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 20, line: 16 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -550,12 +591,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: MemberExpression { type: 'MemberExpression', computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [318, 321], loc: { @@ -566,7 +610,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member2', +- optional: false, range: [322, 329], loc: { @@ -591,6 +637,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -612,12 +659,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: CallExpression { type: 'CallExpression', arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, range: [338, 339], loc: { @@ -650,6 +700,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 13, line: 18 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -676,9 +727,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 1, line: 19 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [190, 191], loc: { @@ -686,6 +741,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 7, line: 9 }, }, }, +- implements: Array [], superClass: null, range: [184, 350], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot index 1443a0bda66..8227bc871a4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,6 +15,8 @@ Program { accessibility: "private", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "'foo'", @@ -27,10 +30,13 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: Identifier { type: "Identifier", + decorators: [], name: "undefined", + optional: false, range: [104, 113], loc: { @@ -53,9 +59,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [79, 80], loc: { @@ -63,6 +73,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot index 27d8a0ad1e4..959f8eb28d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,6 +19,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper accessibility: 'private', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\'foo\\'', @@ -31,10 +34,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper }, optional: true, - override: false, +- readonly: false, static: false, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [104, 113], loc: { @@ -57,9 +63,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [79, 80], loc: { @@ -67,6 +77,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot index f5565827c15..2c8c6549a92 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -30,6 +34,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -51,9 +56,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [97, 100], loc: { @@ -69,6 +77,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -109,9 +118,12 @@ Program { type: "MethodDefinition", accessibility: "private", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [123, 126], loc: { @@ -127,6 +139,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -171,9 +184,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -181,6 +198,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 140], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot index 9e3032b5695..d75b7e9bb3b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -36,6 +40,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -57,9 +62,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [97, 100], loc: { @@ -77,6 +85,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -117,9 +126,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali type: 'MethodDefinition', accessibility: 'private', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [123, 126], loc: { @@ -137,6 +149,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -181,9 +194,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -191,6 +208,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 140], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot index 22254044fb9..9a03b50c7b0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "computed", + optional: false, range: [79, 87], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 97], @@ -51,9 +55,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "computed2", + optional: false, range: [104, 113], loc: { @@ -80,6 +87,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [98, 123], @@ -90,6 +98,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -97,9 +106,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [138, 141], loc: { @@ -109,6 +122,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -122,9 +136,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [146, 149], loc: { @@ -134,6 +152,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -166,9 +185,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [170, 173], loc: { @@ -178,6 +201,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -209,9 +233,13 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "computed", + optional: false, range: [187, 195], loc: { @@ -221,6 +249,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -234,6 +263,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "'literal'", @@ -247,6 +278,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -260,6 +292,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "1", @@ -273,6 +307,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -286,9 +321,13 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "computed2", + optional: false, range: [226, 235], loc: { @@ -298,6 +337,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -329,6 +369,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "'literal2'", @@ -342,6 +384,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -373,6 +416,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "2", @@ -386,6 +431,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -421,9 +467,13 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [130, 133], loc: { @@ -431,6 +481,7 @@ Program { end: { column: 9, line: 5 }, }, }, + implements: [], superClass: null, range: [124, 289], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot index 47aa2d089f3..b581e542fbd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed', +- optional: false, range: [79, 87], loc: { @@ -42,6 +45,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, }, ], +- declare: false, kind: 'const', range: [73, 97], @@ -55,9 +59,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [104, 113], loc: { @@ -84,6 +91,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, }, ], +- declare: false, kind: 'const', range: [98, 123], @@ -94,6 +102,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -101,9 +110,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [138, 141], loc: { @@ -113,6 +126,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -126,9 +140,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [146, 149], loc: { @@ -138,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -170,9 +189,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [170, 173], loc: { @@ -182,6 +205,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -213,9 +237,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed', +- optional: false, range: [187, 195], loc: { @@ -225,6 +253,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -238,6 +267,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\'literal\\'', @@ -251,6 +282,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -264,6 +296,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '1', @@ -277,6 +311,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -290,9 +325,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [226, 235], loc: { @@ -302,6 +341,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -333,6 +373,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\'literal2\\'', @@ -346,6 +388,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -377,6 +420,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '2', @@ -390,6 +435,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -425,9 +471,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST end: { column: 1, line: 15 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [130, 133], loc: { @@ -435,6 +485,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST end: { column: 9, line: 5 }, }, }, +- implements: Array [], superClass: null, range: [124, 289], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot index 6abdce915ee..068063caace 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [93, 96], loc: { @@ -26,10 +31,13 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: Identifier { type: "Identifier", + decorators: [], name: "undefined", + optional: false, range: [100, 109], loc: { @@ -52,9 +60,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [79, 80], loc: { @@ -62,6 +74,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot index bf276da33e3..c720da83ff5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [93, 96], loc: { @@ -30,10 +35,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi }, optional: true, - override: false, +- readonly: false, static: false, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [100, 109], loc: { @@ -56,9 +64,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [79, 80], loc: { @@ -66,6 +78,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot index 6c360848e81..2197513374b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "show", + optional: false, range: [135, 139], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: true, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,9 +70,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -74,9 +84,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot index 6d916c72d85..1d2e6f791ee 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,119 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-method AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [ + MethodDefinition { + type: 'MethodDefinition', + computed: false, +- decorators: Array [], + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'show', +- optional: false, + + range: [135, 139], + loc: { + start: { column: 11, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + kind: 'method', +- optional: false, + override: true, + static: false, + value: FunctionExpression { + type: 'FunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [142, 158], + loc: { + start: { column: 18, line: 4 }, + end: { column: 3, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: null, + params: Array [], + + range: [139, 158], + loc: { + start: { column: 15, line: 4 }, + end: { column: 3, line: 6 }, + }, + }, + + range: [126, 158], + loc: { + start: { column: 2, line: 4 }, + end: { column: 3, line: 6 }, + }, + }, + ], + + range: [122, 160], + loc: { + start: { column: 49, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'SpecializedComponent', +- optional: false, + + range: [79, 99], + loc: { + start: { column: 6, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, +- implements: Array [], + superClass: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'SomeComponent', +- optional: false, + + range: [108, 121], + loc: { + start: { column: 35, line: 3 }, + end: { column: 48, line: 3 }, + }, + }, + + range: [73, 160], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 161], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot index 61da284abee..c45a39c6ed0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [135, 138], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 14, line: 4 }, }, }, + optional: false, override: true, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -61,9 +72,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot index 644f6e34e87..78cbdbf91c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [135, 138], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al end: { column: 14, line: 4 }, }, }, +- optional: false, override: true, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -55,9 +62,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [79, 99], loc: { @@ -65,9 +76,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al end: { column: 26, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot index 2345a59e245..136ce8c0a90 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "prop", @@ -25,6 +28,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,6 +60,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "propExplicitWithValue", @@ -68,6 +74,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -109,6 +116,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "propImplicitWithValue", @@ -121,6 +130,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -148,9 +158,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -158,6 +172,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 176], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot index 74230c6766a..69ea76bfb71 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'prop', @@ -29,6 +32,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -60,6 +64,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'propExplicitWithValue', @@ -72,6 +78,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -113,6 +120,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'propImplicitWithValue', @@ -125,6 +134,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert }, optional: true, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -152,9 +162,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -162,6 +176,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 176], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot index cc50481ad32..4f20f32c5f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 6, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,9 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,8 @@ Program { end: { column: 29, line: 5 }, }, }, + readonly: false, + static: false, range: [104, 129], loc: { @@ -83,9 +95,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { }, }, readonly: true, + static: false, range: [135, 168], loc: { @@ -122,11 +139,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -152,6 +174,7 @@ Program { end: { column: 23, line: 7 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "30", @@ -170,6 +193,8 @@ Program { end: { column: 28, line: 7 }, }, }, + readonly: false, + static: false, range: [174, 198], loc: { @@ -180,11 +205,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "student", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSBooleanKeyword { @@ -210,6 +240,7 @@ Program { end: { column: 37, line: 8 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "false", @@ -229,6 +260,7 @@ Program { }, }, readonly: true, + static: false, range: [204, 245], loc: { @@ -259,9 +291,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -269,6 +305,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 255], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot index ff7c7f9bdd3..e4442ac9ee3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 6, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,9 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 29, line: 5 }, }, }, +- readonly: false, +- static: false, range: [104, 129], loc: { @@ -87,9 +99,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper }, }, readonly: true, +- static: false, range: [135, 168], loc: { @@ -126,11 +143,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -156,6 +178,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 23, line: 7 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '30', @@ -174,6 +197,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 28, line: 7 }, }, }, +- readonly: false, +- static: false, range: [174, 198], loc: { @@ -184,11 +209,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'student', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSBooleanKeyword { @@ -214,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 37, line: 8 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: 'false', @@ -233,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper }, }, readonly: true, +- static: false, range: [204, 245], loc: { @@ -263,9 +295,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -273,6 +309,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 255], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot index 08731622aee..1b7cbd92319 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 5, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -116,9 +123,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [131, 134], loc: { @@ -126,7 +137,9 @@ Program { end: { column: 5, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -151,7 +164,9 @@ Program { async: false, body: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [151, 155], loc: { @@ -185,9 +200,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -195,6 +214,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 158], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot index bcee1481572..fb9a4cf2fd1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 5, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -122,9 +129,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [131, 134], loc: { @@ -132,7 +143,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 5, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -157,7 +170,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al async: false, body: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [151, 155], loc: { @@ -191,9 +206,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -201,6 +220,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 158], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot index 8c99f343cb7..b647ce5bec9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [87, 88], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 3, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -47,9 +54,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [96, 97], loc: { @@ -57,7 +68,9 @@ Program { end: { column: 3, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ObjectExpression { type: "ObjectExpression", @@ -80,9 +93,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [106, 107], loc: { @@ -90,7 +107,9 @@ Program { end: { column: 3, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrayExpression { type: "ArrayExpression", @@ -113,9 +132,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "d", + optional: false, range: [116, 117], loc: { @@ -123,7 +146,9 @@ Program { end: { column: 3, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -147,9 +172,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, range: [126, 127], loc: { @@ -157,7 +186,9 @@ Program { end: { column: 3, line: 8 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: NewExpression { type: "NewExpression", @@ -207,7 +238,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "Array", + optional: false, range: [134, 139], loc: { @@ -237,9 +270,13 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -247,6 +284,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot index 2994f248b8d..2e8c6d12881 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [87, 88], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -51,9 +58,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [96, 97], loc: { @@ -61,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ObjectExpression { type: 'ObjectExpression', @@ -84,9 +97,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [106, 107], loc: { @@ -94,7 +111,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrayExpression { type: 'ArrayExpression', @@ -117,9 +136,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [116, 117], loc: { @@ -127,7 +150,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -151,9 +176,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'e', +- optional: false, range: [126, 127], loc: { @@ -161,7 +190,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 8 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: NewExpression { type: 'NewExpression', @@ -211,7 +242,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [134, 139], loc: { @@ -241,9 +274,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 1, line: 9 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -251,6 +288,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot index 08f9c25204a..9d750889329 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 6, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,9 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,8 @@ Program { end: { column: 31, line: 5 }, }, }, + readonly: false, + static: false, range: [104, 131], loc: { @@ -83,9 +95,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { }, }, readonly: true, + static: false, range: [137, 172], loc: { @@ -122,11 +139,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -152,6 +174,7 @@ Program { end: { column: 25, line: 7 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "30", @@ -170,6 +193,8 @@ Program { end: { column: 30, line: 7 }, }, }, + readonly: false, + static: false, range: [178, 204], loc: { @@ -180,11 +205,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "student", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSBooleanKeyword { @@ -210,6 +240,7 @@ Program { end: { column: 39, line: 8 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "false", @@ -229,6 +260,7 @@ Program { }, }, readonly: true, + static: false, range: [210, 253], loc: { @@ -259,9 +291,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -269,6 +305,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 263], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot index 74a8495047c..ad237190d0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 6, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,9 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 31, line: 5 }, }, }, +- readonly: false, +- static: false, range: [104, 131], loc: { @@ -87,9 +99,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop }, }, readonly: true, +- static: false, range: [137, 172], loc: { @@ -126,11 +143,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -156,6 +178,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 25, line: 7 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '30', @@ -174,6 +197,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 30, line: 7 }, }, }, +- readonly: false, +- static: false, range: [178, 204], loc: { @@ -184,11 +209,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'student', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSBooleanKeyword { @@ -214,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 39, line: 8 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: 'false', @@ -233,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop }, }, readonly: true, +- static: false, range: [210, 253], loc: { @@ -263,9 +295,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -273,6 +309,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 263], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot index 8730d2fe21c..6203a0e5ab6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 6, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,9 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,8 @@ Program { end: { column: 28, line: 5 }, }, }, + readonly: false, + static: false, range: [104, 128], loc: { @@ -83,9 +95,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { }, }, readonly: true, + static: false, range: [134, 166], loc: { @@ -122,11 +139,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -152,6 +174,7 @@ Program { end: { column: 22, line: 7 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "30", @@ -170,6 +193,8 @@ Program { end: { column: 27, line: 7 }, }, }, + readonly: false, + static: false, range: [172, 195], loc: { @@ -180,11 +205,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "student", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSBooleanKeyword { @@ -210,6 +240,7 @@ Program { end: { column: 36, line: 8 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "false", @@ -229,6 +260,7 @@ Program { }, }, readonly: true, + static: false, range: [201, 241], loc: { @@ -259,9 +291,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -269,6 +305,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 251], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot index ce5f1910bb7..44c167b1a1e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 6, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,9 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 28, line: 5 }, }, }, +- readonly: false, +- static: false, range: [104, 128], loc: { @@ -87,9 +99,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert }, }, readonly: true, +- static: false, range: [134, 166], loc: { @@ -126,11 +143,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -156,6 +178,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 22, line: 7 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '30', @@ -174,6 +197,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 27, line: 7 }, }, }, +- readonly: false, +- static: false, range: [172, 195], loc: { @@ -184,11 +209,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'student', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSBooleanKeyword { @@ -214,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 36, line: 8 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: 'false', @@ -233,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert }, }, readonly: true, +- static: false, range: [201, 241], loc: { @@ -263,9 +295,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -273,6 +309,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 251], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot index 21c719fd677..a6f0867e59c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,15 +43,20 @@ Program { end: { column: 6, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ TSParameterProperty { type: "TSParameterProperty", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,7 @@ Program { }, }, readonly: true, + static: false, range: [104, 130], loc: { @@ -82,11 +93,16 @@ Program { }, TSParameterProperty { type: "TSParameterProperty", + decorators: [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { end: { column: 29, line: 6 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "'Smith'", @@ -131,6 +148,7 @@ Program { }, }, readonly: true, + static: false, range: [136, 171], loc: { @@ -161,9 +179,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -171,6 +193,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 181], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot index 1db770be545..1ca1af2cf8a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,15 +47,20 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 6, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ TSParameterProperty { type: 'TSParameterProperty', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, }, readonly: true, +- static: false, range: [104, 130], loc: { @@ -86,11 +97,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, TSParameterProperty { type: 'TSParameterProperty', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 29, line: 6 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '\\'Smith\\'', @@ -135,6 +152,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, }, readonly: true, +- static: false, range: [136, 171], loc: { @@ -165,9 +183,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -175,6 +197,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 181], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot index ca701f29c92..e88857f9766 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [103, 106], loc: { @@ -24,6 +29,7 @@ Program { end: { column: 21, line: 4 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -53,9 +59,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -63,6 +73,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot index 05e055f1868..f9625e1c3d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [103, 106], loc: { @@ -28,6 +33,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al end: { column: 21, line: 4 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -57,9 +63,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -67,6 +77,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot index bc32cf62cdc..5767b8e1490 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 21, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -37,7 +43,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [87, 90], loc: { @@ -55,7 +63,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot index 83d18346975..d240107e797 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A end: { column: 21, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -41,7 +47,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [87, 90], loc: { @@ -59,7 +67,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot index ab0d61339b4..aad8bbe2661 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 15, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [79, 80], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "__P", + optional: false, range: [81, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot index d4ed8c5b153..cba6e4ec96d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor end: { column: 15, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: '__P', +- optional: false, - - range: [81, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot index 2fc7b07e32f..5d3fe4d7fed 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 15, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot index 8a7308c52fc..8e9b7c04328 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align end: { column: 15, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot index 525ff8bf7da..6afdeed4fd3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot @@ -7,9 +7,12 @@ Program { TSEnumDeclaration { type: "TSEnumDeclaration", const: true, + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [84, 87], loc: { @@ -20,9 +23,12 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [92, 95], loc: { @@ -50,9 +56,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [103, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot index 51feccb1a78..3ca65220e22 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,99 @@ exports[`AST Fixtures legacy-fixtures basics const-enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', + const: true, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [84, 87], + loc: { + start: { column: 11, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [92, 95], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + initializer: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [98, 99], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [92, 99], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [103, 106], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + + range: [103, 106], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + ], + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot index ab799166a14..2db687cb7f9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [95, 98], loc: { @@ -30,6 +34,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -75,9 +80,12 @@ Program { }, }, declare: true, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [87, 90], loc: { @@ -85,6 +93,7 @@ Program { end: { column: 17, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot index 7d0c4c30d1a..ac37aadfa0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [95, 98], loc: { @@ -36,6 +40,7 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -81,9 +86,12 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method }, }, declare: true, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [87, 90], loc: { @@ -91,6 +99,7 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method end: { column: 17, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot index f85238b8cce..7d54f723e05 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [90, 93], loc: { @@ -23,7 +25,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot index 286d6f2f74f..ab61cdfdda6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,94 @@ exports[`AST Fixtures legacy-fixtures basics declare-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [99, 105], + loc: { + start: { column: 26, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + + range: [97, 105], + loc: { + start: { column: 24, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + + range: [94, 105], + loc: { + start: { column: 21, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [106, 114], + loc: { + start: { column: 33, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [73, 115], + loc: { + start: { column: 0, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 116], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot index 0208520f6fc..2b65620857e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot @@ -10,13 +10,17 @@ Program { type: "AssignmentExpression", left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -26,18 +30,24 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [85, 88], loc: { @@ -47,18 +57,24 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [92, 95], loc: { @@ -68,15 +84,20 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: ArrayPattern { type: "ArrayPattern", + decorators: [], elements: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [98, 99], loc: { @@ -86,15 +107,20 @@ Program { }, AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [103, 106], loc: { @@ -104,15 +130,20 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: ArrayPattern { type: "ArrayPattern", + decorators: [], elements: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [109, 110], loc: { @@ -121,6 +152,7 @@ Program { }, }, ], + optional: false, range: [108, 111], loc: { @@ -128,6 +160,7 @@ Program { end: { column: 35, line: 4 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: [ @@ -172,6 +205,7 @@ Program { end: { column: 43, line: 4 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: [ @@ -180,7 +214,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [124, 127], loc: { @@ -190,6 +226,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ArrayExpression { type: "ArrayExpression", @@ -236,6 +273,7 @@ Program { }, }, ], + optional: false, range: [97, 135], loc: { @@ -243,6 +281,7 @@ Program { end: { column: 59, line: 4 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: [], @@ -275,6 +314,7 @@ Program { end: { column: 66, line: 4 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: [], @@ -307,6 +347,7 @@ Program { end: { column: 73, line: 4 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: [], @@ -348,7 +389,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [162, 165], loc: { @@ -358,6 +401,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ObjectExpression { type: "ObjectExpression", @@ -367,7 +411,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [169, 172], loc: { @@ -377,6 +423,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ObjectExpression { type: "ObjectExpression", @@ -386,7 +433,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [176, 179], loc: { @@ -396,6 +445,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ArrayExpression { type: "ArrayExpression", @@ -419,7 +469,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [187, 190], loc: { @@ -429,6 +481,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ArrayExpression { type: "ArrayExpression", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot index 5dac5966e17..ccff1fdb997 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,602 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment-nested AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [85, 88], + loc: { + start: { column: 9, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [92, 95], + loc: { + start: { column: 16, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ArrayPattern { + type: 'ArrayPattern', +- decorators: Array [], + elements: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [98, 99], + loc: { + start: { column: 22, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [103, 106], + loc: { + start: { column: 27, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ArrayPattern { + type: 'ArrayPattern', +- decorators: Array [], + elements: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [109, 110], + loc: { + start: { column: 33, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, + ], +- optional: false, + + range: [108, 111], + loc: { + start: { column: 32, line: 4 }, + end: { column: 35, line: 4 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [115, 116], + loc: { + start: { column: 39, line: 4 }, + end: { column: 40, line: 4 }, + }, + }, + ], + + range: [114, 117], + loc: { + start: { column: 38, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + + range: [108, 117], + loc: { + start: { column: 32, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + + range: [103, 117], + loc: { + start: { column: 27, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + ], + + range: [101, 119], + loc: { + start: { column: 25, line: 4 }, + end: { column: 43, line: 4 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [124, 127], + loc: { + start: { column: 48, line: 4 }, + end: { column: 51, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [130, 131], + loc: { + start: { column: 54, line: 4 }, + end: { column: 55, line: 4 }, + }, + }, + ], + + range: [129, 132], + loc: { + start: { column: 53, line: 4 }, + end: { column: 56, line: 4 }, + }, + }, + + range: [124, 132], + loc: { + start: { column: 48, line: 4 }, + end: { column: 56, line: 4 }, + }, + }, + ], + + range: [122, 134], + loc: { + start: { column: 46, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + + range: [101, 134], + loc: { + start: { column: 25, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + ], +- optional: false, + + range: [97, 135], + loc: { + start: { column: 21, line: 4 }, + end: { column: 59, line: 4 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [138, 140], + loc: { + start: { column: 62, line: 4 }, + end: { column: 64, line: 4 }, + }, + }, + + range: [97, 140], + loc: { + start: { column: 21, line: 4 }, + end: { column: 64, line: 4 }, + }, + }, + + range: [92, 140], + loc: { + start: { column: 16, line: 4 }, + end: { column: 64, line: 4 }, + }, + }, + ], + + range: [90, 142], + loc: { + start: { column: 14, line: 4 }, + end: { column: 66, line: 4 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [], + + range: [145, 147], + loc: { + start: { column: 69, line: 4 }, + end: { column: 71, line: 4 }, + }, + }, + + range: [90, 147], + loc: { + start: { column: 14, line: 4 }, + end: { column: 71, line: 4 }, + }, + }, + + range: [85, 147], + loc: { + start: { column: 9, line: 4 }, + end: { column: 71, line: 4 }, + }, + }, + ], + + range: [83, 149], + loc: { + start: { column: 7, line: 4 }, + end: { column: 73, line: 4 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [], + + range: [152, 154], + loc: { + start: { column: 76, line: 4 }, + end: { column: 78, line: 4 }, + }, + }, + + range: [83, 154], + loc: { + start: { column: 7, line: 4 }, + end: { column: 78, line: 4 }, + }, + }, + + range: [78, 154], + loc: { + start: { column: 2, line: 4 }, + end: { column: 78, line: 4 }, + }, + }, + ], + + range: [74, 157], + loc: { + start: { column: 1, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + operator: '=', + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [162, 165], + loc: { + start: { column: 6, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [169, 172], + loc: { + start: { column: 13, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [176, 179], + loc: { + start: { column: 20, line: 5 }, + end: { column: 23, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [182, 183], + loc: { + start: { column: 26, line: 5 }, + end: { column: 27, line: 5 }, + }, + }, + ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [187, 190], + loc: { + start: { column: 31, line: 5 }, + end: { column: 34, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [193, 194], + loc: { + start: { column: 37, line: 5 }, + end: { column: 38, line: 5 }, + }, + }, + ], + + range: [192, 195], + loc: { + start: { column: 36, line: 5 }, + end: { column: 39, line: 5 }, + }, + }, + + range: [187, 195], + loc: { + start: { column: 31, line: 5 }, + end: { column: 39, line: 5 }, + }, + }, + ], + + range: [185, 197], + loc: { + start: { column: 29, line: 5 }, + end: { column: 41, line: 5 }, + }, + }, + ], + + range: [181, 198], + loc: { + start: { column: 25, line: 5 }, + end: { column: 42, line: 5 }, + }, + }, + + range: [176, 198], + loc: { + start: { column: 20, line: 5 }, + end: { column: 42, line: 5 }, + }, + }, + ], + + range: [174, 200], + loc: { + start: { column: 18, line: 5 }, + end: { column: 44, line: 5 }, + }, + }, + + range: [169, 200], + loc: { + start: { column: 13, line: 5 }, + end: { column: 44, line: 5 }, + }, + }, + ], + + range: [167, 202], + loc: { + start: { column: 11, line: 5 }, + end: { column: 46, line: 5 }, + }, + }, + + range: [162, 202], + loc: { + start: { column: 6, line: 5 }, + end: { column: 46, line: 5 }, + }, + }, + ], + + range: [160, 204], + loc: { + start: { column: 4, line: 5 }, + end: { column: 48, line: 5 }, + }, + }, + + range: [74, 204], + loc: { + start: { column: 1, line: 3 }, + end: { column: 48, line: 5 }, + }, + }, + + range: [73, 206], + loc: { + start: { column: 0, line: 3 }, + end: { column: 50, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 207], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot index 65038c760f7..10dd0ffe1bd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot @@ -10,13 +10,17 @@ Program { type: "AssignmentExpression", left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -26,12 +30,16 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -39,6 +47,7 @@ Program { end: { column: 6, line: 3 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: [], @@ -74,7 +83,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [89, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot index ae08e0c3a91..55963364596 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,122 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment-object AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [], + + range: [82, 84], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [74, 86], + loc: { + start: { column: 1, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + operator: '=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [89, 92], + loc: { + start: { column: 16, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [74, 92], + loc: { + start: { column: 1, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot index 64289d39b27..5621e6238f0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 35, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [82, 85], loc: { @@ -32,15 +35,20 @@ Program { params: [ AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [88, 91], loc: { @@ -50,12 +58,16 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [88, 91], loc: { @@ -63,6 +75,7 @@ Program { end: { column: 18, line: 3 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: [], @@ -95,9 +108,12 @@ Program { end: { column: 25, line: 3 }, }, }, + optional: false, right: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [101, 104], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot index c4b496ef856..d79e152fe48 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,151 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment-property AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [106, 108], + loc: { + start: { column: 33, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [94, 96], + loc: { + start: { column: 21, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [88, 96], + loc: { + start: { column: 15, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [88, 96], + loc: { + start: { column: 15, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [86, 98], + loc: { + start: { column: 13, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, +- optional: false, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [101, 104], + loc: { + start: { column: 28, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [86, 104], + loc: { + start: { column: 13, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + ], + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot index a62db8717c4..d3082546601 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot @@ -10,13 +10,17 @@ Program { type: "AssignmentExpression", left: ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -26,12 +30,16 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -39,6 +47,7 @@ Program { end: { column: 6, line: 3 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: [], @@ -74,7 +83,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [89, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot index 004656cc596..c3df90d7c07 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,122 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [82, 84], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [74, 86], + loc: { + start: { column: 1, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + operator: '=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [89, 92], + loc: { + start: { column: 16, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [74, 92], + loc: { + start: { column: 1, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot index f289b977ef4..7c05eb3cdd1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot @@ -35,9 +35,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [108, 109], loc: { @@ -64,6 +67,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [104, 114], @@ -100,9 +104,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot index 983df429af0..27076dd3da2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot @@ -39,9 +39,12 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-module AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [108, 109], loc: { @@ -68,6 +71,7 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-module AST Alignment - }, }, ], +- declare: false, kind: 'var', range: [104, 114], @@ -104,9 +108,13 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-module AST Alignment - end: { column: 1, line: 7 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..79bfb11b065 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-Babel-AST.shot @@ -0,0 +1,128 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics directive-in-namespace Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [ + ExpressionStatement { + type: "ExpressionStatement", + expression: Literal { + type: "Literal", + raw: "'use strict'", + value: "use strict", + + range: [91, 103], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [91, 104], + loc: { + start: { column: 2, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "a", + + range: [111, 112], + loc: { + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [115, 116], + loc: { + start: { column: 10, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [111, 116], + loc: { + start: { column: 6, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + ], + kind: "var", + + range: [107, 117], + loc: { + start: { column: 2, line: 5 }, + end: { column: 12, line: 5 }, + }, + }, + ExpressionStatement { + type: "ExpressionStatement", + expression: Literal { + type: "Literal", + raw: "'use strict'", + value: "use strict", + + range: [120, 132], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + + range: [120, 133], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + ], + + range: [87, 135], + loc: { + start: { column: 14, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [83, 86], + loc: { + start: { column: 10, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 135], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: "script", + + range: [73, 136], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, +} +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot index 034c7264069..548efbed006 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot @@ -35,9 +35,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [111, 112], loc: { @@ -64,6 +67,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [107, 117], @@ -100,9 +104,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..d3ffef96096 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/2-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures basics directive-in-namespace Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "namespace", + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [83, 86], + loc: { + start: { column: 10, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + String { + type: "String", + value: "'use strict'", + + range: [91, 103], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [103, 104], + loc: { + start: { column: 14, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + Keyword { + type: "Keyword", + value: "var", + + range: [107, 110], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [111, 112], + loc: { + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [113, 114], + loc: { + start: { column: 8, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [115, 116], + loc: { + start: { column: 10, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [116, 117], + loc: { + start: { column: 11, line: 5 }, + end: { column: 12, line: 5 }, + }, + }, + String { + type: "String", + value: "'use strict'", + + range: [120, 132], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [132, 133], + loc: { + start: { column: 14, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [134, 135], + loc: { + start: { column: 0, line: 7 }, + end: { column: 1, line: 7 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot index 75f2472ffbc..a087b50a382 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot @@ -39,9 +39,12 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-namespace AST Alignmen declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [111, 112], loc: { @@ -68,6 +71,7 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-namespace AST Alignmen }, }, ], +- declare: false, kind: 'var', range: [107, 117], @@ -104,9 +108,13 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-namespace AST Alignmen end: { column: 1, line: 7 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot index de0b160d2c8..75537c0edbd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "assert", + optional: false, range: [89, 95], loc: { @@ -26,6 +28,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ObjectExpression { type: "ObjectExpression", @@ -35,7 +38,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [99, 103], loc: { @@ -45,6 +50,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot index 30c981d13d0..e2f15f25d11 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,133 @@ exports[`AST Fixtures legacy-fixtures basics dynamic-import-with-import-assertions AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ImportExpression { + type: 'ImportExpression', + attributes: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assert', +- optional: false, + + range: [89, 95], + loc: { + start: { column: 16, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [99, 103], + loc: { + start: { column: 26, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\'json\\'', + value: 'json', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [99, 111], + loc: { + start: { column: 26, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [97, 113], + loc: { + start: { column: 24, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [89, 113], + loc: { + start: { column: 16, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + ], + + range: [87, 115], + loc: { + start: { column: 14, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + source: Literal { + type: 'Literal', + raw: '\\'foo\\'', + value: 'foo', + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [73, 116], + loc: { + start: { column: 0, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot index 91065f7d377..370da199472 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [102, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot index 2993c4da95d..58f3e3de323 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,75 @@ exports[`AST Fixtures legacy-fixtures basics export-all-with-import-assertions AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [102, 106], + loc: { + start: { column: 29, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\'json\\'', + value: 'json', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [102, 114], + loc: { + start: { column: 29, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + exported: null, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [87, 92], + loc: { + start: { column: 14, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot index 85787e9178f..1b635af9404 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSNamespaceExportDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [93, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot index aa1998499a4..7eb5256b921 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,40 @@ exports[`AST Fixtures legacy-fixtures basics export-as-namespace AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSNamespaceExportDeclaration { + type: 'TSNamespaceExportDeclaration', + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [93, 94], + loc: { + start: { column: 20, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 96], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot index 8c71fbb0d3c..0445aaa8063 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSExportAssignment", expression: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [82, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/3-Babel-AST.shot index 7f6c1be4872..53765d7d18d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/3-Babel-AST.shot @@ -24,7 +24,7 @@ Program { }, }, ], - sourceType: "script", + sourceType: "module", range: [73, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot index 06a9e4da38e..0b1e4523efb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures legacy-fixtures basics export-assignment AST Alignment - A type: 'TSExportAssignment', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [82, 85], loc: { @@ -28,8 +30,7 @@ exports[`AST Fixtures legacy-fixtures basics export-assignment AST Alignment - A }, }, ], -- sourceType: 'module', -+ sourceType: 'script', + sourceType: 'module', range: [73, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot index acd54640c92..f1169f5926c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot @@ -13,7 +13,9 @@ Program { declare: true, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [99, 102], loc: { @@ -24,9 +26,12 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [107, 110], loc: { @@ -54,9 +59,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [118, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot index 5dced47878b..b3b73fdb401 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -17,7 +17,9 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-const-named-enum AST declare: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [99, 102], loc: { @@ -28,9 +30,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-const-named-enum AST members: Array [ TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [107, 110], loc: { @@ -58,9 +63,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-const-named-enum AST }, TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [118, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot index 1981d24b541..3b057de32f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot @@ -9,10 +9,13 @@ Program { assertions: [], declaration: TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, declare: true, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [93, 96], loc: { @@ -23,9 +26,12 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [101, 104], loc: { @@ -53,9 +59,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [112, 115], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot index 73d878a12ec..2d768bbf61b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -13,10 +13,13 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-named-enum AST Align assertions: Array [], declaration: TSEnumDeclaration { type: 'TSEnumDeclaration', +- const: false, declare: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [93, 96], loc: { @@ -27,9 +30,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-named-enum AST Align members: Array [ TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [101, 104], loc: { @@ -57,9 +63,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-named-enum AST Align }, TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [112, 115], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot index f14b54d6f6f..02a82deb45f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 26, line: 3 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -29,7 +33,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [94, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot index 64dc9ab9f6f..cac3d3b9bad 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-generic A type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-generic A end: { column: 26, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -33,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-generic A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot index d89a9df30ad..5e0be290b4a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 29, line: 3 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -29,7 +33,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [94, 95], loc: { @@ -51,7 +57,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [97, 98], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot index 77a16a4302d..420e9c2ef19 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- end: { column: 29, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -33,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { @@ -56,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [97, 98], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot index 8123d01f3ce..89ac186b96d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "method1", + optional: false, range: [104, 111], loc: { @@ -25,7 +27,9 @@ Program { }, }, kind: "method", + optional: false, params: [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -44,6 +48,7 @@ Program { end: { column: 17, line: 4 }, }, }, + static: false, range: [104, 120], loc: { @@ -59,9 +64,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot index 201605ce2b5..28434626438 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot @@ -20,7 +20,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method1', +- optional: false, range: [104, 111], loc: { @@ -29,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm }, }, kind: 'method', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -50,6 +54,7 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm end: { column: 17, line: 4 }, }, }, +- static: false, range: [104, 120], loc: { @@ -65,9 +70,13 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot index 7422a63cf75..937557783da 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -19,9 +20,13 @@ Program { end: { column: 22, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -29,6 +34,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -39,7 +45,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [90, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot index 45815b0a978..cd249e319cc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,6 +13,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -23,9 +24,13 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST end: { column: 22, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -33,6 +38,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -43,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [90, 91], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot index 2691f90e0a9..efc242f4dfd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -19,9 +20,13 @@ Program { end: { column: 25, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -29,6 +34,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -39,7 +45,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [90, 91], loc: { @@ -61,7 +69,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [93, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot index cafef05a22f..122e2a3401f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot @@ -13,6 +13,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -23,9 +24,13 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge end: { column: 25, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -33,6 +38,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -43,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [90, 91], - loc: { @@ -66,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [93, 94], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot index 0f3b8723891..cb3489f2b02 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,13 @@ Program { assertions: [], declaration: TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [85, 88], loc: { @@ -22,9 +26,12 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [93, 96], loc: { @@ -52,9 +59,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [104, 107], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot index 596d7bfe356..1471fe30127 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,112 @@ exports[`AST Fixtures legacy-fixtures basics export-named-enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [85, 88], + loc: { + start: { column: 12, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + initializer: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [99, 100], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [93, 100], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [104, 107], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + + range: [104, 107], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + ], + + range: [80, 110], + loc: { + start: { column: 7, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot index db21ea31228..20335c1996f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { assertions: [], exported: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot index b102f45164b..e6b5545d6af 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,53 @@ exports[`AST Fixtures legacy-fixtures basics export-star-as-ns-from AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [], + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [85, 88], + loc: { + start: { column: 12, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'bar\\'', + value: 'bar', + + range: [94, 99], + loc: { + start: { column: 21, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot index 4d3b0b70ad0..afa8b170882 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [92, 93], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot index 8526243ea23..c9dea6f3214 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-as AST Alignment - AST type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [92, 93], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-as AST Alignment - AST exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot index d3ce9d5bfab..ddf7996e773 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot @@ -25,7 +25,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [92, 93], loc: { @@ -36,7 +38,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot index c56c283e493..0192033c168 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot @@ -29,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from-as AST Alignment - type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [92, 93], loc: { @@ -40,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from-as AST Alignment - exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot index 4b41be24d98..4c12ca941c0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot @@ -25,7 +25,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -36,7 +38,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot index 66480f7b11f..47d6b2af6f2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot @@ -29,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from AST Alignment - AS type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -40,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from AST Alignment - AS exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot index 8cc6dd16978..017fb0f7bed 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot index dca27176e25..b34ddb187f6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type AST Alignment - AST 1`] type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type AST Alignment - AST 1`] exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot index a517f7dd0c1..098ac45c234 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "obj", + optional: false, range: [77, 80], loc: { @@ -29,7 +32,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [118, 119], loc: { @@ -52,13 +57,16 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -94,7 +102,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [93, 94], loc: { @@ -133,6 +143,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index 5f19d6e96e4..48c04d40f70 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [77, 80], loc: { @@ -33,7 +36,9 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [118, 119], loc: { @@ -56,13 +61,16 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -98,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [93, 94], - loc: { @@ -138,6 +148,7 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet }, }, ], +- declare: false, kind: 'var', range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot index e321751787b..cb7cfa02368 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "obj", + optional: false, range: [77, 80], loc: { @@ -32,6 +35,7 @@ Program { end: { column: 30, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -69,6 +73,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot index 9fe3b48e456..98998cbaa44 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures legacy-fixtures basics function-anynomus-with-return-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'obj', +- optional: false, + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + init: FunctionExpression { + type: 'FunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [101, 103], + loc: { + start: { column: 28, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: null, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [96, 100], + loc: { + start: { column: 23, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [94, 100], + loc: { + start: { column: 21, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [83, 103], + loc: { + start: { column: 10, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + + range: [77, 103], + loc: { + start: { column: 4, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 104], + loc: { + start: { column: 0, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 105], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot index 3a08ae46217..7472805c426 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot @@ -10,11 +10,14 @@ Program { declaration: TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, range: [89, 90], loc: { @@ -25,7 +28,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -93,11 +98,14 @@ Program { declaration: TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, range: [127, 128], loc: { @@ -108,7 +116,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -183,7 +193,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [215, 216], loc: { @@ -206,11 +218,14 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, range: [165, 166], loc: { @@ -221,7 +236,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot index 76b94490a41..4af306c530c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,355 @@ exports[`AST Fixtures legacy-fixtures basics function-overloads AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'f', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [94, 100], + loc: { + start: { column: 21, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [92, 100], + loc: { + start: { column: 19, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [91, 100], + loc: { + start: { column: 18, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [103, 109], + loc: { + start: { column: 30, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + + range: [101, 109], + loc: { + start: { column: 28, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + + range: [80, 110], + loc: { + start: { column: 7, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'f', +- optional: false, + + range: [127, 128], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [132, 138], + loc: { + start: { column: 21, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + + range: [130, 138], + loc: { + start: { column: 19, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + + range: [129, 138], + loc: { + start: { column: 18, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [141, 147], + loc: { + start: { column: 30, line: 4 }, + end: { column: 36, line: 4 }, + }, + }, + + range: [139, 147], + loc: { + start: { column: 28, line: 4 }, + end: { column: 36, line: 4 }, + }, + }, + + range: [118, 148], + loc: { + start: { column: 7, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [111, 148], + loc: { + start: { column: 0, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [215, 216], + loc: { + start: { column: 9, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + + range: [208, 217], + loc: { + start: { column: 2, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + ], + + range: [204, 219], + loc: { + start: { column: 55, line: 5 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'f', +- optional: false, + + range: [165, 166], + loc: { + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [170, 176], + loc: { + start: { column: 21, line: 5 }, + end: { column: 27, line: 5 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [179, 185], + loc: { + start: { column: 30, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + ], + + range: [170, 185], + loc: { + start: { column: 21, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + + range: [168, 185], + loc: { + start: { column: 19, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + + range: [167, 185], + loc: { + start: { column: 18, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [188, 194], + loc: { + start: { column: 39, line: 5 }, + end: { column: 45, line: 5 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [197, 203], + loc: { + start: { column: 48, line: 5 }, + end: { column: 54, line: 5 }, + }, + }, + ], + + range: [188, 203], + loc: { + start: { column: 39, line: 5 }, + end: { column: 54, line: 5 }, + }, + }, + + range: [186, 203], + loc: { + start: { column: 37, line: 5 }, + end: { column: 54, line: 5 }, + }, + }, + + range: [156, 219], + loc: { + start: { column: 7, line: 5 }, + end: { column: 1, line: 7 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [149, 219], + loc: { + start: { column: 0, line: 5 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 220], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot index cc8333d69f8..ea042f62a70 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { type: "AwaitExpression", argument: Identifier { type: "Identifier", + decorators: [], name: "future", + optional: false, range: [111, 117], loc: { @@ -46,11 +48,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "hope", + optional: false, range: [88, 92], loc: { @@ -61,7 +66,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "future", + optional: false, range: [93, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot index 101a3738026..bb4bbd0d6a1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,99 @@ exports[`AST Fixtures legacy-fixtures basics function-with-await AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AwaitExpression { + type: 'AwaitExpression', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'future', +- optional: false, + + range: [111, 117], + loc: { + start: { column: 8, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [105, 117], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [105, 118], + loc: { + start: { column: 2, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + ], + + range: [101, 120], + loc: { + start: { column: 28, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'hope', +- optional: false, + + range: [88, 92], + loc: { + start: { column: 15, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'future', +- optional: false, + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [73, 120], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 121], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot index ceac643045d..0b4da9c4e48 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 53, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -32,13 +35,17 @@ Program { params: [ ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -48,10 +55,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -71,7 +81,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -81,10 +93,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -110,7 +125,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [102, 105], loc: { @@ -119,6 +136,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -149,7 +168,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [116, 119], loc: { @@ -158,6 +179,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, range: [116, 120], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot index d8a406bb7e9..9403dbbd2a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,233 @@ exports[`AST Fixtures legacy-fixtures basics function-with-object-type-with-optional-properties AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [124, 126], + loc: { + start: { column: 51, line: 3 }, + end: { column: 53, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [102, 105], + loc: { + start: { column: 29, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + optional: true, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [106, 114], + loc: { + start: { column: 33, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [116, 119], + loc: { + start: { column: 43, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + optional: true, +- readonly: false, +- static: false, + + range: [116, 120], + loc: { + start: { column: 43, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], + + range: [100, 122], + loc: { + start: { column: 27, line: 3 }, + end: { column: 49, line: 3 }, + }, + }, + + range: [98, 122], + loc: { + start: { column: 25, line: 3 }, + end: { column: 49, line: 3 }, + }, + }, + + range: [86, 122], + loc: { + start: { column: 13, line: 3 }, + end: { column: 49, line: 3 }, + }, + }, + ], + + range: [73, 126], + loc: { + start: { column: 0, line: 3 }, + end: { column: 53, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 127], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot index fdcd9f2678e..79b756b9373 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 51, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -32,13 +35,17 @@ Program { params: [ ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -48,10 +55,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -71,7 +81,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -81,10 +93,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -110,7 +125,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [102, 105], loc: { @@ -118,6 +135,9 @@ Program { end: { column: 32, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -148,7 +168,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [115, 118], loc: { @@ -156,6 +178,9 @@ Program { end: { column: 45, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, range: [115, 118], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot index 3f1b0bd4bc4..71841138211 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,233 @@ exports[`AST Fixtures legacy-fixtures basics function-with-object-type-without-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [122, 124], + loc: { + start: { column: 49, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [102, 105], + loc: { + start: { column: 29, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [107, 113], + loc: { + start: { column: 34, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [105, 113], + loc: { + start: { column: 32, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [102, 114], + loc: { + start: { column: 29, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [115, 118], + loc: { + start: { column: 42, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [115, 118], + loc: { + start: { column: 42, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], + + range: [100, 120], + loc: { + start: { column: 27, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [98, 120], + loc: { + start: { column: 25, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [86, 120], + loc: { + start: { column: 13, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], + + range: [73, 124], + loc: { + start: { column: 0, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 125], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot index d11b181c592..f6ea490cce3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 36, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "compare", + optional: false, range: [82, 89], loc: { @@ -39,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [102, 103], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot index c096db788aa..af719ee6a52 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-that- end: { column: 36, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'compare', +- optional: false, range: [82, 89], loc: { @@ -43,7 +46,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-that- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [102, 103], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot index 90107e35f6d..7335f353134 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [118, 119], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [82, 83], loc: { @@ -52,14 +57,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [101, 102], loc: { @@ -95,7 +104,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [105, 106], loc: { @@ -136,7 +147,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot index 76444e06f3c..958d02dbd05 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [118, 119], loc: { @@ -41,11 +43,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [82, 83], loc: { @@ -56,14 +61,18 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [101, 102], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [105, 106], loc: { @@ -140,7 +151,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'X', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot index 3bf1239b820..359f76eafd5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [107, 108], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [82, 83], loc: { @@ -52,14 +57,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [90, 91], loc: { @@ -95,7 +104,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [94, 95], loc: { @@ -126,7 +137,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index a47e9957bd9..efeb1329956 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [107, 108], loc: { @@ -41,11 +43,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [82, 83], loc: { @@ -56,14 +61,18 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [90, 91], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [94, 95], loc: { @@ -130,7 +141,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'X', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot index 28a1cf6468a..989c307d098 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, range: [174, 178], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "message", + optional: false, range: [82, 89], loc: { @@ -52,7 +57,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -80,9 +87,12 @@ Program { }, AssignmentPattern { type: "AssignmentPattern", + decorators: [], left: Identifier { type: "Identifier", + decorators: [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -108,6 +118,7 @@ Program { end: { column: 13, line: 5 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "100", @@ -130,7 +141,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: [], name: "args", + optional: false, range: [133, 137], loc: { @@ -138,21 +151,13 @@ Program { end: { column: 9, line: 6 }, }, }, + decorators: [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [139, 144], - loc: { - start: { column: 11, line: 6 }, - end: { column: 16, line: 6 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSStringKeyword { @@ -172,6 +177,18 @@ Program { end: { column: 24, line: 6 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [139, 144], + loc: { + start: { column: 11, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, range: [139, 152], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot index 71bd9bfc1f1..19856aa2f16 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,262 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + + range: [174, 178], + loc: { + start: { column: 9, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + + range: [167, 179], + loc: { + start: { column: 2, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + ], + + range: [163, 181], + loc: { + start: { column: 10, line: 7 }, + end: { column: 1, line: 9 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'message', +- optional: false, + + range: [82, 89], + loc: { + start: { column: 9, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [99, 105], + loc: { + start: { column: 8, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [97, 105], + loc: { + start: { column: 6, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [93, 105], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'age', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [114, 120], + loc: { + start: { column: 7, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [112, 120], + loc: { + start: { column: 5, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [109, 120], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, +- optional: false, + right: Literal { + type: 'Literal', + raw: '100', + value: 100, + + range: [123, 126], + loc: { + start: { column: 16, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [109, 126], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + RestElement { + type: 'RestElement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'args', +- optional: false, + + range: [133, 137], + loc: { + start: { column: 5, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, +- decorators: Array [], +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [139, 144], ++ loc: { ++ start: { column: 11, line: 6 }, ++ end: { column: 16, line: 6 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [145, 151], + loc: { + start: { column: 17, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + ], + + range: [144, 152], + loc: { + start: { column: 16, line: 6 }, + end: { column: 24, line: 6 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- +- range: [139, 144], +- loc: { +- start: { column: 11, line: 6 }, +- end: { column: 16, line: 6 }, + }, + }, + + range: [139, 152], + loc: { + start: { column: 11, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + + range: [137, 152], + loc: { + start: { column: 9, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + + range: [130, 152], + loc: { + start: { column: 2, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [156, 162], + loc: { + start: { column: 3, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [154, 162], + loc: { + start: { column: 1, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [73, 181], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 9 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 182], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 10 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot index 146b379f5ba..1e6617e87dc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, range: [123, 127], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "message", + optional: false, range: [82, 89], loc: { @@ -52,7 +57,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot index 9de6b201868..590df108c3b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,126 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + + range: [123, 127], + loc: { + start: { column: 9, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [116, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ], + + range: [112, 130], + loc: { + start: { column: 39, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'message', +- optional: false, + + range: [82, 89], + loc: { + start: { column: 9, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [94, 102], + loc: { + start: { column: 21, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [90, 102], + loc: { + start: { column: 17, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [103, 111], + loc: { + start: { column: 30, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [73, 130], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 131], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot index dac7d52338c..fcd4699e4b3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "abc", + optional: false, range: [99, 102], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [95, 109], @@ -55,7 +59,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "globalThis", + optional: false, range: [142, 152], loc: { @@ -66,7 +72,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "abc", + optional: false, range: [153, 156], loc: { @@ -112,9 +120,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "answer", + optional: false, range: [169, 175], loc: { @@ -141,6 +152,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [165, 181], @@ -158,7 +170,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "globalThis", + optional: false, range: [250, 260], loc: { @@ -169,7 +183,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "answer", + optional: false, range: [261, 267], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot index cb8e3363dc5..30ab32a0a4f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,241 @@ exports[`AST Fixtures legacy-fixtures basics global-this AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abc', +- optional: false, + + range: [99, 102], + loc: { + start: { column: 4, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '100', + value: 100, + + range: [105, 108], + loc: { + start: { column: 10, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [99, 108], + loc: { + start: { column: 4, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [95, 109], + loc: { + start: { column: 0, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'globalThis', +- optional: false, + + range: [142, 152], + loc: { + start: { column: 0, line: 8 }, + end: { column: 10, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abc', +- optional: false, + + range: [153, 156], + loc: { + start: { column: 11, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + + range: [142, 156], + loc: { + start: { column: 0, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '200', + value: 200, + + range: [159, 162], + loc: { + start: { column: 17, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [142, 162], + loc: { + start: { column: 0, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [142, 163], + loc: { + start: { column: 0, line: 8 }, + end: { column: 21, line: 8 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'answer', +- optional: false, + + range: [169, 175], + loc: { + start: { column: 4, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '42', + value: 42, + + range: [178, 180], + loc: { + start: { column: 13, line: 10 }, + end: { column: 15, line: 10 }, + }, + }, + + range: [169, 180], + loc: { + start: { column: 4, line: 10 }, + end: { column: 15, line: 10 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [165, 181], + loc: { + start: { column: 0, line: 10 }, + end: { column: 16, line: 10 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'globalThis', +- optional: false, + + range: [250, 260], + loc: { + start: { column: 0, line: 13 }, + end: { column: 10, line: 13 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'answer', +- optional: false, + + range: [261, 267], + loc: { + start: { column: 11, line: 13 }, + end: { column: 17, line: 13 }, + }, + }, + + range: [250, 267], + loc: { + start: { column: 0, line: 13 }, + end: { column: 17, line: 13 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '333333', + value: 333333, + + range: [270, 276], + loc: { + start: { column: 20, line: 13 }, + end: { column: 26, line: 13 }, + }, + }, + + range: [250, 276], + loc: { + start: { column: 0, line: 13 }, + end: { column: 26, line: 13 }, + }, + }, + + range: [250, 277], + loc: { + start: { column: 0, line: 13 }, + end: { column: 27, line: 13 }, + }, + }, + ], + sourceType: 'script', + + range: [95, 278], + loc: { + start: { column: 0, line: 5 }, + end: { column: 0, line: 14 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot index 66d593436f1..a536f4a1981 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [80, 83], loc: { @@ -17,7 +19,6 @@ Program { }, }, importKind: "value", - isExport: false, moduleReference: TSExternalModuleReference { type: "TSExternalModuleReference", expression: Literal { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/3-Babel-AST.shot index 6787ff3d03c..05bcdb4eb26 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/3-Babel-AST.shot @@ -46,7 +46,7 @@ Program { }, }, ], - sourceType: "script", + sourceType: "module", range: [73, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot index 9e99b2d139b..39420f9e369 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-declaration AST Alignm type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [80, 83], loc: { @@ -21,7 +23,7 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-declaration AST Alignm }, }, importKind: 'value', - isExport: false, ++ isExport: false, moduleReference: TSExternalModuleReference { type: 'TSExternalModuleReference', expression: Literal { @@ -50,8 +52,7 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-declaration AST Alignm }, }, ], -- sourceType: 'module', -+ sourceType: 'script', + sourceType: 'module', range: [73, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot index 2c76c91d63b..f679d5877a0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [85, 88], loc: { @@ -17,7 +19,6 @@ Program { }, }, importKind: "type", - isExport: false, moduleReference: TSExternalModuleReference { type: "TSExternalModuleReference", expression: Literal { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/3-Babel-AST.shot index 1583d2ccfb7..9984261a972 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/3-Babel-AST.shot @@ -46,7 +46,7 @@ Program { }, }, ], - sourceType: "script", + sourceType: "module", range: [73, 107], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot index 38dd0ac42d6..77adb8004d0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-type-declaration AST A type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [85, 88], loc: { @@ -21,7 +23,7 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-type-declaration AST A }, }, importKind: 'type', - isExport: false, ++ isExport: false, moduleReference: TSExternalModuleReference { type: 'TSExternalModuleReference', expression: Literal { @@ -50,8 +52,7 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-type-declaration AST A }, }, ], -- sourceType: 'module', -+ sourceType: 'script', + sourceType: 'module', range: [73, 107], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot index 1f3bcfef849..0d8da7b441e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot @@ -4,40 +4,54 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-declaration TSE Program { type: "Program", body: [ - TSImportEqualsDeclaration { - type: "TSImportEqualsDeclaration", - id: Identifier { - type: "Identifier", - name: "foo", + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: [], + declaration: TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, - range: [87, 90], - loc: { - start: { column: 14, line: 3 }, - end: { column: 17, line: 3 }, + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, }, - }, - importKind: "value", - isExport: true, - moduleReference: TSExternalModuleReference { - type: "TSExternalModuleReference", - expression: Literal { - type: "Literal", - raw: "'bar'", - value: "bar", + importKind: "value", + moduleReference: TSExternalModuleReference { + type: "TSExternalModuleReference", + expression: Literal { + type: "Literal", + raw: "'bar'", + value: "bar", + + range: [101, 106], + loc: { + start: { column: 28, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, - range: [101, 106], + range: [93, 107], loc: { - start: { column: 28, line: 3 }, - end: { column: 33, line: 3 }, + start: { column: 20, line: 3 }, + end: { column: 34, line: 3 }, }, }, - range: [93, 107], + range: [80, 108], loc: { - start: { column: 20, line: 3 }, - end: { column: 34, line: 3 }, + start: { column: 7, line: 3 }, + end: { column: 35, line: 3 }, }, }, + exportKind: "value", + source: null, + specifiers: [], range: [73, 108], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/3-Babel-AST.shot index 9705cc0221d..fade9373835 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/3-Babel-AST.shot @@ -46,7 +46,7 @@ Program { }, }, ], - sourceType: "script", + sourceType: "module", range: [73, 109], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot index a8124bb4264..51f7701bb76 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot @@ -8,40 +8,78 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-declaration AST Program { type: 'Program', body: Array [ - TSImportEqualsDeclaration { - type: 'TSImportEqualsDeclaration', - id: Identifier { - type: 'Identifier', - name: 'foo', +- ExportNamedDeclaration { +- type: 'ExportNamedDeclaration', +- assertions: Array [], +- declaration: TSImportEqualsDeclaration { +- type: 'TSImportEqualsDeclaration', +- id: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'foo', +- optional: false, ++ TSImportEqualsDeclaration { ++ type: 'TSImportEqualsDeclaration', ++ id: Identifier { ++ type: 'Identifier', ++ name: 'foo', - range: [87, 90], - loc: { - start: { column: 14, line: 3 }, - end: { column: 17, line: 3 }, +- range: [87, 90], +- loc: { +- start: { column: 14, line: 3 }, +- end: { column: 17, line: 3 }, +- }, ++ range: [87, 90], ++ loc: { ++ start: { column: 14, line: 3 }, ++ end: { column: 17, line: 3 }, }, - }, - importKind: 'value', - isExport: true, - moduleReference: TSExternalModuleReference { - type: 'TSExternalModuleReference', - expression: Literal { - type: 'Literal', - raw: '\\'bar\\'', - value: 'bar', +- importKind: 'value', +- moduleReference: TSExternalModuleReference { +- type: 'TSExternalModuleReference', +- expression: Literal { +- type: 'Literal', +- raw: '\\'bar\\'', +- value: 'bar', ++ }, ++ importKind: 'value', ++ isExport: true, ++ moduleReference: TSExternalModuleReference { ++ type: 'TSExternalModuleReference', ++ expression: Literal { ++ type: 'Literal', ++ raw: '\\'bar\\'', ++ value: 'bar', - range: [101, 106], +- range: [101, 106], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 33, line: 3 }, +- }, +- }, +- +- range: [93, 107], ++ range: [101, 106], loc: { - start: { column: 28, line: 3 }, - end: { column: 33, line: 3 }, +- start: { column: 20, line: 3 }, +- end: { column: 34, line: 3 }, ++ start: { column: 28, line: 3 }, ++ end: { column: 33, line: 3 }, }, }, - range: [93, 107], +- range: [80, 108], ++ range: [93, 107], loc: { - start: { column: 20, line: 3 }, - end: { column: 34, line: 3 }, +- start: { column: 7, line: 3 }, +- end: { column: 35, line: 3 }, ++ start: { column: 20, line: 3 }, ++ end: { column: 34, line: 3 }, }, }, +- exportKind: 'value', +- source: null, +- specifiers: Array [], range: [73, 108], loc: { @@ -50,8 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-declaration AST }, }, ], -- sourceType: 'module', -+ sourceType: 'script', + sourceType: 'module', range: [73, 109], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot index a05c975eae4..a518cab77f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot @@ -4,40 +4,54 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-type-declaratio Program { type: "Program", body: [ - TSImportEqualsDeclaration { - type: "TSImportEqualsDeclaration", - id: Identifier { - type: "Identifier", - name: "foo", + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: [], + declaration: TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + decorators: [], + name: "foo", + optional: false, - range: [92, 95], - loc: { - start: { column: 19, line: 3 }, - end: { column: 22, line: 3 }, + range: [92, 95], + loc: { + start: { column: 19, line: 3 }, + end: { column: 22, line: 3 }, + }, }, - }, - importKind: "type", - isExport: true, - moduleReference: TSExternalModuleReference { - type: "TSExternalModuleReference", - expression: Literal { - type: "Literal", - raw: "'bar'", - value: "bar", + importKind: "type", + moduleReference: TSExternalModuleReference { + type: "TSExternalModuleReference", + expression: Literal { + type: "Literal", + raw: "'bar'", + value: "bar", + + range: [106, 111], + loc: { + start: { column: 33, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, - range: [106, 111], + range: [98, 112], loc: { - start: { column: 33, line: 3 }, - end: { column: 38, line: 3 }, + start: { column: 25, line: 3 }, + end: { column: 39, line: 3 }, }, }, - range: [98, 112], + range: [80, 113], loc: { - start: { column: 25, line: 3 }, - end: { column: 39, line: 3 }, + start: { column: 7, line: 3 }, + end: { column: 40, line: 3 }, }, }, + exportKind: "value", + source: null, + specifiers: [], range: [73, 113], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/3-Babel-AST.shot index c048f7a5d9c..1f864c4f111 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/3-Babel-AST.shot @@ -46,7 +46,7 @@ Program { }, }, ], - sourceType: "script", + sourceType: "module", range: [73, 114], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot index 94fa819efc7..da9c9aa685e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot @@ -8,40 +8,78 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-type-declaratio Program { type: 'Program', body: Array [ - TSImportEqualsDeclaration { - type: 'TSImportEqualsDeclaration', - id: Identifier { - type: 'Identifier', - name: 'foo', +- ExportNamedDeclaration { +- type: 'ExportNamedDeclaration', +- assertions: Array [], +- declaration: TSImportEqualsDeclaration { +- type: 'TSImportEqualsDeclaration', +- id: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'foo', +- optional: false, ++ TSImportEqualsDeclaration { ++ type: 'TSImportEqualsDeclaration', ++ id: Identifier { ++ type: 'Identifier', ++ name: 'foo', - range: [92, 95], - loc: { - start: { column: 19, line: 3 }, - end: { column: 22, line: 3 }, +- range: [92, 95], +- loc: { +- start: { column: 19, line: 3 }, +- end: { column: 22, line: 3 }, +- }, ++ range: [92, 95], ++ loc: { ++ start: { column: 19, line: 3 }, ++ end: { column: 22, line: 3 }, }, - }, - importKind: 'type', - isExport: true, - moduleReference: TSExternalModuleReference { - type: 'TSExternalModuleReference', - expression: Literal { - type: 'Literal', - raw: '\\'bar\\'', - value: 'bar', +- importKind: 'type', +- moduleReference: TSExternalModuleReference { +- type: 'TSExternalModuleReference', +- expression: Literal { +- type: 'Literal', +- raw: '\\'bar\\'', +- value: 'bar', ++ }, ++ importKind: 'type', ++ isExport: true, ++ moduleReference: TSExternalModuleReference { ++ type: 'TSExternalModuleReference', ++ expression: Literal { ++ type: 'Literal', ++ raw: '\\'bar\\'', ++ value: 'bar', - range: [106, 111], +- range: [106, 111], +- loc: { +- start: { column: 33, line: 3 }, +- end: { column: 38, line: 3 }, +- }, +- }, +- +- range: [98, 112], ++ range: [106, 111], loc: { - start: { column: 33, line: 3 }, - end: { column: 38, line: 3 }, +- start: { column: 25, line: 3 }, +- end: { column: 39, line: 3 }, ++ start: { column: 33, line: 3 }, ++ end: { column: 38, line: 3 }, }, }, - range: [98, 112], +- range: [80, 113], ++ range: [98, 112], loc: { - start: { column: 25, line: 3 }, - end: { column: 39, line: 3 }, +- start: { column: 7, line: 3 }, +- end: { column: 40, line: 3 }, ++ start: { column: 25, line: 3 }, ++ end: { column: 39, line: 3 }, }, }, +- exportKind: 'value', +- source: null, +- specifiers: Array [], range: [73, 113], loc: { @@ -50,8 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-type-declaratio }, }, ], -- sourceType: 'module', -+ sourceType: 'script', + sourceType: 'module', range: [73, 114], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot index ca33471e646..4388729bbf1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot index 27e47052260..5775e847e8a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-default AST Alignment - type: 'ImportDefaultSpecifier', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot index fadbb01b229..ee238f4d3eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [135, 139], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot index c7fc07efd94..bf6a7ff8209 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,64 @@ exports[`AST Fixtures legacy-fixtures basics import-type-empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'./foo\\'', + value: './foo', + + range: [145, 152], + loc: { + start: { column: 17, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [135, 139], + loc: { + start: { column: 7, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [135, 139], + loc: { + start: { column: 7, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ], + + range: [128, 153], + loc: { + start: { column: 0, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, + ], + sourceType: 'module', + + range: [128, 154], + loc: { + start: { column: 0, line: 4 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot index 92cbbe233f4..3331ec4e3a4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot index 460aa5f7e67..61bb15fad45 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named-as AST Alignment type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -39,7 +41,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named-as AST Alignment importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot index 68df555343c..c9cf66adce7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -54,7 +58,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [92, 95], loc: { @@ -65,7 +71,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot index 3260482a080..3f0bb385ba5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -39,7 +41,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -58,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [92, 95], loc: { @@ -69,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot index fe2b766c1de..539671c284e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportNamespaceSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [90, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot index 222cc519cf2..91d204bd4e3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-star-as-ns AST Alignmen type: 'ImportNamespaceSpecifier', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [90, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot index e209625b60b..fa59b2d0163 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [104, 108], loc: { @@ -55,7 +57,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot index 5c25cc16fb8..d14ea9b3058 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures legacy-fixtures basics import-with-import-assertions AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [104, 108], + loc: { + start: { column: 31, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\'json\\'', + value: 'json', + + range: [110, 116], + loc: { + start: { column: 37, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + + range: [104, 116], + loc: { + start: { column: 31, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [89, 94], + loc: { + start: { column: 16, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [80, 83], + loc: { + start: { column: 7, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [80, 83], + loc: { + start: { column: 7, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + + range: [73, 119], + loc: { + start: { column: 0, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 120], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot index 882f1eedc2a..b861b28c6b1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 33, line: 3 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [95, 98], loc: { @@ -40,7 +43,9 @@ Program { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "Baz", + optional: false, range: [100, 103], loc: { @@ -58,7 +63,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot index 6826fae73fb..2b7e65472a4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig end: { column: 33, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [95, 98], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Baz', +- optional: false, range: [100, 103], loc: { @@ -66,7 +71,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot index 681e29188f4..3370dec4082 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 28, line: 3 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [95, 98], loc: { @@ -39,7 +42,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot index 5d2ae168cc4..a1f3cec6078 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends AST Alignment - A end: { column: 28, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends AST Alignment - A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [95, 98], loc: { @@ -45,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends AST Alignment - A ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot index 63dc3c4c7b2..9e5f0b8ea1d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 19, line: 3 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [83, 86], loc: { @@ -35,7 +39,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot index d4403d29158..62517a85070 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-type-parameters AST Align end: { column: 19, line: 3 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-type-parameters AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [87, 88], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot index 541d9420d02..c78ebfa17e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baa", + optional: false, range: [91, 94], loc: { @@ -22,6 +24,9 @@ Program { end: { column: 5, line: 4 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -52,7 +57,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [106, 109], loc: { @@ -61,6 +68,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -91,7 +100,9 @@ Program { computed: true, key: Identifier { type: "Identifier", + decorators: [], name: "bax", + optional: false, range: [123, 126], loc: { @@ -99,6 +110,9 @@ Program { end: { column: 6, line: 6 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -129,7 +143,9 @@ Program { computed: true, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [140, 143], loc: { @@ -138,6 +154,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -168,7 +186,9 @@ Program { parameters: [ Identifier { type: "Identifier", + decorators: [], name: "eee", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -195,6 +215,8 @@ Program { }, }, ], + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -225,7 +247,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "doo", + optional: false, range: [182, 185], loc: { @@ -234,7 +258,9 @@ Program { }, }, kind: "method", + optional: false, params: [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -253,6 +279,7 @@ Program { end: { column: 13, line: 9 }, }, }, + static: false, range: [182, 194], loc: { @@ -265,7 +292,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "coo", + optional: false, range: [197, 200], loc: { @@ -278,7 +307,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [202, 203], loc: { @@ -288,7 +319,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [205, 206], loc: { @@ -298,7 +331,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [208, 209], loc: { @@ -307,6 +342,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -325,6 +361,7 @@ Program { end: { column: 21, line: 10 }, }, }, + static: false, range: [197, 217], loc: { @@ -337,7 +374,9 @@ Program { computed: true, key: Identifier { type: "Identifier", + decorators: [], name: "loo", + optional: false, range: [221, 224], loc: { @@ -350,7 +389,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [227, 228], loc: { @@ -360,7 +401,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [230, 231], loc: { @@ -370,7 +413,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [233, 234], loc: { @@ -379,6 +424,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -397,6 +443,7 @@ Program { end: { column: 23, line: 11 }, }, }, + static: false, range: [220, 242], loc: { @@ -409,7 +456,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "boo", + optional: false, range: [245, 248], loc: { @@ -418,10 +467,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [252, 253], loc: { @@ -431,7 +483,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [255, 256], loc: { @@ -441,7 +495,9 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [258, 259], loc: { @@ -450,6 +506,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -468,6 +525,7 @@ Program { end: { column: 23, line: 12 }, }, }, + static: false, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", params: [ @@ -477,7 +535,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "J", + optional: false, range: [249, 250], loc: { @@ -513,7 +573,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [275, 276], loc: { @@ -523,6 +585,7 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", optional: true, @@ -563,7 +626,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [301, 302], loc: { @@ -573,6 +638,7 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", optional: true, @@ -610,7 +676,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "F", + optional: false, range: [298, 299], loc: { @@ -649,9 +717,13 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot index 11ec84abe7f..1a53a43b60f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baa', +- optional: false, range: [91, 94], loc: { @@ -26,6 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 5, line: 4 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -56,7 +61,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [106, 109], loc: { @@ -65,6 +72,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, optional: true, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -95,7 +104,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bax', +- optional: false, range: [123, 126], loc: { @@ -103,6 +114,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 6, line: 6 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -133,7 +147,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [140, 143], loc: { @@ -142,6 +158,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, optional: true, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -172,7 +190,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'eee', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -199,6 +219,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -229,7 +251,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'doo', +- optional: false, range: [182, 185], loc: { @@ -238,7 +262,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, kind: 'method', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -259,6 +285,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 13, line: 9 }, }, }, +- static: false, range: [182, 194], loc: { @@ -271,7 +298,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'coo', +- optional: false, range: [197, 200], loc: { @@ -285,7 +314,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [202, 203], loc: { @@ -295,7 +326,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [205, 206], loc: { @@ -305,7 +338,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [208, 209], loc: { @@ -314,6 +349,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -333,6 +369,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 21, line: 10 }, }, }, +- static: false, range: [197, 217], loc: { @@ -345,7 +382,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'loo', +- optional: false, range: [221, 224], loc: { @@ -359,7 +398,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [227, 228], loc: { @@ -369,7 +410,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [230, 231], loc: { @@ -379,7 +422,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [233, 234], loc: { @@ -388,6 +433,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -407,6 +453,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 23, line: 11 }, }, }, +- static: false, range: [220, 242], loc: { @@ -419,7 +466,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boo', +- optional: false, range: [245, 248], loc: { @@ -428,11 +477,14 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [252, 253], loc: { @@ -442,7 +494,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [255, 256], loc: { @@ -452,7 +506,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [258, 259], loc: { @@ -461,6 +517,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -480,6 +537,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 23, line: 12 }, }, }, +- static: false, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', params: Array [ @@ -489,7 +547,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'J', +- optional: false, - - range: [249, 250], - loc: { @@ -527,7 +587,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [275, 276], loc: { @@ -537,6 +599,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, @@ -579,7 +642,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [301, 302], loc: { @@ -589,6 +654,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, @@ -627,7 +693,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'F', +- optional: false, - - range: [298, 299], - loc: { @@ -667,9 +735,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 1, line: 15 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot index 73d72215073..7d18cbbf9f1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,7 @@ Program { end: { column: 32, line: 3 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", @@ -24,7 +25,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [95, 98], loc: { @@ -35,7 +38,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [99, 102], loc: { @@ -60,7 +65,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot index 815cf476af7..cfc7b70c381 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre end: { column: 32, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -33,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre + type: 'TSQualifiedName', + left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [95, 98], loc: { @@ -45,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre - property: Identifier { + right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [99, 102], loc: { @@ -70,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot index 4b171d07041..effb1a6217b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 34, line: 3 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [98, 101], loc: { @@ -29,14 +32,16 @@ Program { end: { column: 28, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "J", + optional: false, range: [102, 103], loc: { @@ -69,7 +74,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [83, 86], loc: { @@ -86,7 +93,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot index c4fc663d9e2..e4ba39d31cb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet end: { column: 34, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [98, 101], loc: { @@ -35,14 +38,17 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet end: { column: 28, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'J', +- optional: false, range: [102, 103], loc: { @@ -75,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { @@ -92,7 +100,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [87, 88], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot index b0254dcb6cb..7ee2ab6c7e7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 20, line: 3 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Test", + optional: false, range: [83, 87], loc: { @@ -35,7 +39,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [88, 89], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot index 79507cbad05..ca5d1f2bff2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-generic AST Alignmen end: { column: 20, line: 3 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Test', +- optional: false, range: [83, 87], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-generic AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [88, 89], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot index a876b40872a..3058a8d9433 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [138, 141], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [142, 145], loc: { @@ -35,6 +40,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [138, 147], loc: { @@ -50,9 +57,13 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot index cbdfb2688e0..fffa02b876d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [138, 141], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [142, 145], loc: { @@ -40,6 +45,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment }, }, ], +- readonly: false, +- static: false, range: [138, 147], loc: { @@ -55,9 +62,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment end: { column: 1, line: 9 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Test', +- optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot index 5688a7f27a7..9ca0ecc7906 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "h", + optional: false, range: [92, 93], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -71,6 +77,7 @@ Program { end: { column: 22, line: 4 }, }, }, + static: false, range: [92, 113], loc: { @@ -83,7 +90,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "g", + optional: false, range: [116, 117], loc: { @@ -92,17 +101,22 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [126, 127], loc: { @@ -132,13 +146,16 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [130, 131], loc: { @@ -160,6 +177,7 @@ Program { end: { column: 17, line: 5 }, }, }, + static: false, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", params: [ @@ -169,7 +187,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [118, 119], loc: { @@ -208,9 +228,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot index e6b93ecb73b..1a5fae1fabd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'h', +- optional: false, range: [92, 93], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -77,6 +83,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment end: { column: 22, line: 4 }, }, }, +- static: false, range: [92, 113], loc: { @@ -89,7 +96,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'g', +- optional: false, range: [116, 117], loc: { @@ -98,18 +107,23 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [126, 127], loc: { @@ -139,6 +153,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -146,7 +161,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [130, 131], loc: { @@ -168,6 +185,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment end: { column: 17, line: 5 }, }, }, +- static: false, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', params: Array [ @@ -177,7 +195,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [118, 119], - loc: { @@ -217,9 +237,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment end: { column: 1, line: 6 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot index 06c9ff9b72d..c0b2042f612 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [92, 95], loc: { @@ -23,6 +25,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, range: [92, 97], loc: { @@ -35,7 +39,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [100, 103], loc: { @@ -44,6 +50,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -74,7 +82,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [116, 119], loc: { @@ -87,7 +97,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [121, 124], loc: { @@ -97,6 +109,7 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "bar", optional: true, typeAnnotation: TSTypeAnnotation { @@ -126,6 +139,7 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "baz", optional: true, @@ -136,6 +150,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [116, 146], loc: { @@ -151,9 +167,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot index 0f17f468b7b..af590c0b0ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [92, 95], loc: { @@ -27,6 +29,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, }, optional: true, +- readonly: false, +- static: false, range: [92, 97], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [100, 103], loc: { @@ -48,6 +54,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, }, optional: true, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -78,7 +86,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [116, 119], loc: { @@ -92,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [121, 124], loc: { @@ -102,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', optional: true, typeAnnotation: TSTypeAnnotation { @@ -131,6 +144,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', optional: true, @@ -141,6 +155,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, }, ], +- readonly: false, +- static: false, range: [116, 146], loc: { @@ -156,9 +172,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties end: { column: 1, line: 7 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot index 7208bb0dc06..68edcc2ebde 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [92, 95], loc: { @@ -22,6 +24,9 @@ Program { end: { column: 5, line: 4 }, }, }, + optional: false, + readonly: false, + static: false, range: [92, 96], loc: { @@ -37,9 +42,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot index 3f71028931f..39414f7c3b6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,78 @@ exports[`AST Fixtures legacy-fixtures basics interface-without-type-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [92, 95], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [92, 96], + loc: { + start: { column: 2, line: 4 }, + end: { column: 6, line: 4 }, + }, + }, + ], + + range: [88, 98], + loc: { + start: { column: 15, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [83, 87], + loc: { + start: { column: 10, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 99], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot index f9954e47008..21d50eb4fa9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Uppercase", + optional: false, range: [78, 87], loc: { @@ -43,7 +46,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "S", + optional: false, range: [88, 89], loc: { @@ -76,9 +81,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Lowercase", + optional: false, range: [124, 133], loc: { @@ -113,7 +121,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "S", + optional: false, range: [134, 135], loc: { @@ -146,9 +156,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Capitalize", + optional: false, range: [170, 180], loc: { @@ -183,7 +196,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "S", + optional: false, range: [181, 182], loc: { @@ -216,9 +231,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Uncapitalize", + optional: false, range: [217, 229], loc: { @@ -253,7 +271,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "S", + optional: false, range: [230, 231], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot index 89bf1373ea0..c7e54a64f06 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Uppercase', +- optional: false, range: [78, 87], loc: { @@ -47,7 +50,9 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [88, 89], - loc: { @@ -81,9 +86,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Lowercase', +- optional: false, range: [124, 133], loc: { @@ -118,7 +126,9 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [134, 135], - loc: { @@ -152,9 +162,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Capitalize', +- optional: false, range: [170, 180], loc: { @@ -189,7 +202,9 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [181, 182], - loc: { @@ -223,9 +238,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Uncapitalize', +- optional: false, range: [217, 229], loc: { @@ -260,7 +278,9 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [230, 231], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot index da13147b30f..744740c1ac3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [78, 79], loc: { @@ -23,7 +26,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [88, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot index 066f52e976f..31b817f0994 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,72 @@ exports[`AST Fixtures legacy-fixtures basics keyof-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'keyof', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [82, 91], + loc: { + start: { column: 9, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot index d350372e5ef..807baaad82c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot @@ -12,9 +12,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "abstract", + optional: false, range: [83, 91], loc: { @@ -41,6 +44,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [77, 96], @@ -54,9 +58,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "as", + optional: false, range: [105, 107], loc: { @@ -83,6 +90,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [99, 112], @@ -96,9 +104,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "asserts", + optional: false, range: [121, 128], loc: { @@ -125,6 +136,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [115, 133], @@ -138,9 +150,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "any", + optional: false, range: [142, 145], loc: { @@ -167,6 +182,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [136, 150], @@ -180,9 +196,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "async", + optional: false, range: [159, 164], loc: { @@ -209,6 +228,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [153, 169], @@ -222,9 +242,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "await", + optional: false, range: [178, 183], loc: { @@ -251,6 +274,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [172, 188], @@ -264,9 +288,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "boolean", + optional: false, range: [197, 204], loc: { @@ -293,6 +320,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [191, 209], @@ -306,9 +334,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [218, 229], loc: { @@ -335,6 +366,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [212, 234], @@ -348,9 +380,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "declare", + optional: false, range: [243, 250], loc: { @@ -377,6 +412,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [237, 255], @@ -390,9 +426,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "get", + optional: false, range: [264, 267], loc: { @@ -419,6 +458,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [258, 272], @@ -432,9 +472,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "infer", + optional: false, range: [281, 286], loc: { @@ -461,6 +504,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [275, 291], @@ -474,9 +518,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "is", + optional: false, range: [300, 302], loc: { @@ -503,6 +550,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [294, 307], @@ -516,9 +564,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "keyof", + optional: false, range: [316, 321], loc: { @@ -545,6 +596,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [310, 326], @@ -558,9 +610,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "module", + optional: false, range: [335, 341], loc: { @@ -587,6 +642,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [329, 346], @@ -600,9 +656,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "namespace", + optional: false, range: [355, 364], loc: { @@ -629,6 +688,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [349, 369], @@ -642,9 +702,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "never", + optional: false, range: [378, 383], loc: { @@ -671,6 +734,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [372, 388], @@ -684,9 +748,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "readonly", + optional: false, range: [397, 405], loc: { @@ -713,6 +780,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [391, 410], @@ -726,9 +794,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "require", + optional: false, range: [419, 426], loc: { @@ -755,6 +826,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [413, 431], @@ -768,9 +840,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "number", + optional: false, range: [440, 446], loc: { @@ -797,6 +872,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [434, 451], @@ -810,9 +886,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "object", + optional: false, range: [460, 466], loc: { @@ -839,6 +918,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [454, 471], @@ -852,9 +932,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "set", + optional: false, range: [480, 483], loc: { @@ -881,6 +964,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [474, 488], @@ -894,9 +978,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "string", + optional: false, range: [497, 503], loc: { @@ -923,6 +1010,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [491, 508], @@ -936,9 +1024,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "symbol", + optional: false, range: [517, 523], loc: { @@ -965,6 +1056,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [511, 528], @@ -978,9 +1070,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [537, 541], loc: { @@ -1007,6 +1102,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [531, 546], @@ -1020,9 +1116,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "undefined", + optional: false, range: [555, 564], loc: { @@ -1049,6 +1148,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [549, 569], @@ -1062,9 +1162,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "unique", + optional: false, range: [578, 584], loc: { @@ -1091,6 +1194,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [572, 589], @@ -1104,9 +1208,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "unknown", + optional: false, range: [598, 605], loc: { @@ -1133,6 +1240,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [592, 610], @@ -1146,9 +1254,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "from", + optional: false, range: [619, 623], loc: { @@ -1175,6 +1286,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [613, 628], @@ -1188,9 +1300,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [637, 643], loc: { @@ -1217,6 +1332,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [631, 648], @@ -1230,9 +1346,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "bigint", + optional: false, range: [657, 663], loc: { @@ -1259,6 +1378,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [651, 668], @@ -1272,9 +1392,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "of", + optional: false, range: [677, 679], loc: { @@ -1301,6 +1424,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [671, 684], @@ -1337,7 +1461,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "abstract", + optional: false, range: [699, 707], loc: { @@ -1348,7 +1474,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "abstract", + optional: false, range: [699, 707], loc: { @@ -1367,7 +1495,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "as", + optional: false, range: [711, 713], loc: { @@ -1378,7 +1508,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "as", + optional: false, range: [711, 713], loc: { @@ -1397,7 +1529,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "asserts", + optional: false, range: [717, 724], loc: { @@ -1408,7 +1542,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "asserts", + optional: false, range: [717, 724], loc: { @@ -1427,7 +1563,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "any", + optional: false, range: [728, 731], loc: { @@ -1438,7 +1576,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "any", + optional: false, range: [728, 731], loc: { @@ -1457,7 +1597,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "async", + optional: false, range: [735, 740], loc: { @@ -1468,7 +1610,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "async", + optional: false, range: [735, 740], loc: { @@ -1487,7 +1631,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "await", + optional: false, range: [744, 749], loc: { @@ -1498,7 +1644,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "await", + optional: false, range: [744, 749], loc: { @@ -1517,7 +1665,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "boolean", + optional: false, range: [753, 760], loc: { @@ -1528,7 +1678,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "boolean", + optional: false, range: [753, 760], loc: { @@ -1547,7 +1699,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [764, 775], loc: { @@ -1558,7 +1712,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [764, 775], loc: { @@ -1577,7 +1733,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "declare", + optional: false, range: [779, 786], loc: { @@ -1588,7 +1746,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "declare", + optional: false, range: [779, 786], loc: { @@ -1607,7 +1767,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "get", + optional: false, range: [790, 793], loc: { @@ -1618,7 +1780,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "get", + optional: false, range: [790, 793], loc: { @@ -1637,7 +1801,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "infer", + optional: false, range: [797, 802], loc: { @@ -1648,7 +1814,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "infer", + optional: false, range: [797, 802], loc: { @@ -1667,7 +1835,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "is", + optional: false, range: [806, 808], loc: { @@ -1678,7 +1848,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "is", + optional: false, range: [806, 808], loc: { @@ -1697,7 +1869,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "keyof", + optional: false, range: [812, 817], loc: { @@ -1708,7 +1882,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "keyof", + optional: false, range: [812, 817], loc: { @@ -1727,7 +1903,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "module", + optional: false, range: [821, 827], loc: { @@ -1738,7 +1916,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "module", + optional: false, range: [821, 827], loc: { @@ -1757,7 +1937,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "namespace", + optional: false, range: [831, 840], loc: { @@ -1768,7 +1950,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "namespace", + optional: false, range: [831, 840], loc: { @@ -1787,7 +1971,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "never", + optional: false, range: [844, 849], loc: { @@ -1798,7 +1984,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "never", + optional: false, range: [844, 849], loc: { @@ -1817,7 +2005,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "readonly", + optional: false, range: [853, 861], loc: { @@ -1828,7 +2018,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "readonly", + optional: false, range: [853, 861], loc: { @@ -1847,7 +2039,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "require", + optional: false, range: [865, 872], loc: { @@ -1858,7 +2052,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "require", + optional: false, range: [865, 872], loc: { @@ -1877,7 +2073,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "number", + optional: false, range: [876, 882], loc: { @@ -1888,7 +2086,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "number", + optional: false, range: [876, 882], loc: { @@ -1907,7 +2107,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "object", + optional: false, range: [886, 892], loc: { @@ -1918,7 +2120,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "object", + optional: false, range: [886, 892], loc: { @@ -1937,7 +2141,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "set", + optional: false, range: [896, 899], loc: { @@ -1948,7 +2154,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "set", + optional: false, range: [896, 899], loc: { @@ -1967,7 +2175,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "string", + optional: false, range: [903, 909], loc: { @@ -1978,7 +2188,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "string", + optional: false, range: [903, 909], loc: { @@ -1997,7 +2209,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "symbol", + optional: false, range: [913, 919], loc: { @@ -2008,7 +2222,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "symbol", + optional: false, range: [913, 919], loc: { @@ -2027,7 +2243,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [923, 927], loc: { @@ -2038,7 +2256,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "type", + optional: false, range: [923, 927], loc: { @@ -2057,7 +2277,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "undefined", + optional: false, range: [931, 940], loc: { @@ -2068,7 +2290,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "undefined", + optional: false, range: [931, 940], loc: { @@ -2087,7 +2311,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "unique", + optional: false, range: [944, 950], loc: { @@ -2098,7 +2324,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "unique", + optional: false, range: [944, 950], loc: { @@ -2117,7 +2345,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "unknown", + optional: false, range: [954, 961], loc: { @@ -2128,7 +2358,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "unknown", + optional: false, range: [954, 961], loc: { @@ -2147,7 +2379,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "from", + optional: false, range: [965, 969], loc: { @@ -2158,7 +2392,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "from", + optional: false, range: [965, 969], loc: { @@ -2177,7 +2413,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [973, 979], loc: { @@ -2188,7 +2426,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [973, 979], loc: { @@ -2207,7 +2447,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "bigint", + optional: false, range: [983, 989], loc: { @@ -2218,7 +2460,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "bigint", + optional: false, range: [983, 989], loc: { @@ -2237,7 +2481,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "of", + optional: false, range: [993, 995], loc: { @@ -2248,7 +2494,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: [], name: "of", + optional: false, range: [993, 995], loc: { @@ -2283,9 +2531,13 @@ Program { end: { column: 14, line: 71 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [1030, 1031], loc: { @@ -2302,15 +2554,19 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [1067, 1068], loc: { @@ -2319,6 +2575,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -2334,6 +2591,7 @@ Program { end: { column: 15, line: 73 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -2356,9 +2614,12 @@ Program { type: "MethodDefinition", accessibility: "private", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [1084, 1085], loc: { @@ -2367,6 +2628,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -2382,6 +2644,7 @@ Program { end: { column: 16, line: 74 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -2404,9 +2667,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [1100, 1101], loc: { @@ -2415,6 +2681,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -2430,6 +2697,7 @@ Program { end: { column: 15, line: 75 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -2452,9 +2720,12 @@ Program { type: "MethodDefinition", accessibility: "protected", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "d", + optional: false, range: [1120, 1121], loc: { @@ -2463,6 +2734,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -2476,9 +2748,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [1134, 1135], loc: { @@ -2505,6 +2780,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [1130, 1144], @@ -2521,6 +2797,7 @@ Program { end: { column: 3, line: 78 }, }, }, + declare: false, expression: false, generator: true, id: null, @@ -2547,9 +2824,13 @@ Program { end: { column: 1, line: 79 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [1041, 1042], loc: { @@ -2562,7 +2843,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [1054, 1055], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot index b5725bf6f75..49b73e6d19b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot @@ -16,9 +16,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'abstract', +- optional: false, range: [83, 91], loc: { @@ -45,6 +48,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [77, 96], @@ -58,9 +62,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'as', +- optional: false, range: [105, 107], loc: { @@ -87,6 +94,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [99, 112], @@ -100,9 +108,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'asserts', +- optional: false, range: [121, 128], loc: { @@ -129,6 +140,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [115, 133], @@ -142,9 +154,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'any', +- optional: false, range: [142, 145], loc: { @@ -171,6 +186,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [136, 150], @@ -184,9 +200,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'async', +- optional: false, range: [159, 164], loc: { @@ -213,6 +232,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [153, 169], @@ -226,9 +246,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'await', +- optional: false, range: [178, 183], loc: { @@ -255,6 +278,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [172, 188], @@ -268,9 +292,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boolean', +- optional: false, range: [197, 204], loc: { @@ -297,6 +324,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [191, 209], @@ -310,9 +338,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [218, 229], loc: { @@ -339,6 +370,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [212, 234], @@ -352,9 +384,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'declare', +- optional: false, range: [243, 250], loc: { @@ -381,6 +416,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [237, 255], @@ -394,9 +430,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'get', +- optional: false, range: [264, 267], loc: { @@ -423,6 +462,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [258, 272], @@ -436,9 +476,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'infer', +- optional: false, range: [281, 286], loc: { @@ -465,6 +508,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [275, 291], @@ -478,9 +522,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'is', +- optional: false, range: [300, 302], loc: { @@ -507,6 +554,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [294, 307], @@ -520,9 +568,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'keyof', +- optional: false, range: [316, 321], loc: { @@ -549,6 +600,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [310, 326], @@ -562,9 +614,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'module', +- optional: false, range: [335, 341], loc: { @@ -591,6 +646,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [329, 346], @@ -604,9 +660,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'namespace', +- optional: false, range: [355, 364], loc: { @@ -633,6 +692,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [349, 369], @@ -646,9 +706,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'never', +- optional: false, range: [378, 383], loc: { @@ -675,6 +738,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [372, 388], @@ -688,9 +752,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'readonly', +- optional: false, range: [397, 405], loc: { @@ -717,6 +784,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [391, 410], @@ -730,9 +798,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'require', +- optional: false, range: [419, 426], loc: { @@ -759,6 +830,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [413, 431], @@ -772,9 +844,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'number', +- optional: false, range: [440, 446], loc: { @@ -801,6 +876,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [434, 451], @@ -814,9 +890,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'object', +- optional: false, range: [460, 466], loc: { @@ -843,6 +922,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [454, 471], @@ -856,9 +936,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'set', +- optional: false, range: [480, 483], loc: { @@ -885,6 +968,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [474, 488], @@ -898,9 +982,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'string', +- optional: false, range: [497, 503], loc: { @@ -927,6 +1014,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [491, 508], @@ -940,9 +1028,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'symbol', +- optional: false, range: [517, 523], loc: { @@ -969,6 +1060,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [511, 528], @@ -982,9 +1074,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'type', +- optional: false, range: [537, 541], loc: { @@ -1011,6 +1106,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [531, 546], @@ -1024,9 +1120,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [555, 564], loc: { @@ -1053,6 +1152,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [549, 569], @@ -1066,9 +1166,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unique', +- optional: false, range: [578, 584], loc: { @@ -1095,6 +1198,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [572, 589], @@ -1108,9 +1212,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unknown', +- optional: false, range: [598, 605], loc: { @@ -1137,6 +1244,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [592, 610], @@ -1150,9 +1258,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'from', +- optional: false, range: [619, 623], loc: { @@ -1179,6 +1290,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [613, 628], @@ -1192,9 +1304,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [637, 643], loc: { @@ -1221,6 +1336,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [631, 648], @@ -1234,9 +1350,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bigint', +- optional: false, range: [657, 663], loc: { @@ -1263,6 +1382,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [651, 668], @@ -1276,9 +1396,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'of', +- optional: false, range: [677, 679], loc: { @@ -1305,6 +1428,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [671, 684], @@ -1341,7 +1465,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'abstract', +- optional: false, range: [699, 707], loc: { @@ -1352,7 +1478,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'abstract', +- optional: false, range: [699, 707], loc: { @@ -1371,7 +1499,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'as', +- optional: false, range: [711, 713], loc: { @@ -1382,7 +1512,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'as', +- optional: false, range: [711, 713], loc: { @@ -1401,7 +1533,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'asserts', +- optional: false, range: [717, 724], loc: { @@ -1412,7 +1546,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'asserts', +- optional: false, range: [717, 724], loc: { @@ -1431,7 +1567,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'any', +- optional: false, range: [728, 731], loc: { @@ -1442,7 +1580,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'any', +- optional: false, range: [728, 731], loc: { @@ -1461,7 +1601,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'async', +- optional: false, range: [735, 740], loc: { @@ -1472,7 +1614,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'async', +- optional: false, range: [735, 740], loc: { @@ -1491,7 +1635,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'await', +- optional: false, range: [744, 749], loc: { @@ -1502,7 +1648,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'await', +- optional: false, range: [744, 749], loc: { @@ -1521,7 +1669,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boolean', +- optional: false, range: [753, 760], loc: { @@ -1532,7 +1682,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boolean', +- optional: false, range: [753, 760], loc: { @@ -1551,7 +1703,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [764, 775], loc: { @@ -1562,7 +1716,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [764, 775], loc: { @@ -1581,7 +1737,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'declare', +- optional: false, range: [779, 786], loc: { @@ -1592,7 +1750,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'declare', +- optional: false, range: [779, 786], loc: { @@ -1611,7 +1771,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'get', +- optional: false, range: [790, 793], loc: { @@ -1622,7 +1784,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'get', +- optional: false, range: [790, 793], loc: { @@ -1641,7 +1805,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'infer', +- optional: false, range: [797, 802], loc: { @@ -1652,7 +1818,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'infer', +- optional: false, range: [797, 802], loc: { @@ -1671,7 +1839,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'is', +- optional: false, range: [806, 808], loc: { @@ -1682,7 +1852,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'is', +- optional: false, range: [806, 808], loc: { @@ -1701,7 +1873,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'keyof', +- optional: false, range: [812, 817], loc: { @@ -1712,7 +1886,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'keyof', +- optional: false, range: [812, 817], loc: { @@ -1731,7 +1907,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'module', +- optional: false, range: [821, 827], loc: { @@ -1742,7 +1920,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'module', +- optional: false, range: [821, 827], loc: { @@ -1761,7 +1941,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'namespace', +- optional: false, range: [831, 840], loc: { @@ -1772,7 +1954,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'namespace', +- optional: false, range: [831, 840], loc: { @@ -1791,7 +1975,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'never', +- optional: false, range: [844, 849], loc: { @@ -1802,7 +1988,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'never', +- optional: false, range: [844, 849], loc: { @@ -1821,7 +2009,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'readonly', +- optional: false, range: [853, 861], loc: { @@ -1832,7 +2022,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'readonly', +- optional: false, range: [853, 861], loc: { @@ -1851,7 +2043,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'require', +- optional: false, range: [865, 872], loc: { @@ -1862,7 +2056,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'require', +- optional: false, range: [865, 872], loc: { @@ -1881,7 +2077,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'number', +- optional: false, range: [876, 882], loc: { @@ -1892,7 +2090,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'number', +- optional: false, range: [876, 882], loc: { @@ -1911,7 +2111,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'object', +- optional: false, range: [886, 892], loc: { @@ -1922,7 +2124,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'object', +- optional: false, range: [886, 892], loc: { @@ -1941,7 +2145,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'set', +- optional: false, range: [896, 899], loc: { @@ -1952,7 +2158,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'set', +- optional: false, range: [896, 899], loc: { @@ -1971,7 +2179,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'string', +- optional: false, range: [903, 909], loc: { @@ -1982,7 +2192,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'string', +- optional: false, range: [903, 909], loc: { @@ -2001,7 +2213,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'symbol', +- optional: false, range: [913, 919], loc: { @@ -2012,7 +2226,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'symbol', +- optional: false, range: [913, 919], loc: { @@ -2031,7 +2247,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'type', +- optional: false, range: [923, 927], loc: { @@ -2042,7 +2260,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'type', +- optional: false, range: [923, 927], loc: { @@ -2061,7 +2281,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [931, 940], loc: { @@ -2072,7 +2294,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [931, 940], loc: { @@ -2091,7 +2315,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unique', +- optional: false, range: [944, 950], loc: { @@ -2102,7 +2328,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unique', +- optional: false, range: [944, 950], loc: { @@ -2121,7 +2349,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unknown', +- optional: false, range: [954, 961], loc: { @@ -2132,7 +2362,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unknown', +- optional: false, range: [954, 961], loc: { @@ -2151,7 +2383,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'from', +- optional: false, range: [965, 969], loc: { @@ -2162,7 +2396,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'from', +- optional: false, range: [965, 969], loc: { @@ -2181,7 +2417,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [973, 979], loc: { @@ -2192,7 +2430,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [973, 979], loc: { @@ -2211,7 +2451,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bigint', +- optional: false, range: [983, 989], loc: { @@ -2222,7 +2464,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bigint', +- optional: false, range: [983, 989], loc: { @@ -2241,7 +2485,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'of', +- optional: false, range: [993, 995], loc: { @@ -2252,7 +2498,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'of', +- optional: false, range: [993, 995], loc: { @@ -2287,9 +2535,13 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 14, line: 71 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [1030, 1031], loc: { @@ -2306,15 +2558,19 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [1067, 1068], loc: { @@ -2323,6 +2579,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -2338,6 +2595,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 15, line: 73 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -2360,9 +2618,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'MethodDefinition', accessibility: 'private', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [1084, 1085], loc: { @@ -2371,6 +2632,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -2386,6 +2648,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 16, line: 74 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -2408,9 +2671,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [1100, 1101], loc: { @@ -2419,6 +2685,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -2434,6 +2701,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 15, line: 75 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -2456,9 +2724,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'MethodDefinition', accessibility: 'protected', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [1120, 1121], loc: { @@ -2467,6 +2738,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -2480,9 +2752,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [1134, 1135], loc: { @@ -2509,6 +2784,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [1130, 1144], @@ -2525,6 +2801,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 3, line: 78 }, }, }, +- declare: false, expression: false, generator: true, id: null, @@ -2551,9 +2828,13 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 1, line: 79 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [1041, 1042], loc: { @@ -2568,7 +2849,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [1054, 1055], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot index 8f452e81b3e..3529f9cd5de 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot @@ -9,54 +9,27 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "nestedArray", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [90, 95], - loc: { - start: { column: 17, line: 3 }, - end: { column: 22, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [96, 101], - loc: { - start: { column: 23, line: 3 }, - end: { column: 28, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [102, 107], - loc: { - start: { column: 29, line: 3 }, - end: { column: 34, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSStringKeyword { @@ -76,6 +49,18 @@ Program { end: { column: 42, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, range: [102, 115], loc: { @@ -91,6 +76,18 @@ Program { end: { column: 43, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, range: [96, 116], loc: { @@ -106,6 +103,18 @@ Program { end: { column: 44, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [90, 95], + loc: { + start: { column: 17, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, range: [90, 117], loc: { @@ -136,6 +145,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot index fff61afeb9b..fae5238938d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,202 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'nestedArray', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [90, 95], ++ loc: { ++ start: { column: 17, line: 3 }, ++ end: { column: 22, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [96, 101], ++ loc: { ++ start: { column: 23, line: 3 }, ++ end: { column: 28, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [102, 107], ++ loc: { ++ start: { column: 29, line: 3 }, ++ end: { column: 34, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- +- range: [102, 107], +- loc: { +- start: { column: 29, line: 3 }, +- end: { column: 34, line: 3 }, +- }, +- }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [101, 116], + loc: { + start: { column: 28, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, + +- range: [96, 101], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 28, line: 3 }, +- }, +- }, +- + range: [96, 116], + loc: { + start: { column: 23, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + + range: [95, 117], + loc: { + start: { column: 22, line: 3 }, + end: { column: 44, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- +- range: [90, 95], +- loc: { +- start: { column: 17, line: 3 }, +- end: { column: 22, line: 3 }, + }, + }, + + range: [90, 117], + loc: { + start: { column: 17, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [88, 117], + loc: { + start: { column: 15, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [77, 117], + loc: { + start: { column: 4, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + init: null, + + range: [77, 117], + loc: { + start: { column: 4, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 119], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot index 7e62ff3de6a..31075870127 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot @@ -9,24 +9,17 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "X", - - range: [80, 81], - loc: { - start: { column: 7, line: 3 }, - end: { column: 8, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSNeverKeyword { @@ -46,6 +39,18 @@ Program { end: { column: 15, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "X", + optional: false, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, range: [80, 88], loc: { @@ -76,6 +81,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 89], @@ -94,7 +100,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "Observable", + optional: false, range: [90, 100], loc: { @@ -105,7 +113,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "empty", + optional: false, range: [101, 106], loc: { @@ -121,7 +131,7 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSNeverKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot index 3405c7b4b91..17bbe4be48f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,192 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'X', ++ ++ range: [80, 81], ++ loc: { ++ start: { column: 7, line: 3 }, ++ end: { column: 8, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNeverKeyword { + type: 'TSNeverKeyword', + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [81, 88], + loc: { + start: { column: 8, line: 3 }, + end: { column: 15, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'X', +- optional: false, +- +- range: [80, 81], +- loc: { +- start: { column: 7, line: 3 }, +- end: { column: 8, line: 3 }, + }, + }, + + range: [80, 88], + loc: { + start: { column: 7, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [78, 88], + loc: { + start: { column: 5, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [77, 88], + loc: { + start: { column: 4, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + init: null, + + range: [77, 88], + loc: { + start: { column: 4, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Observable', +- optional: false, + + range: [90, 100], + loc: { + start: { column: 0, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'empty', +- optional: false, + + range: [101, 106], + loc: { + start: { column: 11, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [90, 106], + loc: { + start: { column: 0, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNeverKeyword { + type: 'TSNeverKeyword', + + range: [107, 112], + loc: { + start: { column: 17, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ], + + range: [106, 113], + loc: { + start: { column: 16, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [90, 115], + loc: { + start: { column: 0, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, + + range: [90, 116], + loc: { + start: { column: 0, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot index a8b94faa45d..60a3da780ff 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot @@ -17,7 +17,9 @@ Program { arguments: [ Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, range: [127, 128], loc: { @@ -28,7 +30,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "validateEntity", + optional: false, range: [112, 126], loc: { @@ -56,9 +60,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "s", + optional: false, range: [137, 138], loc: { @@ -73,7 +80,9 @@ Program { type: "TSNonNullExpression", expression: Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, range: [141, 142], loc: { @@ -91,7 +100,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, range: [144, 148], loc: { @@ -114,6 +125,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [133, 149], @@ -130,11 +142,14 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processEntity", + optional: false, range: [82, 95], loc: { @@ -145,6 +160,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "e", optional: true, typeAnnotation: TSTypeAnnotation { @@ -153,7 +169,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Entity", + optional: false, range: [100, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot index d8601d44284..552644a251b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,223 @@ exports[`AST Fixtures legacy-fixtures basics non-null-assertion-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + + range: [127, 128], + loc: { + start: { column: 17, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + ], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'validateEntity', +- optional: false, + + range: [112, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + optional: false, + + range: [112, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [112, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 's', +- optional: false, + + range: [137, 138], + loc: { + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + init: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + + range: [141, 142], + loc: { + start: { column: 10, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [141, 143], + loc: { + start: { column: 10, line: 5 }, + end: { column: 12, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + + range: [144, 148], + loc: { + start: { column: 13, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [141, 148], + loc: { + start: { column: 10, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [137, 148], + loc: { + start: { column: 6, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [133, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [108, 151], + loc: { + start: { column: 35, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processEntity', +- optional: false, + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Entity', +- optional: false, + + range: [100, 106], + loc: { + start: { column: 27, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [100, 106], + loc: { + start: { column: 27, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [98, 106], + loc: { + start: { column: 25, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [96, 106], + loc: { + start: { column: 23, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + ], + + range: [73, 151], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot index d5f4e726162..4ef189f802e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNullKeyword { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 85], @@ -59,9 +63,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUndefinedKeyword { @@ -96,6 +103,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [86, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot index 24b8986179c..80f91407215 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,127 @@ exports[`AST Fixtures legacy-fixtures basics null-and-undefined-type-annotations AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNullKeyword { + type: 'TSNullKeyword', + + range: [80, 84], + loc: { + start: { column: 7, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [78, 84], + loc: { + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + init: null, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 85], + loc: { + start: { column: 0, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUndefinedKeyword { + type: 'TSUndefinedKeyword', + + range: [93, 102], + loc: { + start: { column: 7, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [91, 102], + loc: { + start: { column: 5, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [90, 102], + loc: { + start: { column: 4, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + init: null, + + range: [90, 102], + loc: { + start: { column: 4, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [86, 103], + loc: { + start: { column: 0, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 104], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot index 0b331137fc3..0dce16b4118 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot @@ -15,9 +15,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "len", + optional: false, range: [125, 128], loc: { @@ -29,7 +32,9 @@ Program { type: "LogicalExpression", left: Identifier { type: "Identifier", + decorators: [], name: "s", + optional: false, range: [131, 132], loc: { @@ -64,6 +69,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [121, 139], @@ -80,11 +86,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processNullishCoalesce", + optional: false, range: [82, 104], loc: { @@ -95,6 +104,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "s", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot index e44cc1eb21f..59661fcd10c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,155 @@ exports[`AST Fixtures legacy-fixtures basics nullish-coalescing AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'len', +- optional: false, + + range: [125, 128], + loc: { + start: { column: 6, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + init: LogicalExpression { + type: 'LogicalExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 's', +- optional: false, + + range: [131, 132], + loc: { + start: { column: 12, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + operator: '??', + right: Literal { + type: 'Literal', + raw: '\\'\\'', + value: '', + + range: [136, 138], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [131, 138], + loc: { + start: { column: 12, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [125, 138], + loc: { + start: { column: 6, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [121, 139], + loc: { + start: { column: 2, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + ], + + range: [117, 141], + loc: { + start: { column: 44, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processNullishCoalesce', +- optional: false, + + range: [82, 104], + loc: { + start: { column: 9, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 's', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [109, 115], + loc: { + start: { column: 36, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [105, 115], + loc: { + start: { column: 32, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [73, 141], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 142], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot index e5af4497aaa..d19e138b046 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "__", + optional: false, range: [76, 78], loc: { @@ -24,6 +26,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -68,7 +71,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "__", + optional: false, range: [93, 95], loc: { @@ -78,6 +83,7 @@ Program { }, kind: "init", method: true, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -92,6 +98,7 @@ Program { end: { column: 10, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -146,6 +153,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -182,6 +190,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -189,6 +198,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Literal { type: "Literal", raw: "'__'", @@ -200,7 +211,9 @@ Program { end: { column: 6, line: 10 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -228,9 +241,13 @@ Program { end: { column: 1, line: 11 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [133, 134], loc: { @@ -238,6 +255,7 @@ Program { end: { column: 7, line: 9 }, }, }, + implements: [], superClass: null, range: [127, 153], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot index f9949f44171..ee88a37d89d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: '__', +- optional: false, range: [76, 78], loc: { @@ -28,6 +30,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -72,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: '__', +- optional: false, range: [93, 95], loc: { @@ -82,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, kind: 'init', method: true, +- optional: false, shorthand: false, value: FunctionExpression { type: 'FunctionExpression', @@ -96,6 +102,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 10, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -150,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -186,6 +194,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -193,6 +202,8 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\'__\\'', @@ -204,7 +215,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 6, line: 10 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -232,9 +245,13 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 1, line: 11 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [133, 134], loc: { @@ -242,6 +259,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 7, line: 9 }, }, }, +- implements: Array [], superClass: null, range: [127, 153], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot index ba49f7d863c..51752082e5b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -27,7 +30,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [89, 100], loc: { @@ -37,6 +42,7 @@ Program { }, kind: "init", method: true, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -72,6 +78,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -103,7 +110,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [101, 102], loc: { @@ -146,7 +155,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [137, 140], loc: { @@ -156,6 +167,7 @@ Program { }, kind: "init", method: true, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -191,6 +203,7 @@ Program { end: { column: 3, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -222,7 +235,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [141, 142], loc: { @@ -265,7 +280,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [181, 182], loc: { @@ -275,6 +292,7 @@ Program { }, kind: "get", method: false, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -310,6 +328,7 @@ Program { end: { column: 3, line: 12 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -351,7 +370,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [220, 221], loc: { @@ -361,6 +382,7 @@ Program { }, kind: "set", method: false, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -375,13 +397,16 @@ Program { end: { column: 29, line: 13 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -456,6 +481,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 247], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot index 134b63d05f4..2caadf4e304 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [79, 82], loc: { @@ -31,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [89, 100], loc: { @@ -41,6 +46,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'init', method: true, +- optional: false, shorthand: false, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', @@ -97,6 +103,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -117,8 +124,8 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align loc: { start: { column: 18, line: 4 }, end: { column: 26, line: 4 }, -- }, -- }, + }, + }, - typeParameters: TSTypeParameterDeclaration { - type: 'TSTypeParameterDeclaration', - params: Array [ @@ -128,8 +135,10 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, + - range: [101, 102], - loc: { - start: { column: 14, line: 4 }, @@ -150,9 +159,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - loc: { - start: { column: 13, line: 4 }, - end: { column: 16, line: 4 }, - }, - }, - +- }, +- }, +- - range: [100, 133], + range: [103, 133], loc: { @@ -173,7 +182,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [137, 140], loc: { @@ -183,6 +194,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'init', method: true, +- optional: false, shorthand: false, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', @@ -239,6 +251,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 3, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -270,7 +283,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - range: [141, 142], - loc: { @@ -315,7 +330,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [181, 182], loc: { @@ -325,6 +342,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'get', method: false, +- optional: false, shorthand: false, value: FunctionExpression { type: 'FunctionExpression', @@ -360,6 +378,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 3, line: 12 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -401,7 +420,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [220, 221], loc: { @@ -411,6 +432,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'set', method: false, +- optional: false, shorthand: false, value: FunctionExpression { type: 'FunctionExpression', @@ -425,13 +447,16 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 29, line: 13 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -506,6 +531,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, }, ], +- declare: false, kind: 'const', range: [73, 247], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot index 8ae89d77588..899ea359295 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [113, 116], loc: { @@ -35,7 +37,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [118, 121], loc: { @@ -96,7 +100,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [128, 131], loc: { @@ -107,7 +113,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [133, 136], loc: { @@ -132,7 +140,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [138, 143], loc: { @@ -183,7 +193,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [149, 152], loc: { @@ -194,7 +206,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [154, 157], loc: { @@ -255,7 +269,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [164, 167], loc: { @@ -266,7 +282,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [169, 172], loc: { @@ -291,7 +309,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [174, 179], loc: { @@ -342,7 +362,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [185, 188], loc: { @@ -353,7 +375,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [190, 193], loc: { @@ -414,7 +438,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [200, 203], loc: { @@ -425,7 +451,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [205, 208], loc: { @@ -450,7 +478,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [210, 215], loc: { @@ -495,11 +525,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -510,6 +543,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot index 6356986bf83..57486acf58b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,594 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-call-with-non-null-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + optional: false, + + range: [113, 124], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [113, 124], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [113, 125], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [128, 131], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [133, 136], + loc: { + start: { column: 7, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [128, 136], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [128, 137], + loc: { + start: { column: 2, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [138, 143], + loc: { + start: { column: 12, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [128, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + optional: false, + + range: [128, 145], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [128, 145], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [128, 146], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [149, 152], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [154, 157], + loc: { + start: { column: 7, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + + range: [149, 157], + loc: { + start: { column: 2, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + + range: [149, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + optional: false, + + range: [149, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [149, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [149, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [164, 167], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [169, 172], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [164, 172], + loc: { + start: { column: 2, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [164, 173], + loc: { + start: { column: 2, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [174, 179], + loc: { + start: { column: 12, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [164, 179], + loc: { + start: { column: 2, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + optional: false, + + range: [164, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [164, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [164, 182], + loc: { + start: { column: 2, line: 7 }, + end: { column: 20, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [185, 188], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [190, 193], + loc: { + start: { column: 7, line: 8 }, + end: { column: 10, line: 8 }, + }, + }, + + range: [185, 193], + loc: { + start: { column: 2, line: 8 }, + end: { column: 10, line: 8 }, + }, + }, + + range: [185, 194], + loc: { + start: { column: 2, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + optional: false, + + range: [185, 196], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + + range: [185, 196], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + + range: [185, 197], + loc: { + start: { column: 2, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [200, 203], + loc: { + start: { column: 2, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [205, 208], + loc: { + start: { column: 7, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + + range: [200, 208], + loc: { + start: { column: 2, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + + range: [200, 209], + loc: { + start: { column: 2, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [210, 215], + loc: { + start: { column: 12, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + + range: [200, 215], + loc: { + start: { column: 2, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + optional: false, + + range: [200, 217], + loc: { + start: { column: 2, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + + range: [200, 217], + loc: { + start: { column: 2, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + + range: [200, 218], + loc: { + start: { column: 2, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + ], + + range: [109, 220], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 220], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 221], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot index 31586978c94..606a8985400 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot @@ -22,7 +22,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [123, 126], loc: { @@ -33,7 +35,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [128, 130], loc: { @@ -85,7 +89,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [137, 140], loc: { @@ -96,7 +102,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [142, 145], loc: { @@ -121,7 +129,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [147, 149], loc: { @@ -166,7 +176,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [155, 158], loc: { @@ -177,7 +189,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [159, 162], loc: { @@ -195,7 +209,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [164, 166], loc: { @@ -250,7 +266,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [173, 176], loc: { @@ -261,7 +279,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [177, 180], loc: { @@ -279,7 +299,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [182, 187], loc: { @@ -304,7 +326,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [189, 191], loc: { @@ -352,7 +376,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [197, 200], loc: { @@ -363,7 +389,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [201, 204], loc: { @@ -381,7 +409,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [206, 211], loc: { @@ -399,7 +429,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [213, 215], loc: { @@ -445,7 +477,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [222, 225], loc: { @@ -487,7 +521,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [234, 237], loc: { @@ -537,7 +573,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [248, 251], loc: { @@ -587,7 +625,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [265, 268], loc: { @@ -613,7 +653,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [274, 277], loc: { @@ -643,11 +685,14 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptionalCallParens", + optional: false, range: [82, 107], loc: { @@ -658,6 +703,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot index 0227f0b9ac0..484e493aab8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,754 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-call-with-parens AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [123, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [128, 130], + loc: { + start: { column: 7, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [123, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + optional: false, + + range: [123, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [123, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [123, 133], + loc: { + start: { column: 2, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [137, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [142, 145], + loc: { + start: { column: 8, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [137, 145], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [137, 145], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [147, 149], + loc: { + start: { column: 13, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [136, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + optional: false, + + range: [136, 151], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [136, 152], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [155, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [159, 162], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [155, 162], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [164, 166], + loc: { + start: { column: 11, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [155, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + optional: false, + + range: [155, 168], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [155, 168], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [155, 169], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [173, 176], + loc: { + start: { column: 3, line: 7 }, + end: { column: 6, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [177, 180], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [173, 180], + loc: { + start: { column: 3, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [182, 187], + loc: { + start: { column: 12, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [173, 187], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [173, 187], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [189, 191], + loc: { + start: { column: 19, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [172, 191], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + optional: false, + + range: [172, 193], + loc: { + start: { column: 2, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [172, 194], + loc: { + start: { column: 2, line: 7 }, + end: { column: 24, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [197, 200], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [201, 204], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [197, 204], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [206, 211], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [197, 211], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [213, 215], + loc: { + start: { column: 18, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [197, 215], + loc: { + start: { column: 2, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + optional: false, + + range: [197, 217], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [197, 217], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [197, 218], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [222, 225], + loc: { + start: { column: 2, line: 10 }, + end: { column: 5, line: 10 }, + }, + }, + optional: true, + + range: [222, 229], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [222, 229], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [222, 230], + loc: { + start: { column: 2, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [234, 237], + loc: { + start: { column: 3, line: 11 }, + end: { column: 6, line: 11 }, + }, + }, + optional: true, + + range: [234, 241], + loc: { + start: { column: 3, line: 11 }, + end: { column: 10, line: 11 }, + }, + }, + + range: [234, 241], + loc: { + start: { column: 3, line: 11 }, + end: { column: 10, line: 11 }, + }, + }, + optional: false, + + range: [233, 244], + loc: { + start: { column: 2, line: 11 }, + end: { column: 13, line: 11 }, + }, + }, + + range: [233, 245], + loc: { + start: { column: 2, line: 11 }, + end: { column: 14, line: 11 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [248, 251], + loc: { + start: { column: 2, line: 12 }, + end: { column: 5, line: 12 }, + }, + }, + optional: true, + + range: [248, 255], + loc: { + start: { column: 2, line: 12 }, + end: { column: 9, line: 12 }, + }, + }, + optional: true, + + range: [248, 259], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [248, 259], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [248, 260], + loc: { + start: { column: 2, line: 12 }, + end: { column: 14, line: 12 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [265, 268], + loc: { + start: { column: 3, line: 14 }, + end: { column: 6, line: 14 }, + }, + }, + optional: true, + + range: [265, 272], + loc: { + start: { column: 3, line: 14 }, + end: { column: 10, line: 14 }, + }, + }, + + range: [265, 272], + loc: { + start: { column: 3, line: 14 }, + end: { column: 10, line: 14 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [274, 277], + loc: { + start: { column: 12, line: 14 }, + end: { column: 15, line: 14 }, + }, + }, + + range: [264, 277], + loc: { + start: { column: 2, line: 14 }, + end: { column: 15, line: 14 }, + }, + }, + + range: [264, 278], + loc: { + start: { column: 2, line: 14 }, + end: { column: 16, line: 14 }, + }, + }, + ], + + range: [119, 280], + loc: { + start: { column: 46, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalCallParens', +- optional: false, + + range: [82, 107], + loc: { + start: { column: 9, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [114, 117], + loc: { + start: { column: 41, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [112, 117], + loc: { + start: { column: 39, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [108, 117], + loc: { + start: { column: 35, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + + range: [73, 280], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 281], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 16 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot index 0099612e53a..f25cb3a8adc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot @@ -22,7 +22,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [117, 120], loc: { @@ -33,7 +35,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [122, 124], loc: { @@ -85,7 +89,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [130, 133], loc: { @@ -96,7 +102,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [135, 138], loc: { @@ -114,7 +122,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [139, 141], loc: { @@ -166,7 +176,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [147, 150], loc: { @@ -177,7 +189,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [151, 154], loc: { @@ -195,7 +209,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [156, 158], loc: { @@ -250,7 +266,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [164, 167], loc: { @@ -261,7 +279,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [168, 171], loc: { @@ -279,7 +299,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [173, 178], loc: { @@ -297,7 +319,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [179, 181], loc: { @@ -352,7 +376,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [187, 190], loc: { @@ -363,7 +389,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [191, 194], loc: { @@ -381,7 +409,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [196, 201], loc: { @@ -399,7 +429,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [203, 205], loc: { @@ -445,7 +477,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [212, 215], loc: { @@ -487,7 +521,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [223, 226], loc: { @@ -537,7 +573,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [236, 239], loc: { @@ -587,7 +625,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [252, 255], loc: { @@ -606,7 +646,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [260, 263], loc: { @@ -643,11 +685,14 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptionalCall", + optional: false, range: [82, 101], loc: { @@ -658,6 +703,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot index 46ac1db8b24..ca3abed0463 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,754 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-call AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [117, 120], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [122, 124], + loc: { + start: { column: 7, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [117, 124], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + optional: false, + + range: [117, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [117, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [117, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [130, 133], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [135, 138], + loc: { + start: { column: 7, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [130, 138], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [139, 141], + loc: { + start: { column: 11, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [130, 141], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + optional: false, + + range: [130, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [130, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [130, 144], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [147, 150], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [151, 154], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [147, 154], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [156, 158], + loc: { + start: { column: 11, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [147, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + optional: false, + + range: [147, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [147, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [147, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [164, 167], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [168, 171], + loc: { + start: { column: 6, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [164, 171], + loc: { + start: { column: 2, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [173, 178], + loc: { + start: { column: 11, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + + range: [164, 178], + loc: { + start: { column: 2, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [179, 181], + loc: { + start: { column: 17, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [164, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + optional: false, + + range: [164, 183], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [164, 183], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [164, 184], + loc: { + start: { column: 2, line: 7 }, + end: { column: 22, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [187, 190], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [191, 194], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [187, 194], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [196, 201], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [187, 201], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [203, 205], + loc: { + start: { column: 18, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [187, 205], + loc: { + start: { column: 2, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + optional: false, + + range: [187, 207], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [187, 207], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [187, 208], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [212, 215], + loc: { + start: { column: 2, line: 10 }, + end: { column: 5, line: 10 }, + }, + }, + optional: true, + + range: [212, 219], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [212, 219], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [212, 220], + loc: { + start: { column: 2, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [223, 226], + loc: { + start: { column: 2, line: 11 }, + end: { column: 5, line: 11 }, + }, + }, + optional: true, + + range: [223, 230], + loc: { + start: { column: 2, line: 11 }, + end: { column: 9, line: 11 }, + }, + }, + optional: false, + + range: [223, 232], + loc: { + start: { column: 2, line: 11 }, + end: { column: 11, line: 11 }, + }, + }, + + range: [223, 232], + loc: { + start: { column: 2, line: 11 }, + end: { column: 11, line: 11 }, + }, + }, + + range: [223, 233], + loc: { + start: { column: 2, line: 11 }, + end: { column: 12, line: 11 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [236, 239], + loc: { + start: { column: 2, line: 12 }, + end: { column: 5, line: 12 }, + }, + }, + optional: true, + + range: [236, 243], + loc: { + start: { column: 2, line: 12 }, + end: { column: 9, line: 12 }, + }, + }, + optional: true, + + range: [236, 247], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [236, 247], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [236, 248], + loc: { + start: { column: 2, line: 12 }, + end: { column: 14, line: 12 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [252, 255], + loc: { + start: { column: 2, line: 14 }, + end: { column: 5, line: 14 }, + }, + }, + optional: true, + + range: [252, 259], + loc: { + start: { column: 2, line: 14 }, + end: { column: 9, line: 14 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [260, 263], + loc: { + start: { column: 10, line: 14 }, + end: { column: 13, line: 14 }, + }, + }, + + range: [252, 263], + loc: { + start: { column: 2, line: 14 }, + end: { column: 13, line: 14 }, + }, + }, + + range: [252, 263], + loc: { + start: { column: 2, line: 14 }, + end: { column: 13, line: 14 }, + }, + }, + + range: [252, 264], + loc: { + start: { column: 2, line: 14 }, + end: { column: 14, line: 14 }, + }, + }, + ], + + range: [113, 266], + loc: { + start: { column: 40, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalCall', +- optional: false, + + range: [82, 101], + loc: { + start: { column: 9, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [108, 111], + loc: { + start: { column: 35, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [106, 111], + loc: { + start: { column: 33, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [102, 111], + loc: { + start: { column: 29, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [73, 266], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 267], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 16 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot index c65995495de..928f012e228 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [113, 116], loc: { @@ -61,7 +63,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [127, 132], loc: { @@ -104,7 +108,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [137, 140], loc: { @@ -148,7 +154,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [152, 157], loc: { @@ -184,7 +192,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [162, 165], loc: { @@ -228,7 +238,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [177, 182], loc: { @@ -264,7 +276,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [186, 189], loc: { @@ -275,7 +289,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [191, 194], loc: { @@ -344,7 +360,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [209, 212], loc: { @@ -355,7 +373,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [214, 217], loc: { @@ -424,7 +444,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [233, 236], loc: { @@ -435,7 +457,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [238, 241], loc: { @@ -498,11 +522,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -513,6 +540,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot index dd256689be6..ab4bcf6e1ff 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,591 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-element-access-with-non-null-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '\\'two\\'', + value: 'two', + + range: [119, 124], + loc: { + start: { column: 8, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [113, 125], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [113, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [127, 132], + loc: { + start: { column: 16, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [113, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [113, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [113, 133], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [137, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '\\'two\\'', + value: 'two', + + range: [143, 148], + loc: { + start: { column: 9, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [137, 149], + loc: { + start: { column: 3, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [137, 149], + loc: { + start: { column: 3, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [136, 151], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [152, 157], + loc: { + start: { column: 18, line: 5 }, + end: { column: 23, line: 5 }, + }, + }, + + range: [136, 157], + loc: { + start: { column: 2, line: 5 }, + end: { column: 23, line: 5 }, + }, + }, + + range: [136, 158], + loc: { + start: { column: 2, line: 5 }, + end: { column: 24, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [162, 165], + loc: { + start: { column: 3, line: 6 }, + end: { column: 6, line: 6 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '\\'two\\'', + value: 'two', + + range: [168, 173], + loc: { + start: { column: 9, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + + range: [162, 174], + loc: { + start: { column: 3, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [162, 174], + loc: { + start: { column: 3, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [161, 176], + loc: { + start: { column: 2, line: 6 }, + end: { column: 17, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [177, 182], + loc: { + start: { column: 18, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + + range: [161, 182], + loc: { + start: { column: 2, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + + range: [161, 183], + loc: { + start: { column: 2, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [186, 189], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [191, 194], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [186, 194], + loc: { + start: { column: 2, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [186, 195], + loc: { + start: { column: 2, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '\\'three\\'', + value: 'three', + + range: [196, 203], + loc: { + start: { column: 12, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [186, 204], + loc: { + start: { column: 2, line: 7 }, + end: { column: 20, line: 7 }, + }, + }, + + range: [186, 204], + loc: { + start: { column: 2, line: 7 }, + end: { column: 20, line: 7 }, + }, + }, + + range: [186, 205], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [209, 212], + loc: { + start: { column: 3, line: 8 }, + end: { column: 6, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [214, 217], + loc: { + start: { column: 8, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + + range: [209, 217], + loc: { + start: { column: 3, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + + range: [209, 217], + loc: { + start: { column: 3, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + + range: [208, 219], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '\\'three\\'', + value: 'three', + + range: [220, 227], + loc: { + start: { column: 14, line: 8 }, + end: { column: 21, line: 8 }, + }, + }, + + range: [208, 228], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [208, 229], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [233, 236], + loc: { + start: { column: 3, line: 9 }, + end: { column: 6, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [238, 241], + loc: { + start: { column: 8, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [233, 241], + loc: { + start: { column: 3, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [233, 241], + loc: { + start: { column: 3, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [232, 243], + loc: { + start: { column: 2, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '\\'three\\'', + value: 'three', + + range: [244, 251], + loc: { + start: { column: 14, line: 9 }, + end: { column: 21, line: 9 }, + }, + }, + + range: [232, 252], + loc: { + start: { column: 2, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + + range: [232, 253], + loc: { + start: { column: 2, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + ], + + range: [109, 255], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 255], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 256], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot index cadafd1e927..88ec420d638 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [126, 129], loc: { @@ -72,7 +74,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [139, 142], loc: { @@ -144,7 +148,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [155, 158], loc: { @@ -219,7 +225,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [171, 174], loc: { @@ -313,7 +321,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [190, 193], loc: { @@ -410,7 +420,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [211, 214], loc: { @@ -516,11 +528,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptionalElementParens", + optional: false, range: [82, 110], loc: { @@ -531,6 +546,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot index 1e8a8d85074..55220826fb1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,597 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-element-access-with-parens AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [126, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [132, 133], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [126, 134], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [126, 134], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [126, 135], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [139, 142], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [145, 146], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [139, 147], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [139, 147], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [149, 150], + loc: { + start: { column: 13, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [138, 151], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [138, 152], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [155, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [159, 160], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + + range: [155, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 8, line: 6 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [164, 165], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [155, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [155, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [155, 167], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [171, 174], + loc: { + start: { column: 3, line: 7 }, + end: { column: 6, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [175, 176], + loc: { + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, + }, + }, + + range: [171, 177], + loc: { + start: { column: 3, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [180, 181], + loc: { + start: { column: 12, line: 7 }, + end: { column: 13, line: 7 }, + }, + }, + + range: [171, 182], + loc: { + start: { column: 3, line: 7 }, + end: { column: 14, line: 7 }, + }, + }, + + range: [171, 182], + loc: { + start: { column: 3, line: 7 }, + end: { column: 14, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [184, 185], + loc: { + start: { column: 16, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [170, 186], + loc: { + start: { column: 2, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + + range: [170, 187], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [190, 193], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [194, 195], + loc: { + start: { column: 6, line: 8 }, + end: { column: 7, line: 8 }, + }, + }, + + range: [190, 196], + loc: { + start: { column: 2, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [199, 200], + loc: { + start: { column: 11, line: 8 }, + end: { column: 12, line: 8 }, + }, + }, + + range: [190, 201], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [204, 205], + loc: { + start: { column: 16, line: 8 }, + end: { column: 17, line: 8 }, + }, + }, + + range: [190, 206], + loc: { + start: { column: 2, line: 8 }, + end: { column: 18, line: 8 }, + }, + }, + + range: [190, 206], + loc: { + start: { column: 2, line: 8 }, + end: { column: 18, line: 8 }, + }, + }, + + range: [190, 207], + loc: { + start: { column: 2, line: 8 }, + end: { column: 19, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [211, 214], + loc: { + start: { column: 3, line: 9 }, + end: { column: 6, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [215, 216], + loc: { + start: { column: 7, line: 9 }, + end: { column: 8, line: 9 }, + }, + }, + + range: [211, 217], + loc: { + start: { column: 3, line: 9 }, + end: { column: 9, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [220, 221], + loc: { + start: { column: 12, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + + range: [211, 222], + loc: { + start: { column: 3, line: 9 }, + end: { column: 14, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [225, 226], + loc: { + start: { column: 17, line: 9 }, + end: { column: 18, line: 9 }, + }, + }, + + range: [211, 227], + loc: { + start: { column: 3, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + + range: [211, 227], + loc: { + start: { column: 3, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '5', + value: 5, + + range: [229, 230], + loc: { + start: { column: 21, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + + range: [210, 231], + loc: { + start: { column: 2, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + + range: [210, 232], + loc: { + start: { column: 2, line: 9 }, + end: { column: 24, line: 9 }, + }, + }, + ], + + range: [122, 234], + loc: { + start: { column: 49, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalElementParens', +- optional: false, + + range: [82, 110], + loc: { + start: { column: 9, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [117, 120], + loc: { + start: { column: 44, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [115, 120], + loc: { + start: { column: 42, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [111, 120], + loc: { + start: { column: 38, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], + + range: [73, 234], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 235], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot index 8b5125a5502..c56f2b5eb81 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [120, 123], loc: { @@ -72,7 +74,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [132, 135], loc: { @@ -144,7 +148,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [147, 150], loc: { @@ -216,7 +222,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [162, 165], loc: { @@ -291,7 +299,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [177, 180], loc: { @@ -385,7 +395,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [195, 198], loc: { @@ -472,11 +484,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptionalElement", + optional: false, range: [82, 104], loc: { @@ -487,6 +502,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot index dc5647c5cbe..41e81dfd102 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,553 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-element-access AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [120, 123], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [126, 127], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [120, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [120, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [120, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [132, 135], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [138, 139], + loc: { + start: { column: 8, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + + range: [132, 140], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [141, 142], + loc: { + start: { column: 11, line: 5 }, + end: { column: 12, line: 5 }, + }, + }, + + range: [132, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [132, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [132, 144], + loc: { + start: { column: 2, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [147, 150], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [151, 152], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + + range: [147, 153], + loc: { + start: { column: 2, line: 6 }, + end: { column: 8, line: 6 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [156, 157], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [147, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [147, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [147, 159], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [162, 165], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [166, 167], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + + range: [162, 168], + loc: { + start: { column: 2, line: 7 }, + end: { column: 8, line: 7 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [171, 172], + loc: { + start: { column: 11, line: 7 }, + end: { column: 12, line: 7 }, + }, + }, + + range: [162, 173], + loc: { + start: { column: 2, line: 7 }, + end: { column: 13, line: 7 }, + }, + }, + + range: [162, 173], + loc: { + start: { column: 2, line: 7 }, + end: { column: 13, line: 7 }, + }, + }, + + range: [162, 174], + loc: { + start: { column: 2, line: 7 }, + end: { column: 14, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [177, 180], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [181, 182], + loc: { + start: { column: 6, line: 8 }, + end: { column: 7, line: 8 }, + }, + }, + + range: [177, 183], + loc: { + start: { column: 2, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [186, 187], + loc: { + start: { column: 11, line: 8 }, + end: { column: 12, line: 8 }, + }, + }, + + range: [177, 188], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [189, 190], + loc: { + start: { column: 14, line: 8 }, + end: { column: 15, line: 8 }, + }, + }, + + range: [177, 191], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [177, 191], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [177, 192], + loc: { + start: { column: 2, line: 8 }, + end: { column: 17, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [195, 198], + loc: { + start: { column: 2, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [199, 200], + loc: { + start: { column: 6, line: 9 }, + end: { column: 7, line: 9 }, + }, + }, + + range: [195, 201], + loc: { + start: { column: 2, line: 9 }, + end: { column: 8, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [204, 205], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + + range: [195, 206], + loc: { + start: { column: 2, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [209, 210], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + + range: [195, 211], + loc: { + start: { column: 2, line: 9 }, + end: { column: 18, line: 9 }, + }, + }, + + range: [195, 211], + loc: { + start: { column: 2, line: 9 }, + end: { column: 18, line: 9 }, + }, + }, + + range: [195, 212], + loc: { + start: { column: 2, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + ], + + range: [116, 214], + loc: { + start: { column: 43, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalElement', +- optional: false, + + range: [82, 104], + loc: { + start: { column: 9, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [111, 114], + loc: { + start: { column: 38, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [109, 114], + loc: { + start: { column: 36, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [105, 114], + loc: { + start: { column: 32, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [73, 214], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 215], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot index 43dc0c615f9..3b2dc4240eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [113, 116], loc: { @@ -35,7 +37,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [118, 121], loc: { @@ -60,7 +64,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [123, 128], loc: { @@ -103,7 +109,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [133, 136], loc: { @@ -114,7 +122,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [138, 141], loc: { @@ -146,7 +156,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [144, 149], loc: { @@ -182,7 +194,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [154, 157], loc: { @@ -193,7 +207,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [159, 162], loc: { @@ -225,7 +241,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [165, 170], loc: { @@ -255,11 +273,14 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -270,6 +291,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot index 633b2b7bf60..f8f7fba79fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,342 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-with-non-null-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [123, 128], + loc: { + start: { column: 12, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [113, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [113, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [113, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [133, 136], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [138, 141], + loc: { + start: { column: 8, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [133, 141], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [133, 141], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [132, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [144, 149], + loc: { + start: { column: 14, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [132, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [132, 150], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [154, 157], + loc: { + start: { column: 3, line: 6 }, + end: { column: 6, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [159, 162], + loc: { + start: { column: 8, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + + range: [154, 162], + loc: { + start: { column: 3, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + + range: [154, 162], + loc: { + start: { column: 3, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + + range: [153, 164], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [165, 170], + loc: { + start: { column: 14, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [153, 170], + loc: { + start: { column: 2, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [153, 171], + loc: { + start: { column: 2, line: 6 }, + end: { column: 20, line: 6 }, + }, + }, + ], + + range: [109, 173], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 173], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 174], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot index c664c59e267..5f4d6fcc648 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [119, 122], loc: { @@ -30,7 +32,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [124, 127], loc: { @@ -71,7 +75,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [132, 135], loc: { @@ -82,7 +88,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [137, 140], loc: { @@ -107,7 +115,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [142, 147], loc: { @@ -141,7 +151,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [151, 154], loc: { @@ -152,7 +164,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [155, 158], loc: { @@ -170,7 +184,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [160, 165], loc: { @@ -214,7 +230,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [170, 173], loc: { @@ -225,7 +243,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [174, 177], loc: { @@ -243,7 +263,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [179, 184], loc: { @@ -268,7 +290,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "four", + optional: false, range: [186, 190], loc: { @@ -305,7 +329,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [194, 197], loc: { @@ -316,7 +342,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [198, 201], loc: { @@ -334,7 +362,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [203, 208], loc: { @@ -352,7 +382,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "four", + optional: false, range: [210, 214], loc: { @@ -399,7 +431,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [219, 222], loc: { @@ -410,7 +444,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [223, 226], loc: { @@ -428,7 +464,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [228, 233], loc: { @@ -446,7 +484,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "four", + optional: false, range: [235, 239], loc: { @@ -471,7 +511,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "five", + optional: false, range: [241, 245], loc: { @@ -501,11 +543,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptionalParens", + optional: false, range: [82, 103], loc: { @@ -516,6 +561,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot index 1b2f2b79375..9641828c0eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,612 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-with-parens AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [119, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [124, 127], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [119, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [119, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [119, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [132, 135], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [137, 140], + loc: { + start: { column: 8, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [132, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [132, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [142, 147], + loc: { + start: { column: 13, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + + range: [131, 147], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + + range: [131, 148], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [151, 154], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [155, 158], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [151, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [160, 165], + loc: { + start: { column: 11, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [151, 165], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [151, 165], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [151, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 17, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [170, 173], + loc: { + start: { column: 3, line: 7 }, + end: { column: 6, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [174, 177], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [170, 177], + loc: { + start: { column: 3, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [179, 184], + loc: { + start: { column: 12, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [170, 184], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [170, 184], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [186, 190], + loc: { + start: { column: 19, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [169, 190], + loc: { + start: { column: 2, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [169, 191], + loc: { + start: { column: 2, line: 7 }, + end: { column: 24, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [194, 197], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [198, 201], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [194, 201], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [203, 208], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [194, 208], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [210, 214], + loc: { + start: { column: 18, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [194, 214], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [194, 214], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [194, 215], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [219, 222], + loc: { + start: { column: 3, line: 9 }, + end: { column: 6, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [223, 226], + loc: { + start: { column: 7, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + + range: [219, 226], + loc: { + start: { column: 3, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [228, 233], + loc: { + start: { column: 12, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + + range: [219, 233], + loc: { + start: { column: 3, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [235, 239], + loc: { + start: { column: 19, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + + range: [219, 239], + loc: { + start: { column: 3, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + + range: [219, 239], + loc: { + start: { column: 3, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'five', +- optional: false, + + range: [241, 245], + loc: { + start: { column: 25, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [218, 245], + loc: { + start: { column: 2, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [218, 246], + loc: { + start: { column: 2, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + + range: [115, 248], + loc: { + start: { column: 42, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalParens', +- optional: false, + + range: [82, 103], + loc: { + start: { column: 9, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [110, 113], + loc: { + start: { column: 37, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [108, 113], + loc: { + start: { column: 35, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [104, 113], + loc: { + start: { column: 31, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + ], + + range: [73, 248], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 249], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot index f45a86301ab..eb382a40c48 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [113, 116], loc: { @@ -30,7 +32,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [118, 121], loc: { @@ -71,7 +75,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [125, 128], loc: { @@ -82,7 +88,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [130, 133], loc: { @@ -100,7 +108,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [134, 139], loc: { @@ -141,7 +151,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [143, 146], loc: { @@ -152,7 +164,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [147, 150], loc: { @@ -170,7 +184,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [152, 157], loc: { @@ -214,7 +230,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [161, 164], loc: { @@ -225,7 +243,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [165, 168], loc: { @@ -243,7 +263,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [170, 175], loc: { @@ -261,7 +283,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "four", + optional: false, range: [176, 180], loc: { @@ -305,7 +329,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "one", + optional: false, range: [184, 187], loc: { @@ -316,7 +342,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "two", + optional: false, range: [188, 191], loc: { @@ -334,7 +362,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "three", + optional: false, range: [193, 198], loc: { @@ -352,7 +382,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "four", + optional: false, range: [200, 204], loc: { @@ -389,11 +421,14 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -404,6 +439,7 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot index 92619481bec..591495e977f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,490 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [125, 128], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [130, 133], + loc: { + start: { column: 7, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [125, 133], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [134, 139], + loc: { + start: { column: 11, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + + range: [125, 139], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + + range: [125, 139], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + + range: [125, 140], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [143, 146], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [147, 150], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [143, 150], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [152, 157], + loc: { + start: { column: 11, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [143, 157], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [143, 157], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [143, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 17, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [161, 164], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [165, 168], + loc: { + start: { column: 6, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [161, 168], + loc: { + start: { column: 2, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [170, 175], + loc: { + start: { column: 11, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + + range: [161, 175], + loc: { + start: { column: 2, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [176, 180], + loc: { + start: { column: 17, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [161, 180], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [161, 180], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [161, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 22, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [184, 187], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [188, 191], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [184, 191], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [193, 198], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [184, 198], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [200, 204], + loc: { + start: { column: 18, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [184, 204], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [184, 204], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [184, 205], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ], + + range: [109, 207], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 9 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 207], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 9 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 208], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 10 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot index 6b02a892b82..a48d2ed4cb3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "prop1", @@ -23,7 +26,9 @@ Program { end: { column: 8, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -36,9 +41,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method", + optional: false, range: [97, 103], loc: { @@ -47,6 +55,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -72,7 +81,9 @@ Program { operator: "in", right: Identifier { type: "Identifier", + decorators: [], name: "arg", + optional: false, range: [132, 135], loc: { @@ -102,13 +113,16 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "arg", + optional: false, range: [104, 107], loc: { @@ -139,9 +153,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -149,6 +167,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 142], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot index 5d3082bbb16..95abc2ac122 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'prop1', @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 8, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -40,9 +45,12 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [97, 103], loc: { @@ -51,6 +59,7 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -76,7 +85,9 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment operator: 'in', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'arg', +- optional: false, range: [132, 135], loc: { @@ -106,13 +117,16 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'arg', +- optional: false, range: [104, 107], loc: { @@ -143,9 +157,13 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -153,6 +171,7 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 142], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot index c124f4f8825..ede389b531e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot @@ -20,7 +20,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "arr", + optional: false, range: [118, 121], loc: { @@ -31,7 +33,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "slice", + optional: false, range: [122, 127], loc: { @@ -83,7 +87,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "arr", + optional: false, range: [141, 144], loc: { @@ -94,7 +100,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "push", + optional: false, range: [145, 149], loc: { @@ -132,11 +140,14 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -147,22 +158,14 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "arr", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "ReadonlyArray", - - range: [91, 104], - loc: { - start: { column: 18, line: 3 }, - end: { column: 31, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSStringKeyword { @@ -182,6 +185,18 @@ Program { end: { column: 39, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "ReadonlyArray", + optional: false, + + range: [91, 104], + loc: { + start: { column: 18, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, range: [91, 112], loc: { @@ -227,7 +242,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "arr", + optional: false, range: [215, 218], loc: { @@ -238,7 +255,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "slice", + optional: false, range: [219, 224], loc: { @@ -290,7 +309,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "arr", + optional: false, range: [238, 241], loc: { @@ -301,7 +322,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "push", + optional: false, range: [242, 246], loc: { @@ -339,11 +362,14 @@ Program { end: { column: 1, line: 11 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [183, 186], loc: { @@ -354,7 +380,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "arr", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot index 8dceef59343..37073223f85 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,461 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'arr', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'slice', +- optional: false, + + range: [122, 127], + loc: { + start: { column: 6, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [118, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + optional: false, + + range: [118, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [118, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + Literal { + type: 'Literal', + raw: '\\'hello!\\'', + value: 'hello!', + + range: [150, 158], + loc: { + start: { column: 11, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + ], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'arr', +- optional: false, + + range: [141, 144], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'push', +- optional: false, + + range: [145, 149], + loc: { + start: { column: 6, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [141, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + + range: [141, 159], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + + range: [141, 160], + loc: { + start: { column: 2, line: 5 }, + end: { column: 21, line: 5 }, + }, + }, + ], + + range: [114, 172], + loc: { + start: { column: 41, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'arr', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'ReadonlyArray', ++ ++ range: [91, 104], ++ loc: { ++ start: { column: 18, line: 3 }, ++ end: { column: 31, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [104, 112], + loc: { + start: { column: 31, line: 3 }, + end: { column: 39, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'ReadonlyArray', +- optional: false, +- +- range: [91, 104], +- loc: { +- start: { column: 18, line: 3 }, +- end: { column: 31, line: 3 }, + }, + }, + + range: [91, 112], + loc: { + start: { column: 18, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + + range: [89, 112], + loc: { + start: { column: 16, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + + range: [86, 112], + loc: { + start: { column: 13, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + ], + + range: [73, 172], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'arr', +- optional: false, + + range: [215, 218], + loc: { + start: { column: 2, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'slice', +- optional: false, + + range: [219, 224], + loc: { + start: { column: 6, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [215, 224], + loc: { + start: { column: 2, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + optional: false, + + range: [215, 226], + loc: { + start: { column: 2, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + + range: [215, 227], + loc: { + start: { column: 2, line: 9 }, + end: { column: 14, line: 9 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + Literal { + type: 'Literal', + raw: '\\'hello!\\'', + value: 'hello!', + + range: [247, 255], + loc: { + start: { column: 11, line: 10 }, + end: { column: 19, line: 10 }, + }, + }, + ], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'arr', +- optional: false, + + range: [238, 241], + loc: { + start: { column: 2, line: 10 }, + end: { column: 5, line: 10 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'push', +- optional: false, + + range: [242, 246], + loc: { + start: { column: 6, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + + range: [238, 246], + loc: { + start: { column: 2, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + optional: false, + + range: [238, 256], + loc: { + start: { column: 2, line: 10 }, + end: { column: 20, line: 10 }, + }, + }, + + range: [238, 257], + loc: { + start: { column: 2, line: 10 }, + end: { column: 21, line: 10 }, + }, + }, + ], + + range: [211, 269], + loc: { + start: { column: 37, line: 8 }, + end: { column: 1, line: 11 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [183, 186], + loc: { + start: { column: 9, line: 8 }, + end: { column: 12, line: 8 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'arr', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'readonly', + typeAnnotation: TSArrayType { + type: 'TSArrayType', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [201, 207], + loc: { + start: { column: 27, line: 8 }, + end: { column: 33, line: 8 }, + }, + }, + + range: [201, 209], + loc: { + start: { column: 27, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + + range: [192, 209], + loc: { + start: { column: 18, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + + range: [190, 209], + loc: { + start: { column: 16, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + + range: [187, 209], + loc: { + start: { column: 13, line: 8 }, + end: { column: 35, line: 8 }, + }, + }, + ], + + range: [174, 269], + loc: { + start: { column: 0, line: 8 }, + end: { column: 1, line: 11 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 270], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 12 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot index 48119b57c75..e732d7e7225 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot @@ -20,7 +20,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "pair", + optional: false, range: [135, 139], loc: { @@ -53,7 +55,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "console", + optional: false, range: [123, 130], loc: { @@ -64,7 +68,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "log", + optional: false, range: [131, 134], loc: { @@ -103,7 +109,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: [], name: "pair", + optional: false, range: [155, 159], loc: { @@ -164,11 +172,14 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -179,7 +190,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "pair", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot index 19033edfa0d..7a8ca30ac4f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,271 @@ exports[`AST Fixtures legacy-fixtures basics readonly-tuples AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'pair', +- optional: false, + + range: [135, 139], + loc: { + start: { column: 14, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [140, 141], + loc: { + start: { column: 19, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [135, 142], + loc: { + start: { column: 14, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'console', +- optional: false, + + range: [123, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'log', +- optional: false, + + range: [131, 134], + loc: { + start: { column: 10, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [123, 134], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + optional: false, + + range: [123, 143], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + + range: [123, 144], + loc: { + start: { column: 2, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'pair', +- optional: false, + + range: [155, 159], + loc: { + start: { column: 2, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [160, 161], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + + range: [155, 162], + loc: { + start: { column: 2, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '\\'hello!\\'', + value: 'hello!', + + range: [165, 173], + loc: { + start: { column: 12, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + + range: [155, 173], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + + range: [155, 174], + loc: { + start: { column: 2, line: 5 }, + end: { column: 21, line: 5 }, + }, + }, + ], + + range: [119, 185], + loc: { + start: { column: 46, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'pair', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'readonly', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [102, 108], + loc: { + start: { column: 29, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + TSStringKeyword { + type: 'TSStringKeyword', + + range: [110, 116], + loc: { + start: { column: 37, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + + range: [101, 117], + loc: { + start: { column: 28, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [92, 117], + loc: { + start: { column: 19, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [90, 117], + loc: { + start: { column: 17, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [86, 117], + loc: { + start: { column: 13, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + + range: [73, 185], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 186], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot index c48fbc7c676..f4dec558585 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "AssignmentExpression", left: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [73, 74], loc: { @@ -21,7 +23,9 @@ Program { operator: "||=", right: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [79, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot index 75095e76894..99a21d3bb10 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures legacy-fixtures basics short-circuiting-assignment-and-and AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '||=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot index 070ffd82aed..98d155ef7a6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "AssignmentExpression", left: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [73, 74], loc: { @@ -21,7 +23,9 @@ Program { operator: "&&=", right: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [79, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot index 99034f0c682..29af9275803 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures legacy-fixtures basics short-circuiting-assignment-or-or AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '&&=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot index 23a4dbc9f5d..eb7bd2162c6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "AssignmentExpression", left: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [73, 74], loc: { @@ -21,7 +23,9 @@ Program { operator: "??=", right: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [79, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot index 225b4642d6d..d54020e37f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures legacy-fixtures basics short-circuiting-assignment-question-question AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '??=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot index 1e534994de5..8214d0f3e51 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 42, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "test", + optional: false, range: [82, 86], loc: { @@ -32,22 +35,14 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "abc", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Map", - - range: [92, 95], - loc: { - start: { column: 19, line: 3 }, - end: { column: 22, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSSymbolKeyword { @@ -76,6 +71,18 @@ Program { end: { column: 38, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Map", + optional: false, + + range: [92, 95], + loc: { + start: { column: 19, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, range: [92, 111], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot index e99b60c13e3..b6d43bac4df 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,138 @@ exports[`AST Fixtures legacy-fixtures basics symbol-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [113, 115], + loc: { + start: { column: 40, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [82, 86], + loc: { + start: { column: 9, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abc', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Map', ++ ++ range: [92, 95], ++ loc: { ++ start: { column: 19, line: 3 }, ++ end: { column: 22, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + TSStringKeyword { + type: 'TSStringKeyword', + + range: [104, 110], + loc: { + start: { column: 31, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + + range: [95, 111], + loc: { + start: { column: 22, line: 3 }, + end: { column: 38, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Map', +- optional: false, +- +- range: [92, 95], +- loc: { +- start: { column: 19, line: 3 }, +- end: { column: 22, line: 3 }, + }, + }, + + range: [92, 111], + loc: { + start: { column: 19, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [90, 111], + loc: { + start: { column: 17, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [87, 111], + loc: { + start: { column: 14, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [73, 115], + loc: { + start: { column: 0, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 116], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot index 3b59325ddb6..a08cd544ed3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "TestCallback", + optional: false, range: [85, 97], loc: { @@ -24,7 +27,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot index 80b2ec22efd..616277e27e3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-funct assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'TestCallback', +- optional: false, range: [85, 97], loc: { @@ -29,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-funct + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot index f58fd04a8c5..de0e8827cce 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "TestClassProps", + optional: false, range: [85, 99], loc: { @@ -27,7 +30,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "count", + optional: false, range: [106, 111], loc: { @@ -35,6 +40,9 @@ Program { end: { column: 7, line: 4 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot index c5fc765d0c2..9f9b094633b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-objec assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'TestClassProps', +- optional: false, range: [85, 99], loc: { @@ -31,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-objec computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'count', +- optional: false, range: [106, 111], loc: { @@ -39,6 +44,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-objec end: { column: 7, line: 4 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot index 861f3c6fc67..ffe2ae38c04 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "TestAlias", + optional: false, range: [85, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot index c9403c51801..a36c1ee31da 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export AST A assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'TestAlias', +- optional: false, range: [85, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot index c9e307bfb33..1dcb3545978 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Result", + optional: false, range: [78, 84], loc: { @@ -21,24 +24,16 @@ Program { types: [ TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Success", - - range: [101, 108], - loc: { - start: { column: 28, line: 3 }, - end: { column: 35, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [109, 110], loc: { @@ -61,6 +56,18 @@ Program { end: { column: 38, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Success", + optional: false, + + range: [101, 108], + loc: { + start: { column: 28, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, range: [101, 111], loc: { @@ -72,7 +79,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Failure", + optional: false, range: [114, 121], loc: { @@ -114,7 +123,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [85, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot index e451c313454..0ebd18b65e0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Result', +- optional: false, range: [78, 84], loc: { @@ -25,24 +28,27 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra types: Array [ TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Success', - - range: [101, 108], - loc: { - start: { column: 28, line: 3 }, - end: { column: 35, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Success', ++ ++ range: [101, 108], ++ loc: { ++ start: { column: 28, line: 3 }, ++ end: { column: 35, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [109, 110], loc: { @@ -65,7 +71,19 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra end: { column: 38, line: 3 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Success', +- optional: false, +- range: [101, 108], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 35, line: 3 }, +- }, +- }, +- range: [101, 111], loc: { start: { column: 28, line: 3 }, @@ -76,7 +94,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Failure', +- optional: false, range: [114, 121], loc: { @@ -118,7 +138,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [85, 86], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot index 8175a87d5b0..7b87092ccd2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Result", + optional: false, range: [78, 84], loc: { @@ -21,24 +24,16 @@ Program { types: [ TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Success", - - range: [90, 97], - loc: { - start: { column: 17, line: 3 }, - end: { column: 24, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [98, 99], loc: { @@ -61,6 +56,18 @@ Program { end: { column: 27, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Success", + optional: false, + + range: [90, 97], + loc: { + start: { column: 17, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, range: [90, 100], loc: { @@ -72,7 +79,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Failure", + optional: false, range: [103, 110], loc: { @@ -104,7 +113,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [85, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot index 95d18c2f62c..d4dec2c54de 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Result', +- optional: false, range: [78, 84], loc: { @@ -25,24 +28,27 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen types: Array [ TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Success', - - range: [90, 97], - loc: { - start: { column: 17, line: 3 }, - end: { column: 24, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Success', ++ ++ range: [90, 97], ++ loc: { ++ start: { column: 17, line: 3 }, ++ end: { column: 24, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [98, 99], loc: { @@ -65,7 +71,19 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen end: { column: 27, line: 3 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Success', +- optional: false, +- range: [90, 97], +- loc: { +- start: { column: 17, line: 3 }, +- end: { column: 24, line: 3 }, +- }, +- }, +- range: [90, 100], loc: { start: { column: 17, line: 3 }, @@ -76,7 +94,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Failure', +- optional: false, range: [103, 110], loc: { @@ -108,7 +128,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [85, 86], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot index 8daa9d702f4..b1b63f207b7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [86, 89], loc: { @@ -32,6 +37,9 @@ Program { end: { column: 16, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -62,7 +70,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [99, 102], loc: { @@ -70,6 +80,9 @@ Program { end: { column: 29, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, range: [99, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot index f7ab811dca3..21231297b43 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,120 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-object-without-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [91, 97], + loc: { + start: { column: 18, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [89, 97], + loc: { + start: { column: 16, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [86, 98], + loc: { + start: { column: 13, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [99, 102], + loc: { + start: { column: 26, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [99, 102], + loc: { + start: { column: 26, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + + range: [84, 104], + loc: { + start: { column: 11, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [73, 105], + loc: { + start: { column: 0, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 106], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot index eaa25a49229..53498ed9f95 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "assertString", + optional: false, range: [79, 91], loc: { @@ -49,7 +52,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -83,7 +88,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [112, 113], loc: { @@ -121,6 +128,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 131], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot index db812258aef..960bd95fdf5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,152 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertString', +- optional: false, + + range: [79, 91], + loc: { + start: { column: 6, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + init: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [121, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [117, 130], + loc: { + start: { column: 44, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [98, 101], + loc: { + start: { column: 25, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [112, 113], + loc: { + start: { column: 39, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + typeAnnotation: null, + + range: [104, 113], + loc: { + start: { column: 31, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [102, 113], + loc: { + start: { column: 29, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [94, 130], + loc: { + start: { column: 21, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [79, 130], + loc: { + start: { column: 6, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 131], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 132], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot index 6831aafee65..4db97e14119 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot @@ -28,11 +28,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "assertsString", + optional: false, range: [82, 95], loc: { @@ -43,7 +46,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -77,7 +82,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [113, 114], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot index ba5f295254c..d3f432622b6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,129 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [119, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [115, 128], + loc: { + start: { column: 42, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertsString', +- optional: false, + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [99, 102], + loc: { + start: { column: 26, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [97, 102], + loc: { + start: { column: 24, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [113, 114], + loc: { + start: { column: 40, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + typeAnnotation: null, + + range: [105, 114], + loc: { + start: { column: 32, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [103, 114], + loc: { + start: { column: 30, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [73, 128], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 129], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot index 98a32fbd347..e71b995c240 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "isString", + optional: false, range: [97, 105], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "node", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypePredicate { @@ -60,7 +66,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: [], name: "node", + optional: false, range: [126, 130], loc: { @@ -83,6 +91,7 @@ Program { end: { column: 35, line: 4 }, }, }, + static: false, range: [97, 131], loc: { @@ -98,9 +107,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "AssertFoo", + optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot index 3b65ab51b59..867fc42b1d1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isString', +- optional: false, range: [97, 105], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -66,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali asserts: true, parameterName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, range: [126, 130], loc: { @@ -89,6 +97,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali end: { column: 35, line: 4 }, }, }, +- static: false, range: [97, 131], loc: { @@ -104,9 +113,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertFoo', +- optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot index 767424fd863..210e38644ee 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "isBar", + optional: false, range: [94, 99], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -49,6 +54,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -100,9 +106,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "isBaz", + optional: false, range: [136, 141], loc: { @@ -110,7 +120,9 @@ Program { end: { column: 7, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrowFunctionExpression { type: "ArrowFunctionExpression", @@ -191,9 +203,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "AssertsFoo", + optional: false, range: [79, 89], loc: { @@ -201,6 +217,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 184], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot index 198bf8d2a0a..b416df4adad 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBar', +- optional: false, range: [94, 99], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -53,6 +58,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -104,9 +110,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBaz', +- optional: false, range: [136, 141], loc: { @@ -114,7 +124,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 7, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrowFunctionExpression { type: 'ArrowFunctionExpression', @@ -195,9 +207,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertsFoo', +- optional: false, range: [79, 89], loc: { @@ -205,6 +221,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 184], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot index 807e672b1f1..028e05648aa 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "assertString", + optional: false, range: [79, 91], loc: { @@ -49,7 +52,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -83,7 +88,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [112, 113], loc: { @@ -138,6 +145,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 141], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot index c32f552cc73..09c0093329f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,169 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertString', +- optional: false, + + range: [79, 91], + loc: { + start: { column: 6, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + init: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [131, 138], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [127, 140], + loc: { + start: { column: 54, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [98, 101], + loc: { + start: { column: 25, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [112, 113], + loc: { + start: { column: 39, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [117, 123], + loc: { + start: { column: 44, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [117, 123], + loc: { + start: { column: 44, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [104, 123], + loc: { + start: { column: 31, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [102, 123], + loc: { + start: { column: 29, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [94, 140], + loc: { + start: { column: 21, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [79, 140], + loc: { + start: { column: 6, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 141], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 142], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot index b1e44ff5204..d0095188116 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot @@ -28,11 +28,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "assertsStringGuard", + optional: false, range: [82, 100], loc: { @@ -43,7 +46,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -77,7 +82,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [118, 119], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot index f26ffee877f..1604dae2c4b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,146 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [134, 141], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [130, 143], + loc: { + start: { column: 57, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertsStringGuard', +- optional: false, + + range: [82, 100], + loc: { + start: { column: 9, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [101, 107], + loc: { + start: { column: 28, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [118, 119], + loc: { + start: { column: 45, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [123, 129], + loc: { + start: { column: 50, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [123, 129], + loc: { + start: { column: 50, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [110, 129], + loc: { + start: { column: 37, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [108, 129], + loc: { + start: { column: 35, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [73, 143], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 144], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot index af78d362c21..762b8a17f8d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "isString", + optional: false, range: [97, 105], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "node", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypePredicate { @@ -60,7 +66,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: [], name: "node", + optional: false, range: [126, 130], loc: { @@ -100,6 +108,7 @@ Program { end: { column: 45, line: 4 }, }, }, + static: false, range: [97, 141], loc: { @@ -115,9 +124,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "AssertFoo", + optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot index c5d8b48f175..196173c257b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isString', +- optional: false, range: [97, 105], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -66,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf asserts: true, parameterName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, range: [126, 130], loc: { @@ -106,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf end: { column: 45, line: 4 }, }, }, +- static: false, range: [97, 141], loc: { @@ -121,9 +130,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertFoo', +- optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot index dcbca050ea5..0259325758f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "isBar", + optional: false, range: [94, 99], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -49,6 +54,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -117,9 +123,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "isBaz", + optional: false, range: [146, 151], loc: { @@ -127,7 +137,9 @@ Program { end: { column: 7, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrowFunctionExpression { type: "ArrowFunctionExpression", @@ -225,9 +237,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "AssertsFoo", + optional: false, range: [79, 89], loc: { @@ -235,6 +251,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 204], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot index 0477b699d6b..38645b843ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBar', +- optional: false, range: [94, 99], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -53,6 +58,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -121,9 +127,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBaz', +- optional: false, range: [146, 151], loc: { @@ -131,7 +141,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 7, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrowFunctionExpression { type: 'ArrowFunctionExpression', @@ -229,9 +241,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertsFoo', +- optional: false, range: [79, 89], loc: { @@ -239,6 +255,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 204], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot index 6450b0a1c00..d6489dbe453 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "isString", + optional: false, range: [79, 87], loc: { @@ -33,7 +36,9 @@ Program { type: "UnaryExpression", argument: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [133, 134], loc: { @@ -90,7 +95,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -124,7 +131,9 @@ Program { asserts: false, parameterName: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [100, 101], loc: { @@ -179,6 +188,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 151], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot index d53c65828a2..5dc8057cb71 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,212 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'isString', +- optional: false, + + range: [79, 87], + loc: { + start: { column: 6, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + init: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: BinaryExpression { + type: 'BinaryExpression', + left: UnaryExpression { + type: 'UnaryExpression', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [133, 134], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: 'typeof', + prefix: true, + + range: [126, 134], + loc: { + start: { column: 9, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: '===', + right: Literal { + type: 'Literal', + raw: '\\'string\\'', + value: 'string', + + range: [139, 147], + loc: { + start: { column: 22, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [126, 147], + loc: { + start: { column: 9, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [119, 148], + loc: { + start: { column: 2, line: 4 }, + end: { column: 31, line: 4 }, + }, + }, + ], + + range: [115, 150], + loc: { + start: { column: 42, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [94, 97], + loc: { + start: { column: 21, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 19, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [91, 97], + loc: { + start: { column: 18, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: false, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [100, 101], + loc: { + start: { column: 27, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [100, 111], + loc: { + start: { column: 27, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [98, 111], + loc: { + start: { column: 25, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [90, 150], + loc: { + start: { column: 17, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [79, 150], + loc: { + start: { column: 6, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 151], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot index ddf991e4e45..35284cc804c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot @@ -18,7 +18,9 @@ Program { type: "UnaryExpression", argument: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [130, 131], loc: { @@ -69,11 +71,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "isString", + optional: false, range: [82, 90], loc: { @@ -84,7 +89,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -118,7 +125,9 @@ Program { asserts: false, parameterName: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [100, 101], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot index a14b4cb26df..f3fb0657c32 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,189 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: BinaryExpression { + type: 'BinaryExpression', + left: UnaryExpression { + type: 'UnaryExpression', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [130, 131], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: 'typeof', + prefix: true, + + range: [123, 131], + loc: { + start: { column: 9, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: '===', + right: Literal { + type: 'Literal', + raw: '\\'string\\'', + value: 'string', + + range: [136, 144], + loc: { + start: { column: 22, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [123, 144], + loc: { + start: { column: 9, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [116, 145], + loc: { + start: { column: 2, line: 4 }, + end: { column: 31, line: 4 }, + }, + }, + ], + + range: [112, 147], + loc: { + start: { column: 39, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'isString', +- optional: false, + + range: [82, 90], + loc: { + start: { column: 9, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [94, 97], + loc: { + start: { column: 21, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 19, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [91, 97], + loc: { + start: { column: 18, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: false, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [100, 101], + loc: { + start: { column: 27, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [100, 111], + loc: { + start: { column: 27, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [98, 111], + loc: { + start: { column: 25, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [73, 147], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 148], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot index 46fd37dbe37..2889ed0582a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "isString", + optional: false, range: [91, 99], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "node", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypePredicate { @@ -60,7 +66,9 @@ Program { asserts: false, parameterName: Identifier { type: "Identifier", + decorators: [], name: "node", + optional: false, range: [112, 116], loc: { @@ -100,6 +108,7 @@ Program { end: { column: 37, line: 4 }, }, }, + static: false, range: [91, 127], loc: { @@ -115,9 +124,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot index da5fc1fa0ac..86b50d0ea33 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isString', +- optional: false, range: [91, 99], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -66,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme asserts: false, parameterName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, range: [112, 116], loc: { @@ -106,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme end: { column: 37, line: 4 }, }, }, +- static: false, range: [91, 127], loc: { @@ -121,9 +130,13 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot index b4bf6d1f888..091f3d4a2b4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "isBar", + optional: false, range: [87, 92], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -47,7 +52,9 @@ Program { operator: "instanceof", right: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [140, 143], loc: { @@ -77,6 +84,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -145,9 +153,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "isBaz", + optional: false, range: [151, 156], loc: { @@ -155,7 +167,9 @@ Program { end: { column: 7, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrowFunctionExpression { type: "ArrowFunctionExpression", @@ -179,7 +193,9 @@ Program { operator: "instanceof", right: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [210, 213], loc: { @@ -281,9 +297,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -291,6 +311,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 221], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot index d4b80cfc1c0..6694942a9c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBar', +- optional: false, range: [87, 92], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -51,7 +56,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment operator: 'instanceof', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [140, 143], loc: { @@ -81,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -149,9 +157,13 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBaz', +- optional: false, range: [151, 156], loc: { @@ -159,7 +171,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 7, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrowFunctionExpression { type: 'ArrowFunctionExpression', @@ -183,7 +197,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment operator: 'instanceof', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [210, 213], loc: { @@ -285,9 +301,13 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -295,6 +315,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 221], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot index 3ff06704e03..eafcb69bdf0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [78, 79], loc: { @@ -18,23 +21,12 @@ Program { }, typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "A", - - range: [82, 83], - loc: { - start: { column: 9, line: 3 }, - end: { column: 10, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSImportType { type: "TSImportType", - isTypeOf: false, - parameter: TSLiteralType { + argument: TSLiteralType { type: "TSLiteralType", literal: Literal { type: "Literal", @@ -56,7 +48,9 @@ Program { }, qualifier: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [95, 96], loc: { @@ -64,7 +58,7 @@ Program { end: { column: 23, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSAnyKeyword { @@ -99,6 +93,18 @@ Program { end: { column: 29, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "A", + optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, range: [82, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot index b3d492c1c09..7a44f897400 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [78, 79], loc: { @@ -22,40 +25,40 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete }, typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'A', - - range: [82, 83], - loc: { - start: { column: 9, line: 3 }, - end: { column: 10, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'A', ++ ++ range: [82, 83], ++ loc: { ++ start: { column: 9, line: 3 }, ++ end: { column: 10, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSImportType { type: 'TSImportType', -- isTypeOf: false, -- parameter: TSLiteralType { +- argument: TSLiteralType { - type: 'TSLiteralType', - literal: Literal { - type: 'Literal', - raw: '\\'\\'', - value: '', -- ++ argument: Literal { ++ type: 'Literal', ++ raw: '\\'\\'', ++ value: '', + - range: [91, 93], - loc: { - start: { column: 18, line: 3 }, - end: { column: 20, line: 3 }, - }, - }, -+ argument: Literal { -+ type: 'Literal', -+ raw: '\\'\\'', -+ value: '', - +- range: [91, 93], loc: { start: { column: 18, line: 3 }, @@ -64,7 +67,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete }, qualifier: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [95, 96], loc: { @@ -72,7 +77,8 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete end: { column: 23, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSAnyKeyword { @@ -105,6 +111,18 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete loc: { start: { column: 10, line: 3 }, end: { column: 29, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'A', +- optional: false, +- +- range: [82, 83], +- loc: { +- start: { column: 9, line: 3 }, +- end: { column: 10, line: 3 }, }, }, diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot index 46ca24b8029..a0dca73c853 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [78, 79], loc: { @@ -16,15 +19,23 @@ Program { end: { column: 6, line: 3 }, }, }, - typeAnnotation: TSImportType { - type: "TSImportType", - isTypeOf: true, - parameter: TSLiteralType { - type: "TSLiteralType", - literal: Literal { - type: "Literal", - raw: "'A'", - value: "A", + typeAnnotation: TSTypeQuery { + type: "TSTypeQuery", + exprName: TSImportType { + type: "TSImportType", + argument: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "'A'", + value: "A", + + range: [96, 99], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, range: [96, 99], loc: { @@ -32,15 +43,15 @@ Program { end: { column: 26, line: 3 }, }, }, + qualifier: null, + typeArguments: null, - range: [96, 99], + range: [89, 100], loc: { - start: { column: 23, line: 3 }, - end: { column: 26, line: 3 }, + start: { column: 16, line: 3 }, + end: { column: 27, line: 3 }, }, }, - qualifier: null, - typeParameters: null, range: [82, 100], loc: { @@ -57,9 +68,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [107, 108], loc: { @@ -69,8 +83,7 @@ Program { }, typeAnnotation: TSImportType { type: "TSImportType", - isTypeOf: false, - parameter: TSLiteralType { + argument: TSLiteralType { type: "TSLiteralType", literal: Literal { type: "Literal", @@ -92,7 +105,9 @@ Program { }, qualifier: Identifier { type: "Identifier", + decorators: [], name: "X", + optional: false, range: [123, 124], loc: { @@ -100,14 +115,16 @@ Program { end: { column: 22, line: 4 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Y", + optional: false, range: [125, 126], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot index bc1a96cae67..62d99f330fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [78, 79], loc: { @@ -20,39 +23,43 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS end: { column: 6, line: 3 }, }, }, -- typeAnnotation: TSImportType { -- type: 'TSImportType', -- isTypeOf: true, -- parameter: TSLiteralType { -- type: 'TSLiteralType', -- literal: Literal { -+ typeAnnotation: TSTypeQuery { -+ type: 'TSTypeQuery', -+ exprName: TSImportType { -+ type: 'TSImportType', + typeAnnotation: TSTypeQuery { + type: 'TSTypeQuery', + exprName: TSImportType { + type: 'TSImportType', +- argument: TSLiteralType { +- type: 'TSLiteralType', +- literal: Literal { +- type: 'Literal', +- raw: '\\'A\\'', +- value: 'A', + argument: Literal { - type: 'Literal', - raw: '\\'A\\'', - value: 'A', - ++ type: 'Literal', ++ raw: '\\'A\\'', ++ value: 'A', + +- range: [96, 99], +- loc: { +- start: { column: 23, line: 3 }, +- end: { column: 26, line: 3 }, +- }, +- }, +- range: [96, 99], loc: { start: { column: 23, line: 3 }, end: { column: 26, line: 3 }, }, }, +- qualifier: null, +- typeArguments: null, -- range: [96, 99], -+ range: [89, 100], + range: [89, 100], loc: { -- start: { column: 23, line: 3 }, -- end: { column: 26, line: 3 }, -+ start: { column: 16, line: 3 }, -+ end: { column: 27, line: 3 }, + start: { column: 16, line: 3 }, + end: { column: 27, line: 3 }, }, }, -- qualifier: null, -- typeParameters: null, range: [82, 100], loc: { @@ -69,9 +76,12 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [107, 108], loc: { @@ -81,8 +91,7 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, typeAnnotation: TSImportType { type: 'TSImportType', -- isTypeOf: false, -- parameter: TSLiteralType { +- argument: TSLiteralType { - type: 'TSLiteralType', - literal: Literal { - type: 'Literal', @@ -108,7 +117,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, qualifier: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [123, 124], loc: { @@ -116,14 +127,17 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS end: { column: 22, line: 4 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Y', +- optional: false, range: [125, 126], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot index f5d04acee7b..256b304a02d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot @@ -25,7 +25,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [87, 88], loc: { @@ -36,7 +38,9 @@ Program { exportKind: "type", local: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [87, 88], loc: { @@ -55,7 +59,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [95, 96], loc: { @@ -66,7 +72,9 @@ Program { exportKind: "type", local: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot index b269b793948..0371377d04c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,112 @@ exports[`AST Fixtures legacy-fixtures basics type-only-export-specifiers AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: null, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [104, 109], + loc: { + start: { column: 31, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + specifiers: Array [ + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + exportKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [82, 88], + loc: { + start: { column: 9, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + exportKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [90, 96], + loc: { + start: { column: 17, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot index 9b82dc5f9f2..6c6b075e434 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [87, 88], loc: { @@ -35,7 +37,9 @@ Program { importKind: "type", local: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [87, 88], loc: { @@ -54,7 +58,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [95, 96], loc: { @@ -65,7 +71,9 @@ Program { importKind: "type", local: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot index c473f9f118e..313e18bc7f9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,111 @@ exports[`AST Fixtures legacy-fixtures basics type-only-import-specifiers AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\'mod\\'', + value: 'mod', + + range: [104, 109], + loc: { + start: { column: 31, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + importKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [82, 88], + loc: { + start: { column: 9, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + importKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [90, 96], + loc: { + start: { column: 17, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot index a516cc87f4e..31bc883b677 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 70, line: 3 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [114, 117], loc: { @@ -36,14 +44,16 @@ Program { end: { column: 44, line: 3 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { + superTypeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [128, 129], loc: { @@ -75,7 +85,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [93, 94], loc: { @@ -108,6 +120,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -118,9 +131,13 @@ Program { end: { column: 39, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "foo2", + optional: false, range: [150, 154], loc: { @@ -128,9 +145,12 @@ Program { end: { column: 10, line: 4 }, }, }, + implements: [], superClass: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [205, 208], loc: { @@ -138,14 +158,16 @@ Program { end: { column: 13, line: 6 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { + superTypeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [219, 220], loc: { @@ -197,7 +219,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [168, 169], loc: { @@ -240,12 +264,15 @@ Program { end: { column: 75, line: 7 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "bar2", + optional: false, range: [280, 284], loc: { @@ -253,14 +280,16 @@ Program { end: { column: 49, line: 7 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [295, 296], loc: { @@ -293,7 +322,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [245, 248], loc: { @@ -310,7 +341,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [259, 260], loc: { @@ -353,12 +386,15 @@ Program { end: { column: 39, line: 9 }, }, }, + declare: false, extends: [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [373, 376], loc: { @@ -366,14 +402,16 @@ Program { end: { column: 13, line: 9 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [387, 388], loc: { @@ -406,7 +444,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "bar2", + optional: false, range: [321, 325], loc: { @@ -443,7 +483,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [336, 337], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot index 37c6b8de68f..a04914b21e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 70, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [79, 82], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [114, 117], loc: { @@ -40,14 +48,17 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 44, line: 3 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { +- superTypeArguments: TSTypeParameterInstantiation { ++ superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [128, 129], loc: { @@ -79,7 +90,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [93, 94], - loc: { @@ -113,6 +126,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -123,9 +137,13 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 39, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo2', +- optional: false, range: [150, 154], loc: { @@ -133,9 +151,12 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 10, line: 4 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [205, 208], loc: { @@ -143,14 +164,17 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 13, line: 6 }, }, }, - superTypeParameters: TSTypeParameterInstantiation { +- superTypeArguments: TSTypeParameterInstantiation { ++ superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [219, 220], loc: { @@ -202,7 +226,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, + name: 'A', - range: [168, 169], @@ -246,6 +272,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 75, line: 7 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -253,7 +280,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar2', +- optional: false, range: [280, 284], loc: { @@ -261,14 +290,17 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 49, line: 7 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [295, 296], loc: { @@ -301,7 +333,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [245, 248], loc: { @@ -318,8 +352,11 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', -- +- optional: false, ++ name: 'A', + - range: [259, 260], - loc: { - start: { column: 24, line: 7 }, @@ -327,8 +364,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - }, - }, - out: false, -+ name: 'A', - +- range: [259, 260], loc: { start: { column: 24, line: 7 }, @@ -362,6 +398,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 39, line: 9 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -369,7 +406,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [373, 376], loc: { @@ -377,14 +416,17 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 13, line: 9 }, }, }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [387, 388], loc: { @@ -417,7 +459,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar2', +- optional: false, range: [321, 325], loc: { @@ -454,7 +498,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [336, 337], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot index 3ae73b01034..f6120c1dd74 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -20,14 +22,16 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [93, 94], loc: { @@ -77,11 +81,14 @@ Program { end: { column: 40, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [124, 127], loc: { @@ -99,7 +106,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [138, 139], loc: { @@ -143,11 +152,14 @@ Program { end: { column: 46, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [165, 168], loc: { @@ -166,7 +178,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [193, 196], loc: { @@ -184,7 +198,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [179, 180], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot index 724bdedf9c7..212f808e37d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [73, 76], loc: { @@ -24,14 +26,17 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [93, 94], loc: { @@ -81,11 +86,14 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm end: { column: 40, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [124, 127], loc: { @@ -103,7 +111,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [138, 139], - loc: { @@ -148,11 +158,14 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm end: { column: 46, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [165, 168], loc: { @@ -171,7 +184,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [193, 196], loc: { @@ -189,7 +204,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [179, 180], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot index ead0a8afdd7..18334207c3b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "mBuffers", + optional: false, range: [99, 107], loc: { @@ -23,17 +28,41 @@ Program { end: { column: 10, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", + typeArguments: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [127, 130], + loc: { + start: { column: 30, line: 4 }, + end: { column: 33, line: 4 }, + }, + }, + ], + + range: [126, 147], + loc: { + start: { column: 29, line: 4 }, + end: { column: 50, line: 4 }, + }, + }, typeName: TSQualifiedName { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: [], name: "interop", + optional: false, range: [109, 116], loc: { @@ -43,7 +72,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "Reference", + optional: false, range: [117, 126], loc: { @@ -58,26 +89,6 @@ Program { end: { column: 29, line: 4 }, }, }, - typeParameters: TSTypeParameterInstantiation { - type: "TSTypeParameterInstantiation", - params: [ - TSAnyKeyword { - type: "TSAnyKeyword", - - range: [127, 130], - loc: { - start: { column: 30, line: 4 }, - end: { column: 33, line: 4 }, - }, - }, - ], - - range: [126, 147], - loc: { - start: { column: 29, line: 4 }, - end: { column: 50, line: 4 }, - }, - }, range: [109, 147], loc: { @@ -108,9 +119,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "AudioBufferList", + optional: false, range: [79, 94], loc: { @@ -118,6 +133,7 @@ Program { end: { column: 21, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 150], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot index 81d663d91cb..4af0d045e7b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'mBuffers', +- optional: false, range: [99, 107], loc: { @@ -27,17 +32,41 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme end: { column: 10, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSAnyKeyword { +- type: 'TSAnyKeyword', +- +- range: [127, 130], +- loc: { +- start: { column: 30, line: 4 }, +- end: { column: 33, line: 4 }, +- }, +- }, +- ], +- +- range: [126, 147], +- loc: { +- start: { column: 29, line: 4 }, +- end: { column: 50, line: 4 }, +- }, +- }, typeName: TSQualifiedName { type: 'TSQualifiedName', left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'interop', +- optional: false, range: [109, 116], loc: { @@ -47,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Reference', +- optional: false, range: [117, 126], loc: { @@ -60,26 +91,26 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme loc: { start: { column: 12, line: 4 }, end: { column: 29, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ - TSAnyKeyword { - type: 'TSAnyKeyword', - - range: [127, 130], - loc: { - start: { column: 30, line: 4 }, - end: { column: 33, line: 4 }, - }, - }, - ], - - range: [126, 147], - loc: { - start: { column: 29, line: 4 }, - end: { column: 50, line: 4 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { ++ type: 'TSTypeParameterInstantiation', ++ params: Array [ ++ TSAnyKeyword { ++ type: 'TSAnyKeyword', ++ ++ range: [127, 130], ++ loc: { ++ start: { column: 30, line: 4 }, ++ end: { column: 33, line: 4 }, ++ }, ++ }, ++ ], ++ ++ range: [126, 147], ++ loc: { ++ start: { column: 29, line: 4 }, ++ end: { column: 50, line: 4 }, }, }, @@ -112,9 +143,13 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AudioBufferList', +- optional: false, range: [79, 94], loc: { @@ -122,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme end: { column: 21, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 150], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot index d1f36b0011f..eeaa588da12 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot index bba1fc6c6f9..c9a2c6c1323 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-bigint AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSBigIntKeyword { + type: 'TSBigIntKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot index 15430d8a9ab..32cc496fafb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot index 26e84868cf5..f65e128096a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-boolean AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [84, 91], + loc: { + start: { column: 11, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot index f3f2c5de74e..68ab5918c6c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot index d96b38d76a7..53aebf916f5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-false AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: 'false', + value: false, + + range: [84, 89], + loc: { + start: { column: 11, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [84, 89], + loc: { + start: { column: 11, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot index 7f83badadf9..350fee4f4c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot index c377742b959..a353497f2ec 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-never AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNeverKeyword { + type: 'TSNeverKeyword', + + range: [84, 89], + loc: { + start: { column: 11, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot index 7db93d05ef4..856c1022be0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot index fca6050d833..466b4987dd4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-null AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNullKeyword { + type: 'TSNullKeyword', + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot index 4ccca319ab8..f6c3e5d0432 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot index 8eb6a37462b..8055f6f1ce2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-number AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot index bb5100cf436..0c1628c7f84 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot index 1989928fcdf..29d534bf394 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-object AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSObjectKeyword { + type: 'TSObjectKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot index 0ee3d02dc01..95dedbb1b0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot index 5eca842524b..feafd389646 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-string AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot index 9ba239c957c..e0535ac0dc9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot index 8b7dfb95fb3..beffde570e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-symbol AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot index c9d8f8739f4..9067bea2396 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot index c25d16a9d1b..5ee73a232e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-true AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: 'true', + value: true, + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot index f1244a520c3..05b18b49353 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot index 6ed7dcc09d3..9756a5a473e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-undefined AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSUndefinedKeyword { + type: 'TSUndefinedKeyword', + + range: [84, 93], + loc: { + start: { column: 11, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot index 3bd87f8c880..fd72e2b25fc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot index a2c14932bd7..3c694ea56b1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-unknown AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSUnknownKeyword { + type: 'TSUnknownKeyword', + + range: [84, 91], + loc: { + start: { column: 11, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot index fb23e766569..ee15266961d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot index 8b70a69a9c1..8310c147a49 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-void AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot index 2349f700577..36f2c1cf1d5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "h", + optional: false, range: [88, 89], loc: { @@ -33,10 +38,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -63,6 +71,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -81,6 +90,7 @@ Program { end: { column: 22, line: 4 }, }, }, + static: false, range: [88, 109], loc: { @@ -93,7 +103,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "g", + optional: false, range: [112, 113], loc: { @@ -102,17 +114,22 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [122, 123], loc: { @@ -142,13 +159,16 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [126, 127], loc: { @@ -170,6 +190,7 @@ Program { end: { column: 17, line: 5 }, }, }, + static: false, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", params: [ @@ -179,7 +200,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [114, 115], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot index 71fe4bac95b..837488858a5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [78, 81], loc: { @@ -28,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'h', +- optional: false, range: [88, 89], loc: { @@ -37,11 +42,14 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -68,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -87,6 +96,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen end: { column: 22, line: 4 }, }, }, +- static: false, range: [88, 109], loc: { @@ -99,7 +109,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'g', +- optional: false, range: [112, 113], loc: { @@ -108,18 +120,23 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [122, 123], loc: { @@ -149,6 +166,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -156,7 +174,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [126, 127], loc: { @@ -178,6 +198,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen end: { column: 17, line: 5 }, }, }, +- static: false, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', params: Array [ @@ -187,7 +208,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [114, 115], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot index 23109d3d2bb..ed9374668d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "addClickListener", + optional: false, range: [97, 113], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "onclick", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -34,7 +39,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -62,14 +69,18 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Event", + optional: false, range: [139, 144], loc: { @@ -139,6 +150,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -157,6 +169,7 @@ Program { end: { column: 65, line: 4 }, }, }, + static: false, range: [97, 161], loc: { @@ -172,9 +185,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "UIElement", + optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot index 6b66408fdf8..71878cff80a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'addClickListener', +- optional: false, range: [97, 113], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'onclick', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -40,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSVoidKeyword { @@ -68,14 +75,18 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'e', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Event', +- optional: false, range: [139, 144], loc: { @@ -146,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -165,6 +177,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] end: { column: 65, line: 4 }, }, }, +- static: false, range: [97, 161], loc: { @@ -180,9 +193,13 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'UIElement', +- optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot index ef064f93b5c..285db979a8e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "union", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -75,6 +78,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 110], @@ -88,9 +92,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "intersection", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSIntersectionType { @@ -145,6 +152,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [111, 145], @@ -158,9 +166,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "precedence1", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -235,6 +246,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [146, 191], @@ -248,9 +260,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "precedence2", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -325,6 +340,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [192, 237], @@ -335,9 +351,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "unionLeading", + optional: false, range: [244, 256], loc: { @@ -383,9 +402,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "intersectionLeading", + optional: false, range: [281, 300], loc: { @@ -431,9 +453,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "unionLeadingSingle", + optional: false, range: [325, 343], loc: { @@ -459,9 +484,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "intersectionLeadingSingle", + optional: false, range: [359, 384], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot index 003d20be443..0ba46d85e33 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'union', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -79,6 +82,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 110], @@ -92,9 +96,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersection', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSIntersectionType { @@ -149,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [111, 145], @@ -162,9 +170,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence1', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -268,6 +279,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [146, 191], @@ -281,9 +293,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence2', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -387,6 +402,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [192, 237], @@ -397,9 +413,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unionLeading', +- optional: false, range: [244, 256], loc: { @@ -445,9 +464,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersectionLeading', +- optional: false, range: [281, 300], loc: { @@ -493,9 +515,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unionLeadingSingle', +- optional: false, range: [325, 343], loc: { @@ -521,9 +546,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersectionLeadingSingle', +- optional: false, range: [359, 384], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot index 9ea2f9badb6..30380db6189 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot index 624e3a6347f..6c182a3ea16 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,60 @@ exports[`AST Fixtures legacy-fixtures basics unique-symbol AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'unique', + typeAnnotation: TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [89, 95], + loc: { + start: { column: 16, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [73, 96], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot index 55d50aa9f5b..fd53d22a36b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnknownKeyword { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 90], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot index 9a02cb1d49f..eca7ce1e22c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures legacy-fixtures basics unknown-type-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnknownKeyword { + type: 'TSUnknownKeyword', + + range: [82, 89], + loc: { + start: { column: 9, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [80, 89], + loc: { + start: { column: 7, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [77, 89], + loc: { + start: { column: 4, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + init: null, + + range: [77, 89], + loc: { + start: { column: 4, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot index 09cad104b78..85b642107fb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -22,7 +25,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [82, 83], loc: { @@ -32,7 +37,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [84, 85], loc: { @@ -49,7 +56,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [86, 87], loc: { @@ -94,6 +103,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 88], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot index c7abbe04267..d389263137d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,127 @@ exports[`AST Fixtures legacy-fixtures basics var-with-dotted-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: TSQualifiedName { + type: 'TSQualifiedName', + left: TSQualifiedName { + type: 'TSQualifiedName', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [84, 85], + loc: { + start: { column: 11, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'C', +- optional: false, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [80, 87], + loc: { + start: { column: 7, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + init: null, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot index e4a3ab04415..fd1f20c21c6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -56,6 +59,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 103], @@ -69,9 +73,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -116,6 +123,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [104, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot index 5db71f16938..8ea07ffae12 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,147 @@ exports[`AST Fixtures legacy-fixtures basics var-with-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [83, 89], + loc: { + start: { column: 10, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [81, 89], + loc: { + start: { column: 8, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [77, 89], + loc: { + start: { column: 4, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\'Nicholas\\'', + value: 'Nicholas', + + range: [92, 102], + loc: { + start: { column: 19, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [77, 102], + loc: { + start: { column: 4, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [113, 119], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [111, 119], + loc: { + start: { column: 7, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [108, 119], + loc: { + start: { column: 4, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\'Bar\\'', + value: 'Bar', + + range: [122, 127], + loc: { + start: { column: 18, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [108, 127], + loc: { + start: { column: 4, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [104, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 129], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot index 96cc28bc9e2..1185eb6f27c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 87], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot index e4933e5c280..27a1d0f281e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures legacy-fixtures basics variable-declaration-type-annotation-spacing AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [80, 86], + loc: { + start: { column: 7, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [78, 86], + loc: { + start: { column: 5, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [77, 86], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + init: null, + + range: [77, 86], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot index d29236eb3c0..f3fd3e4f191 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,6 +17,7 @@ Program { end: { column: 21, line: 6 }, }, }, + declare: false, decorators: [ Decorator { type: "Decorator", @@ -30,7 +32,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "selector", + optional: false, range: [88, 96], loc: { @@ -40,6 +44,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -70,7 +75,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "Component", + optional: false, range: [74, 83], loc: { @@ -96,7 +103,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "FooComponent", + optional: false, range: [114, 126], loc: { @@ -104,6 +113,7 @@ Program { end: { column: 18, line: 6 }, }, }, + implements: [], superClass: null, range: [73, 129], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot index 8c120b192b5..d854a20c888 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,137 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-decorator-factory AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [127, 129], + loc: { + start: { column: 19, line: 6 }, + end: { column: 21, line: 6 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'selector', +- optional: false, + + range: [88, 96], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\'foo\\'', + value: 'foo', + + range: [98, 103], + loc: { + start: { column: 12, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [88, 103], + loc: { + start: { column: 2, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + ], + + range: [84, 106], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Component', +- optional: false, + + range: [74, 83], + loc: { + start: { column: 1, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + optional: false, + + range: [74, 107], + loc: { + start: { column: 1, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + + range: [73, 107], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'FooComponent', +- optional: false, + + range: [114, 126], + loc: { + start: { column: 6, line: 6 }, + end: { column: 18, line: 6 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 129], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 130], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot index e78551dadff..772d11518e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,12 +17,15 @@ Program { end: { column: 12, line: 4 }, }, }, + declare: false, decorators: [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "sealed", + optional: false, range: [74, 80], loc: { @@ -39,7 +43,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Qux", + optional: false, range: [87, 90], loc: { @@ -47,6 +53,7 @@ Program { end: { column: 9, line: 4 }, }, }, + implements: [], superClass: null, range: [73, 93], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot index 40e0a52e409..1b6b38c2c77 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,77 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-decorator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [91, 93], + loc: { + start: { column: 10, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'sealed', +- optional: false, + + range: [74, 80], + loc: { + start: { column: 1, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Qux', +- optional: false, + + range: [87, 90], + loc: { + start: { column: 6, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 12, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot index e4779292f6f..ecf8541214c 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [85, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 38, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -50,7 +56,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "d", + optional: false, range: [98, 99], loc: { @@ -66,9 +74,12 @@ Program { }, }, ], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -94,6 +105,8 @@ Program { end: { column: 34, line: 4 }, }, }, + readonly: false, + static: false, range: [97, 117], loc: { @@ -124,9 +137,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [79, 80], loc: { @@ -134,6 +151,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot index ad0a3b6af28..b5b95884e0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [85, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 38, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -54,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [98, 99], loc: { @@ -70,9 +78,12 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property }, }, ], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -98,6 +109,8 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 34, line: 4 }, }, }, +- readonly: false, +- static: false, - range: [97, 117], + range: [100, 117], @@ -130,9 +143,13 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -140,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot index abac81f19e7..a703f5597c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,12 +19,15 @@ Program { end: { column: 27, line: 4 }, }, }, + declare: false, decorators: [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "sealed", + optional: false, range: [74, 80], loc: { @@ -41,7 +45,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Qux", + optional: false, range: [102, 105], loc: { @@ -49,6 +55,7 @@ Program { end: { column: 24, line: 4 }, }, }, + implements: [], superClass: null, range: [96, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot index aab5207c1cf..e0c2bb34c55 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,12 +23,15 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco end: { column: 27, line: 4 }, }, }, +- declare: false, decorators: Array [ Decorator { type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'sealed', +- optional: false, range: [74, 80], loc: { @@ -45,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Qux', +- optional: false, range: [102, 105], loc: { @@ -53,6 +59,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco end: { column: 24, line: 4 }, }, }, +- implements: Array [], superClass: null, - range: [96, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot index c21177a9eba..290ff765aed 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -19,12 +20,15 @@ Program { end: { column: 19, line: 4 }, }, }, + declare: false, decorators: [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "sealed", + optional: false, range: [74, 80], loc: { @@ -42,7 +46,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: [], name: "Qux", + optional: false, range: [94, 97], loc: { @@ -50,6 +56,7 @@ Program { end: { column: 16, line: 4 }, }, }, + implements: [], superClass: null, range: [88, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot index 129de117810..d0ef16bd7f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot @@ -13,6 +13,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -23,12 +24,15 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora end: { column: 19, line: 4 }, }, }, +- declare: false, decorators: Array [ Decorator { type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'sealed', +- optional: false, range: [74, 80], loc: { @@ -46,7 +50,9 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Qux', +- optional: false, range: [94, 97], loc: { @@ -54,6 +60,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora end: { column: 16, line: 4 }, }, }, +- implements: Array [], superClass: null, - range: [88, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot index 34a322c1be7..3bdfc6deac2 100644 --- a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -23,7 +26,9 @@ Program { type: "TSTypeAssertion", expression: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [102, 105], loc: { @@ -35,7 +40,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [89, 92], loc: { @@ -65,6 +72,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 106], diff --git a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot index 72f39c2a9d7..e7bfc6ff2f7 100644 --- a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,96 @@ exports[`AST Fixtures legacy-fixtures comments type-assertion-regression-test AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [79, 82], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: TSTypeAssertion { + type: 'TSTypeAssertion', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [102, 105], + loc: { + start: { column: 1, line: 5 }, + end: { column: 4, line: 5 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [89, 92], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + + range: [89, 92], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + + range: [85, 105], + loc: { + start: { column: 12, line: 3 }, + end: { column: 4, line: 5 }, + }, + }, + + range: [79, 105], + loc: { + start: { column: 6, line: 3 }, + end: { column: 4, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 106], + loc: { + start: { column: 0, line: 3 }, + end: { column: 5, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 107], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot index fa1b00d30dd..674af2f29a5 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot @@ -18,9 +18,12 @@ Program { }, }, declare: true, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [96, 99], loc: { @@ -28,6 +31,7 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 102], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot index 5af6384c015..2bb556fb9a3 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures legacy-fixtures declare abstract-class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + abstract: true, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [100, 102], + loc: { + start: { column: 27, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + declare: true, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [96, 99], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot index 21b0358d3fe..2d084540fd4 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -17,9 +18,12 @@ Program { }, }, declare: true, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [87, 90], loc: { @@ -27,6 +31,7 @@ Program { end: { column: 17, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 93], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot index 87f188965e7..88ee83e0881 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures legacy-fixtures declare class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [91, 93], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + declare: true, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot index 7286bec9b9e..956fec5e84a 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -6,10 +6,13 @@ Program { body: [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, declare: true, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -20,9 +23,12 @@ Program { members: [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -39,9 +45,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: [], name: "Baz", + optional: false, range: [101, 104], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index be39111033a..1ef1a9d0f0b 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,88 @@ exports[`AST Fixtures legacy-fixtures declare enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Bar', +- optional: false, + + range: [94, 97], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + + range: [94, 97], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Baz', +- optional: false, + + range: [101, 104], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + + range: [101, 104], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + ], + + range: [73, 107], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot index 6340fab4fc2..d623f02b821 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [90, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot index cef0cfc863e..cd2704357cc 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,63 @@ exports[`AST Fixtures legacy-fixtures declare function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [97, 101], + loc: { + start: { column: 24, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot index 23487f4ce1c..cc9eddbeafa 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [91, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot index 13fe23e4d2a..fb70f302dcc 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,52 @@ exports[`AST Fixtures legacy-fixtures declare interface AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [95, 97], + loc: { + start: { column: 22, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + declare: true, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [91, 94], + loc: { + start: { column: 18, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot index 8dacc4ec411..5cc1db66c20 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [88, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot index 575a9a6bd39..5060682c9ee 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures legacy-fixtures declare module AST Alignment - AST 1`] = ` }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [88, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..34abdd0420b --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-Babel-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures declare namespace Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [95, 97], + loc: { + start: { column: 22, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [91, 94], + loc: { + start: { column: 18, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot index 3bb67741f11..2d4b418ebe6 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [91, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..014f4d3e257 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/2-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures declare namespace Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [91, 94], + loc: { + start: { column: 18, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [96, 97], + loc: { + start: { column: 23, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot index ba41672f843..967347feff5 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures legacy-fixtures declare namespace AST Alignment - AST 1`] }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [91, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot index 20b1afc88e8..6f4e3b145e5 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { declare: true, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [86, 89], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot index d425ca353e6..d47eb9051c4 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures declare type-alias AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [73, 99], + loc: { + start: { column: 0, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot index 1e7daf91eaf..802e2df1233 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot index 3dcece695fe..58499e81b15 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures legacy-fixtures declare variable AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [88, 93], + loc: { + start: { column: 15, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + init: null, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + declare: true, + kind: 'var', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..60d72da36dd --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends-implements Babel - Error 1`] = `[SyntaxError: Unexpected reserved word 'implements'. (3:18)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-TSESTree-Error.shot index a645249de30..79b70db2f37 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends-implements TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends-implements TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class Foo extends implements Bar { + | ^^^^^^^ 'extends' list cannot be empty. + 4 | + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..d39f4065810 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/3-Alignment-Error.shot index d39f4065810..9d6798ba38b 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends-implements Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4cf63d00482 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (6:0)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-TSESTree-Error.shot index 403ed52cb6d..f0fdcbf56a2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class Foo extends { + | ^^^^^^^ 'extends' list cannot be empty. + 4 | + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..797630b5f8c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/3-Alignment-Error.shot index 797630b5f8c..5074a50f9de 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-empty-extends Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..0c3e448daa8 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-extends-empty-implements Babel - Error 1`] = `[SyntaxError: 'implements' list cannot be empty. (3:33)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-TSESTree-Error.shot index 0a8ba11f7bc..cc25ca4bc8e 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-extends-empty-implements TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-extends-empty-implements TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class Foo extends Bar implements { + | ^^^^^^^^^^ 'implements' list cannot be empty. + 4 | + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..cda29807004 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-extends-empty-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/3-Alignment-Error.shot index cda29807004..7b58138335d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-extends-empty-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-extends-empty-implements Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..ef0323f1248 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-multiple-implements Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "," (3:21)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-TSESTree-Error.shot index 1868f08ac3c..c156a7ba5b6 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-multiple-implements TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-multiple-implements TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | class a implements b implements c {} + | ^^^^^^^^^^^^ 'implements' clause already seen. + 4 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..519ad3a361f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-multiple-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/3-Alignment-Error.shot index 519ad3a361f..0fffeee4c5c 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-multiple-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ class-multiple-implements Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..1111df2d4d5 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-enum-declaration Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (3:5)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-TSESTree-Error.shot index bcb52edf68d..3055b0dc449 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-enum-declaration TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-enum-declaration TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | @dec enum E {} + | ^^^^ Decorators are not valid here." +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..17ba689c614 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-enum-declaration Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/3-Alignment-Error.shot index 17ba689c614..a6c9ea30e6f 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-enum-declaration Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-enum-declaration Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4b9fe05a0db --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-function Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (4:0)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-TSESTree-Error.shot index 0d803ce647c..ab74377190c 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-function TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-function TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | @dec + | ^^^^ Decorators are not valid here. + 4 | function b(){} + 5 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..4c89abf9f72 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-function Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/3-Alignment-Error.shot index 4c89abf9f72..875d107ab09 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-function Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-function Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..46332174237 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-interface-declaration Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (4:0)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-TSESTree-Error.shot index 3905750f9aa..45ea7f53044 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-interface-declaration TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-interface-declaration TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | @deco() + | ^^^^^^^ Decorators are not valid here. + 4 | interface M {}" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..f7a4fa57521 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-interface-declaration Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/3-Alignment-Error.shot index f7a4fa57521..c8b6e5b79da 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-interface-declaration Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-interface-declaration Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..577ab6fdfd2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-variable Babel - Error 1`] = `[SyntaxError: Leading decorators must be attached to a class declaration. (4:0)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-TSESTree-Error.shot index 184f3d96b4d..69123261b06 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-variable TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-variable TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | @deco() + | ^^^^^^^ Decorators are not valid here. + 4 | const a = 1 + 5 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..1c90fdcf540 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-variable Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/3-Alignment-Error.shot index 1c90fdcf540..a48f982c9a8 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-variable Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ decorator-on-variable Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4992c1bda8b --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments-in-call-expression Babel - Error 1`] = `[SyntaxError: Unexpected token (3:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..c7ddaf4d350 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments-in-call-expression Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4330f2de54d --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments-in-new-expression Babel - Error 1`] = `[SyntaxError: Unexpected token (3:8)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..96ba6b3c25a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments-in-new-expression Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b9424b15c15 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments Babel - Error 1`] = `[SyntaxError: Type argument list cannot be empty. (3:14)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..231a4e0b03c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-arguments Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..12440d8874f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-arrow-function Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (3:11)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..04350071ad7 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-arrow-function/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-arrow-function Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..5bf5b3f2503 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-constructor Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (4:13)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..406623be373 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-constructor/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-constructor Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..108f139e0c1 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-function-expression Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (3:20)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..e6cdab797b6 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-function-expression/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-function-expression Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..665c83f9988 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-method-signature Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (4:6)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..a5fa26ec178 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-method-signature Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4e1cb147bbf --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-method Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (4:6)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..bb1641bbb8a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters-in-method Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..ae64111c78c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (3:11)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..14e18802b75 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ empty-type-parameters Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..c16dc935997 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (3:7)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot index 264bd320faa..b90437fa5b2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | export private public protected static readonly abstract async enum X {} + | ^^^^^^^ 'private' modifier cannot appear on a module or namespace element." +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..ada94f82c3a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot index ada94f82c3a..fd6c43a4704 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ enum-with-keywords Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..c54798556f5 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ index-signature-parameters Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "]" (4:12)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..9b3c693c259 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ index-signature-parameters Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..edb82178308 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-empty-extends Babel - Error 1`] = `[SyntaxError: 'extends' list cannot be empty. (3:22)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..30ede9e96f2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-empty-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..ddf064bf40f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-implements Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (3:12)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-TSESTree-Error.shot index 292b542dcf5..bc87ac74bbf 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-implements TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-implements TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | interface d implements e {} + | ^^^^^^^^^^^^ Interface declaration cannot have 'implements' clause. + 4 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..53470554fd3 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/3-Alignment-Error.shot index 53470554fd3..15d3db96bf3 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-implements Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-implements Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..3bfdf5319d1 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-export Babel - Error 1`] = `[SyntaxError: Unexpected token, expected ";" (4:9)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot index 4ed734c0a3d..d601da71753 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-export TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-export TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | export [baz: string]: string; + | ^^^^^^ 'export' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..36d9f4ef037 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-export Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/3-Alignment-Error.shot index 36d9f4ef037..984bdc81d29 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-export Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-export Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..55e7b4fae1c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private Babel - Error 1`] = `[SyntaxError: 'private' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot index 13a96652b2b..3940bf8f5ae 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | private [baz: string]: string; + | ^^^^^^^ 'private' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..70ae64a4a82 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot index 70ae64a4a82..1bf7e6a8b1e 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-private Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..faf545c75f1 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected Babel - Error 1`] = `[SyntaxError: 'protected' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot index b6d263475ee..7147acc9576 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | protected [baz: string]: string; + | ^^^^^^^^^ 'protected' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..49a27a188b9 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot index 49a27a188b9..4c798313f87 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-protected Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b92427a492b --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public Babel - Error 1`] = `[SyntaxError: 'public' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot index 0ca583aff84..d57bbb6da4a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | public [baz: string]: string; + | ^^^^^^ 'public' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..959f932de08 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot index 959f932de08..50357e981e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-public Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f0cb1e241b2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static Babel - Error 1`] = `[SyntaxError: 'static' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot index 1d5a7a35239..e3b090eb8f0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | static [baz: string]: string; + | ^^^^^^ 'static' modifier cannot appear on an index signature + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..1730fddc173 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot index 1730fddc173..5267ec675b0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-index-signature-static Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..ebb45418f67 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-export Babel - Error 1`] = `[SyntaxError: Unexpected token, expected ";" (4:11)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot index 9bffb118f21..02668d51abb 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-export TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-export TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | export g(bar: string): void; + | ^^^^^^ 'export' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..60a90127afa --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-export Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/3-Alignment-Error.shot index 60a90127afa..6ea8f9cb251 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-export Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-export Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..bfa1cb15391 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private Babel - Error 1`] = `[SyntaxError: 'private' modifier cannot appear on a type member. (4:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot index 131a13aa7ee..b3cd691f7f0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | private g(bar: string): void; + | ^^^^^^^ 'private' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..2afbbf45ed3 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot index 2afbbf45ed3..910e9cc77af 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-private Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..b78ab26d2d6 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected Babel - Error 1`] = `[SyntaxError: 'protected' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot index 2976cbb6ecf..33f41f8ba61 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | protected g(bar: string): void; + | ^^^^^^^^^ 'protected' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0af7e82ad38 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot index 0af7e82ad38..c022672d659 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-protected Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..93ed430d970 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public Babel - Error 1`] = `[SyntaxError: 'public' modifier cannot appear on a type member. (4:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot index 32cb1ca974d..bf76c446e28 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | public g(bar: string): void; + | ^^^^^^ 'public' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0a09195bd84 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot index 0a09195bd84..61705bea29d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-public Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..10b06c12006 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly Babel - Error 1`] = `[SyntaxError: 'readonly' modifier can only appear on a property declaration or index signature. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot index 34d6269d02d..7d3f94f6639 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | readonly g(bar: string): void; + | ^^^^^^^^ 'readonly' modifier can only appear on a property declaration or index signature. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..062e4baddd0 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot index 062e4baddd0..9f0aaf74ac0 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-readonly Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..abb471fc9c1 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static Babel - Error 1`] = `[SyntaxError: 'static' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot index 01ec4dc383c..55732d2bf4a 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | static g(bar: string): void; + | ^^^^^^ 'static' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0cb366cff16 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot index 0cb366cff16..a4a703dca99 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-method-static Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..000b5cdd247 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-multiple-extends Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "," (3:26)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..12254d1b48a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-multiple-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..01bd31b00cb --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-export Babel - Error 1`] = `[SyntaxError: Unexpected token, expected ";" (4:9)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot index cd7457e4890..8cf3e746b6d 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-export TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-export TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | export a: string; + | ^^^^^^ 'export' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..62a5bb60065 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-export Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/3-Alignment-Error.shot index 62a5bb60065..f62e1bd6555 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-export Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-export Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..2808f07b450 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private Babel - Error 1`] = `[SyntaxError: 'private' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot index c9e45d49f90..74e32d60e43 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | private b: string; + | ^^^^^^^ 'private' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..3a57033e136 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot index 3a57033e136..a5c250cd314 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-private Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..9af6d30fe85 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected Babel - Error 1`] = `[SyntaxError: 'protected' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot index 945a89aeb8e..4ae03bf3890 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | protected a: string; + | ^^^^^^^^^ 'protected' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..65e263e1264 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot index 65e263e1264..11ddafba81b 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-protected Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..af650dc5287 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public Babel - Error 1`] = `[SyntaxError: 'public' modifier cannot appear on a type member. (4:4)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot index 0beb40de987..43f06b1fa7c 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | public a: string; + | ^^^^^^ 'public' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..6fe49dd919f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot index 6fe49dd919f..b4deaff7a34 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-public Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..6e667a50f6a --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static Babel - Error 1`] = `[SyntaxError: 'static' modifier cannot appear on a type member. (4:2)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot index 4e3c66cecea..eb8d16d999f 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | static a: string; + | ^^^^^^ 'static' modifier cannot appear on a type member + 5 | } + 6 | + 7 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..6e4940eb9ba --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot index 6e4940eb9ba..bdd3d867196 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-static Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4b4b6efa0c5 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-with-default-value Babel - Error 1`] = `[SyntaxError: Unexpected token, expected ";" (4:14)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-TSESTree-Error.shot index 2833ac9eb8f..9e58d0d1603 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-with-default-value TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-with-default-value TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo { +> 4 | bar: string = 'a'; + | ^^^ A property signature cannot have an initializer. + 5 | } + 6 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7b334875fc2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-with-default-value Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/3-Alignment-Error.shot index 7b334875fc2..19cbad977fb 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-with-default-value Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-property-with-default-value Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..dc6c9ef4c0b --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-with-no-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (4:0)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-TSESTree-Error.shot index 2a48d476319..95bd5eb7ffc 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-with-no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-with-no-body TSESTree - Error 1`] = ` +"TSError + 2 | + 3 | interface Foo +> 4 | + | ^ '{' expected." +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..89ed2b199bb --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-no-body/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-with-no-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..ae8600ccfdc --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-with-optional-index-signature Babel - Error 1`] = `[SyntaxError: Unexpected token (4:7)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..0ae40614620 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ interface-with-optional-index-signature Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f18a58b39b2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-assertion-not-allowed Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "," (3:3)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-TSESTree-Error.shot index 099a62b2b6e..4ed8a518fdc 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-assertion-not-allowed TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-assertion-not-allowed TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | ({a!} = {}) + | ^ A shorthand property assignment cannot have an exclamation token. + 4 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..2b47812c46c --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-assertion-not-allowed Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/3-Alignment-Error.shot index 2b47812c46c..878ae2828d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-assertion-not-allowed Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-assertion-not-allowed Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..373217628a2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-optional-not-allowed Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "," (3:3)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-TSESTree-Error.shot index 5f118120b57..684488f02c2 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-optional-not-allowed TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-optional-not-allowed TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | ({a?} = {}) + | ^ A shorthand property assignment cannot have a question token. + 4 |" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..31aaad026ea --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-optional-not-allowed Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/3-Alignment-Error.shot index 31aaad026ea..8579fdd31e6 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-optional-not-allowed Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ object-optional-not-allowed Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4866de224eb --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ solo-const Babel - Error 1`] = `[SyntaxError: Unexpected token (3:5)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-TSESTree-Error.shot index acfafbcff24..c178e7e591b 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ solo-const TSESTree - Error 1`] = `"NO ERROR"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ solo-const TSESTree - Error 1`] = ` +"TSError + 1 | // TODO: This fixture might be too large, and if so should be split up. + 2 | +> 3 | const + | ^^^^^ A variable declaration list must have at least one variable declarator." +`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..5ba96a6641e --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ solo-const Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/3-Alignment-Error.shot index 5ba96a6641e..2afa3285def 100644 --- a/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/3-Alignment-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/snapshots/3-Alignment-Error.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures errorRecovery _error_ solo-const Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; +exports[`AST Fixtures legacy-fixtures errorRecovery _error_ solo-const Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..4f730913d19 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures expressions _error_ instantiation-expression Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-TSESTree-Error.shot index 1f60a6e3402..8064f9d9654 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-TSESTree-Error.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/1-TSESTree-Error.shot @@ -1,3 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures legacy-fixtures expressions _error_ instantiation-expression TSESTree - Error 1`] = `[TSError: Expression expected.]`; +exports[`AST Fixtures legacy-fixtures expressions _error_ instantiation-expression TSESTree - Error 1`] = ` +"TSError + 3 | a; + 4 | +> 5 | a; + | ^ Expression expected. + 6 | a(); + 7 | a?.(); + 8 | a?.b();" +`; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..7a72a183ff5 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures expressions _error_ instantiation-expression Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 17050128c74..c12e069a650 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -20,14 +22,16 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [77, 78], loc: { @@ -71,7 +75,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [83, 86], loc: { @@ -80,7 +86,7 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 37371563dad..b49a2455c85 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,137 @@ exports[`AST Fixtures legacy-fixtures expressions call-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [73, 76], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [77, 78], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + + range: [77, 78], + loc: { + start: { column: 4, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + ], + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [83, 86], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [87, 93], + loc: { + start: { column: 4, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + + range: [86, 94], + loc: { + start: { column: 3, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [83, 96], + loc: { + start: { column: 0, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [83, 97], + loc: { + start: { column: 0, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 406d14deb91..f34ef6e5f0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [79, 80], loc: { @@ -24,7 +27,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [87, 88], loc: { @@ -32,14 +37,16 @@ Program { end: { column: 15, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [89, 90], loc: { @@ -77,6 +84,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 09f148a9083..2786d19fdd3 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,109 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + init: NewExpression { + type: 'NewExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [83, 93], + loc: { + start: { column: 10, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [79, 93], + loc: { + start: { column: 6, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 3c9e84b6177..38b8c0d7eec 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -27,7 +29,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [78, 81], loc: { @@ -43,14 +47,16 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [82, 83], loc: { @@ -106,7 +112,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [88, 91], loc: { @@ -117,7 +125,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [93, 96], loc: { @@ -133,7 +143,7 @@ Program { }, }, optional: false, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index f0db811ffaf..e040ed835e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,201 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [73, 76], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + + range: [81, 84], + loc: { + start: { column: 8, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 0, line: 4 }, + end: { column: 3, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 5, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + + range: [88, 96], + loc: { + start: { column: 0, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + optional: false, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [97, 103], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + ], + + range: [96, 104], + loc: { + start: { column: 8, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [88, 106], + loc: { + start: { column: 0, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [88, 106], + loc: { + start: { column: 0, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [88, 107], + loc: { + start: { column: 0, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 8b0f3adc684..faa9dd7a7f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -36,7 +36,9 @@ Program { }, tag: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -44,14 +46,16 @@ Program { end: { column: 3, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [77, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 63ff0bf8c59..dcf8eb70d96 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,108 @@ exports[`AST Fixtures legacy-fixtures expressions tagged-template-expression-type-arguments AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TaggedTemplateExpression { + type: 'TaggedTemplateExpression', + quasi: TemplateLiteral { + type: 'TemplateLiteral', + expressions: Array [], + quasis: Array [ + TemplateElement { + type: 'TemplateElement', + tail: true, + value: Object { + 'cooked': 'baz', + 'raw': 'baz', + }, + + range: [81, 86], + loc: { + start: { column: 8, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + ], + + range: [81, 86], + loc: { + start: { column: 8, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + tag: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [73, 76], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 3 }, + }, + }, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + ], + + range: [76, 81], + loc: { + start: { column: 3, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot index 8bcb096af8c..8cd61f41b49 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -32,7 +33,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "onlyRead", + optional: false, range: [86, 94], loc: { @@ -58,7 +61,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "instanceMethod", + optional: false, range: [104, 118], loc: { @@ -67,6 +72,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -82,6 +88,7 @@ Program { end: { column: 21, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -108,9 +115,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [79, 80], loc: { @@ -118,6 +129,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot index a4c8ddcb124..af49176862a 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -36,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'onlyRead', +- optional: false, range: [86, 94], loc: { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'instanceMethod', +- optional: false, range: [104, 118], loc: { @@ -71,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -86,6 +92,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 21, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -112,9 +119,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [79, 80], loc: { @@ -122,6 +133,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot index 1ba18827093..5abb782c861 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -32,7 +33,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -58,7 +61,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "staticMethod", + optional: false, range: [106, 118], loc: { @@ -67,6 +72,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -82,6 +88,7 @@ Program { end: { column: 26, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -108,9 +115,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [79, 80], loc: { @@ -118,6 +129,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot index 1e97f5d5c08..e4b0d9dadc8 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -36,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'staticMethod', +- optional: false, range: [106, 118], loc: { @@ -71,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -86,6 +92,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 26, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -112,9 +119,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -122,6 +133,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot index a1e1b7adeea..97a8f4687a6 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "onlyRead", + optional: false, range: [86, 94], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "instanceMethod", + optional: false, range: [97, 111], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -59,6 +65,7 @@ Program { end: { column: 21, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -85,9 +92,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [79, 80], loc: { @@ -95,6 +106,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index fa544c6a3e8..9638d96862e 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'onlyRead', +- optional: false, range: [86, 94], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'instanceMethod', +- optional: false, range: [97, 111], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -63,6 +69,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc end: { column: 21, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -89,9 +96,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -99,6 +110,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot index e0879aad4f7..535c073cbc9 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: [], name: "staticMethod", + optional: false, range: [99, 111], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -59,6 +65,7 @@ Program { end: { column: 26, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -85,9 +92,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "D", + optional: false, range: [79, 80], loc: { @@ -95,6 +106,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 4b4f60f3ffa..27639e3a67b 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'staticMethod', +- optional: false, range: [99, 111], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -63,6 +69,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- end: { column: 26, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -89,9 +96,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'D', +- optional: false, range: [79, 80], loc: { @@ -99,6 +110,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot index 6f6ba7b1877..85106e819d0 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot @@ -29,7 +29,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: [], name: "fs", + optional: false, range: [114, 116], loc: { @@ -61,6 +63,7 @@ Program { }, }, declare: true, + global: false, id: Literal { type: "Literal", raw: "'i-use-things'", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot index a4bb38eda3c..c77ae1fc5ef 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot @@ -33,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules ambient-module-decl type: 'ImportDefaultSpecifier', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fs', +- optional: false, range: [114, 116], loc: { @@ -65,6 +67,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules ambient-module-decl }, }, declare: true, +- global: false, id: Literal { type: 'Literal', raw: '\\'i-use-things\\'', diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..d153d51196f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-Babel-AST.shot @@ -0,0 +1,160 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-with-exported-function Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + declaration: TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "select", + + range: [114, 120], + loc: { + start: { column: 18, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "selector", + typeAnnotation: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSStringKeyword { + type: "TSStringKeyword", + + range: [131, 137], + loc: { + start: { column: 35, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + + range: [129, 137], + loc: { + start: { column: 33, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + + range: [121, 137], + loc: { + start: { column: 25, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "Selection", + + range: [140, 149], + loc: { + start: { column: 44, line: 4 }, + end: { column: 53, line: 4 }, + }, + }, + typeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSAnyKeyword { + type: "TSAnyKeyword", + + range: [150, 153], + loc: { + start: { column: 54, line: 4 }, + end: { column: 57, line: 4 }, + }, + }, + ], + + range: [149, 154], + loc: { + start: { column: 53, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + + range: [140, 154], + loc: { + start: { column: 44, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + + range: [138, 154], + loc: { + start: { column: 42, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + + range: [105, 155], + loc: { + start: { column: 9, line: 4 }, + end: { column: 59, line: 4 }, + }, + }, + exportKind: "value", + source: null, + specifiers: Array [], + + range: [98, 155], + loc: { + start: { column: 2, line: 4 }, + end: { column: 59, line: 4 }, + }, + }, + ], + + range: [94, 157], + loc: { + start: { column: 21, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "d3", + + range: [91, 93], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [73, 157], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: "module", + + range: [73, 158], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, +} +`; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot index 7a9520eefe6..bc1ef7402cc 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot @@ -15,11 +15,14 @@ Program { declaration: TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "select", + optional: false, range: [114, 120], loc: { @@ -30,7 +33,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "selector", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -61,17 +66,7 @@ Program { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Selection", - - range: [140, 149], - loc: { - start: { column: 44, line: 4 }, - end: { column: 53, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSAnyKeyword { @@ -91,6 +86,18 @@ Program { end: { column: 58, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Selection", + optional: false, + + range: [140, 149], + loc: { + start: { column: 44, line: 4 }, + end: { column: 53, line: 4 }, + }, + }, range: [140, 154], loc: { @@ -131,9 +138,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "d3", + optional: false, range: [91, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..3461c38ebce --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/2-Babel-Tokens.shot @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-with-exported-function Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "d3", + + range: [91, 93], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [94, 95], + loc: { + start: { column: 21, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + Keyword { + type: "Keyword", + value: "export", + + range: [98, 104], + loc: { + start: { column: 2, line: 4 }, + end: { column: 8, line: 4 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [105, 113], + loc: { + start: { column: 9, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "select", + + range: [114, 120], + loc: { + start: { column: 18, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [120, 121], + loc: { + start: { column: 24, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "selector", + + range: [121, 129], + loc: { + start: { column: 25, line: 4 }, + end: { column: 33, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [129, 130], + loc: { + start: { column: 33, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [131, 137], + loc: { + start: { column: 35, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [137, 138], + loc: { + start: { column: 41, line: 4 }, + end: { column: 42, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [138, 139], + loc: { + start: { column: 42, line: 4 }, + end: { column: 43, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "Selection", + + range: [140, 149], + loc: { + start: { column: 44, line: 4 }, + end: { column: 53, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [149, 150], + loc: { + start: { column: 53, line: 4 }, + end: { column: 54, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "any", + + range: [150, 153], + loc: { + start: { column: 54, line: 4 }, + end: { column: 57, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [153, 154], + loc: { + start: { column: 57, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [154, 155], + loc: { + start: { column: 58, line: 4 }, + end: { column: 59, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [156, 157], + loc: { + start: { column: 0, line: 5 }, + end: { column: 1, line: 5 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot index 0281bcdcbc1..8732ff7462b 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot @@ -19,11 +19,14 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w declaration: TSDeclareFunction { type: 'TSDeclareFunction', async: false, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'select', +- optional: false, range: [114, 120], loc: { @@ -34,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'selector', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -65,17 +70,18 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Selection', - - range: [140, 149], - loc: { - start: { column: 44, line: 4 }, - end: { column: 53, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Selection', ++ ++ range: [140, 149], ++ loc: { ++ start: { column: 44, line: 4 }, ++ end: { column: 53, line: 4 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSAnyKeyword { @@ -95,7 +101,19 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w end: { column: 58, line: 4 }, }, }, - +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Selection', +- optional: false, + +- range: [140, 149], +- loc: { +- start: { column: 44, line: 4 }, +- end: { column: 53, line: 4 }, +- }, +- }, +- range: [140, 154], loc: { start: { column: 44, line: 4 }, @@ -135,9 +153,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd3', +- optional: false, range: [91, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-Babel-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-Babel-AST.shot new file mode 100644 index 00000000000..138b3944413 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-Babel-AST.shot @@ -0,0 +1,108 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-declaration Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [114, 116], + loc: { + start: { column: 24, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "global", + + range: [107, 113], + loc: { + start: { column: 17, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [92, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [144, 146], + loc: { + start: { column: 27, line: 5 }, + end: { column: 29, line: 5 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "global", + + range: [137, 143], + loc: { + start: { column: 20, line: 5 }, + end: { column: 26, line: 5 }, + }, + }, + + range: [119, 146], + loc: { + start: { column: 2, line: 5 }, + end: { column: 29, line: 5 }, + }, + }, + ], + + range: [88, 148], + loc: { + start: { column: 15, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + declare: true, + global: true, + id: Identifier { + type: "Identifier", + name: "global", + + range: [81, 87], + loc: { + start: { column: 8, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [73, 148], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: "script", + + range: [73, 149], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, +} +`; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot index 1d9549b200d..19d5df14c2b 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot @@ -22,9 +22,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [107, 113], loc: { @@ -53,9 +56,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [137, 143], loc: { @@ -83,7 +89,9 @@ Program { global: true, id: Identifier { type: "Identifier", + decorators: [], name: "global", + optional: false, range: [81, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/2-Babel-Tokens.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/2-Babel-Tokens.shot new file mode 100644 index 00000000000..dcc869e00d2 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/2-Babel-Tokens.shot @@ -0,0 +1,146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-declaration Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "global", + + range: [81, 87], + loc: { + start: { column: 8, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [88, 89], + loc: { + start: { column: 15, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "declare", + + range: [92, 99], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "module", + + range: [100, 106], + loc: { + start: { column: 10, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "global", + + range: [107, 113], + loc: { + start: { column: 17, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [114, 115], + loc: { + start: { column: 24, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [115, 116], + loc: { + start: { column: 25, line: 4 }, + end: { column: 26, line: 4 }, + }, + }, + Identifier { + type: "Identifier", + value: "declare", + + range: [119, 126], + loc: { + start: { column: 2, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [127, 136], + loc: { + start: { column: 10, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + Identifier { + type: "Identifier", + value: "global", + + range: [137, 143], + loc: { + start: { column: 20, line: 5 }, + end: { column: 26, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [144, 145], + loc: { + start: { column: 27, line: 5 }, + end: { column: 28, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [145, 146], + loc: { + start: { column: 28, line: 5 }, + end: { column: 29, line: 5 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [147, 148], + loc: { + start: { column: 0, line: 6 }, + end: { column: 1, line: 6 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot index 3256de74436..369d392b0bb 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot @@ -26,9 +26,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-decla }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [107, 113], loc: { @@ -57,9 +60,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-decla }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [137, 143], loc: { @@ -87,7 +93,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-decla global: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [81, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot index 8995a4b18b9..95abe8bc166 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot @@ -13,15 +13,19 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method", + optional: false, range: [119, 125], loc: { @@ -30,6 +34,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -45,6 +50,7 @@ Program { end: { column: 18, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -55,7 +61,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [129, 130], loc: { @@ -99,9 +107,13 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [111, 112], loc: { @@ -109,6 +121,7 @@ Program { end: { column: 24, line: 4 }, }, }, + implements: [], superClass: null, range: [105, 137], @@ -140,11 +153,14 @@ Program { end: { column: 34, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [164, 167], loc: { @@ -176,6 +192,8 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + global: false, id: Literal { type: "Literal", raw: "'foo'", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot index 8c520bc8957..0ea1f6bf795 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot @@ -17,15 +17,19 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [119, 125], loc: { @@ -34,6 +38,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -49,6 +54,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 18, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -59,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [129, 130], loc: { @@ -103,9 +111,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 3, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [111, 112], loc: { @@ -113,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 24, line: 4 }, }, }, +- implements: Array [], superClass: null, range: [105, 137], @@ -144,11 +157,14 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 34, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [164, 167], loc: { @@ -180,6 +196,8 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 1, line: 8 }, }, }, +- declare: false, +- global: false, id: Literal { type: 'Literal', raw: '\\'foo\\'', diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot index 7a69ae733f8..1c290645bdc 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [97, 98], loc: { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [93, 115], @@ -69,15 +73,19 @@ Program { assertions: [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [143, 154], loc: { @@ -86,6 +94,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -101,6 +110,7 @@ Program { end: { column: 54, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -108,9 +118,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -136,6 +150,8 @@ Program { end: { column: 32, line: 6 }, }, }, + readonly: false, + static: false, range: [155, 171], loc: { @@ -146,9 +162,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: [], + override: false, parameter: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -174,6 +194,8 @@ Program { end: { column: 50, line: 6 }, }, }, + readonly: false, + static: false, range: [173, 189], loc: { @@ -204,9 +226,13 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Point", + optional: false, range: [131, 136], loc: { @@ -214,6 +240,7 @@ Program { end: { column: 20, line: 5 }, }, }, + implements: [], superClass: null, range: [125, 197], @@ -253,7 +280,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, range: [250, 254], loc: { @@ -261,6 +290,9 @@ Program { end: { column: 10, line: 10 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -294,9 +326,13 @@ Program { end: { column: 5, line: 11 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Id", + optional: false, range: [239, 241], loc: { @@ -329,9 +365,13 @@ Program { end: { column: 3, line: 12 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [214, 215], loc: { @@ -365,9 +405,13 @@ Program { end: { column: 1, line: 13 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [80, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot index e56b3755388..dd7ddcca6f7 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [97, 98], loc: { @@ -50,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod }, }, ], +- declare: false, kind: 'var', range: [93, 115], @@ -73,15 +77,19 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [143, 154], loc: { @@ -90,6 +98,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -105,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 54, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -112,9 +122,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -140,6 +154,8 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 32, line: 6 }, }, }, +- readonly: false, +- static: false, range: [155, 171], loc: { @@ -150,9 +166,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -178,6 +198,8 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 50, line: 6 }, }, }, +- readonly: false, +- static: false, range: [173, 189], loc: { @@ -208,9 +230,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 3, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Point', +- optional: false, range: [131, 136], loc: { @@ -218,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 20, line: 5 }, }, }, +- implements: Array [], superClass: null, range: [125, 197], @@ -257,7 +284,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [250, 254], loc: { @@ -265,6 +294,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 10, line: 10 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -298,9 +330,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 5, line: 11 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Id', +- optional: false, range: [239, 241], loc: { @@ -333,9 +369,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 3, line: 12 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [214, 215], loc: { @@ -369,9 +409,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 1, line: 13 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [80, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot index 0d66ff7b55f..a2999a6fc22 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot @@ -7,6 +7,7 @@ Program { TSModuleDeclaration { type: "TSModuleDeclaration", declare: true, + global: false, id: Literal { type: "Literal", raw: "'hot-new-module'", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot index f03ca3edb1e..2071f13fefd 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot @@ -11,6 +11,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules shorthand-ambient-m TSModuleDeclaration { type: 'TSModuleDeclaration', declare: true, +- global: false, id: Literal { type: 'Literal', raw: '\\'hot-new-module\\'', diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..719a4d1f457 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures parameter-decorators _error_ parameter-array-pattern-decorator Babel - Error 1`] = `[SyntaxError: Unexpected token (4:28)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..c2c925447eb --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures parameter-decorators _error_ parameter-array-pattern-decorator Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..0cc1f717806 --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures parameter-decorators _error_ parameter-rest-element-decorator Babel - Error 1`] = `[SyntaxError: Unexpected token (4:21)]`; diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..49d961c5a2f --- /dev/null +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures legacy-fixtures parameter-decorators _error_ parameter-rest-element-decorator Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot index 8c030275248..50f94cf4a55 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "constructor", + optional: false, range: [91, 102], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -50,7 +55,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "title", + optional: false, range: [153, 158], loc: { @@ -71,7 +78,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: [], name: "config", + optional: false, range: [161, 167], loc: { @@ -82,7 +91,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "title", + optional: false, range: [168, 173], loc: { @@ -119,6 +130,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -133,7 +145,9 @@ Program { arguments: [ Identifier { type: "Identifier", + decorators: [], name: "APP_CONFIG", + optional: false, range: [111, 121], loc: { @@ -144,7 +158,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "Inject", + optional: false, range: [104, 110], loc: { @@ -169,13 +185,16 @@ Program { }, ], name: "config", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "AppConfig", + optional: false, range: [131, 140], loc: { @@ -227,9 +246,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Service", + optional: false, range: [79, 86], loc: { @@ -237,6 +260,7 @@ Program { end: { column: 13, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 180], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot index 888328c7c4b..e7f1056280c 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [91, 102], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -54,7 +59,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'title', +- optional: false, range: [153, 158], loc: { @@ -75,7 +82,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'config', +- optional: false, range: [161, 167], loc: { @@ -86,7 +95,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'title', +- optional: false, range: [168, 173], loc: { @@ -123,6 +134,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -137,7 +149,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c arguments: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'APP_CONFIG', +- optional: false, range: [111, 121], loc: { @@ -148,7 +162,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Inject', +- optional: false, range: [104, 110], loc: { @@ -173,13 +189,16 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c }, ], name: 'config', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AppConfig', +- optional: false, range: [131, 140], loc: { @@ -231,9 +250,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Service', +- optional: false, range: [79, 86], loc: { @@ -241,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c end: { column: 13, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 180], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot index 8a4d5f4c98b..16c3a1c3475 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [87, 90], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 36, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "special", + optional: false, range: [92, 99], loc: { @@ -89,6 +97,7 @@ Program { }, ], name: "baz", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -137,9 +146,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -147,6 +160,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 5f239612d63..c38dc753a9d 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [87, 90], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 36, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -68,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'special', +- optional: false, range: [92, 99], loc: { @@ -93,6 +101,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, ], name: 'baz', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -141,9 +150,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -151,6 +164,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot index 13b43a4c786..562801ba6bc 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [100, 103], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 43, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "special", + optional: false, range: [105, 112], loc: { @@ -89,6 +97,7 @@ Program { }, ], name: "baz", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -137,9 +146,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "StaticFoo", + optional: false, range: [79, 88], loc: { @@ -147,6 +160,7 @@ Program { end: { column: 15, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 136], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index ec48a91bda0..392950de414 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [100, 103], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 43, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -68,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'special', +- optional: false, range: [105, 112], loc: { @@ -93,6 +101,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, ], name: 'baz', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -141,9 +150,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'StaticFoo', +- optional: false, range: [79, 88], loc: { @@ -151,6 +164,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 15, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 136], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot index 0c36c85c3fb..8daae6f9517 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "greet", + optional: false, range: [91, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -51,7 +56,9 @@ Program { operator: "+", right: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, range: [145, 149], loc: { @@ -100,6 +107,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -111,7 +119,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "required", + optional: false, range: [98, 106], loc: { @@ -128,6 +138,7 @@ Program { }, ], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -176,9 +187,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Greeter", + optional: false, range: [79, 86], loc: { @@ -186,6 +201,7 @@ Program { end: { column: 13, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 162], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index b84aefb6c2c..e8ae8251a0b 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'greet', +- optional: false, range: [91, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -55,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i operator: '+', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [145, 149], loc: { @@ -104,6 +111,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -115,7 +123,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'required', +- optional: false, range: [98, 106], loc: { @@ -132,6 +142,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i }, ], name: 'name', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -180,9 +191,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Greeter', +- optional: false, range: [79, 86], loc: { @@ -190,6 +205,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i end: { column: 13, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 162], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot index 010f9e11d87..c0b3496f741 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "greet", + optional: false, range: [104, 109], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -51,7 +56,9 @@ Program { operator: "+", right: Identifier { type: "Identifier", + decorators: [], name: "name", + optional: false, range: [158, 162], loc: { @@ -100,6 +107,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -111,7 +119,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "required", + optional: false, range: [111, 119], loc: { @@ -128,6 +138,7 @@ Program { }, ], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -176,9 +187,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "StaticGreeter", + optional: false, range: [79, 92], loc: { @@ -186,6 +201,7 @@ Program { end: { column: 19, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 175], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 137099e071b..337726590ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'greet', +- optional: false, range: [104, 109], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -55,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s operator: '+', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [158, 162], loc: { @@ -104,6 +111,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -115,7 +123,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'required', +- optional: false, range: [111, 119], loc: { @@ -132,6 +142,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s }, ], name: 'name', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -180,9 +191,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'StaticGreeter', +- optional: false, range: [79, 92], loc: { @@ -190,6 +205,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s end: { column: 19, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 175], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot index d74da3c5e8b..667f786e034 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [87, 90], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 37, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "special", + optional: false, range: [92, 99], loc: { @@ -88,13 +96,16 @@ Program { }, }, ], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [108, 111], loc: { @@ -104,10 +115,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [108, 111], loc: { @@ -171,9 +185,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -181,6 +199,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 124], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot index 95cc2b08579..514ba574c58 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [87, 90], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt end: { column: 37, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -68,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'special', +- optional: false, range: [92, 99], loc: { @@ -92,13 +100,16 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt }, }, ], +- optional: false, properties: Array [ Property { type: 'Property', computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [108, 111], loc: { @@ -108,10 +119,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt }, kind: 'init', method: false, +- optional: false, shorthand: true, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [108, 111], loc: { @@ -175,9 +189,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -185,6 +203,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 124], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot index 966aaf6f614..f0f1404d5e8 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -21,7 +22,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "Input", + optional: false, range: [98, 103], loc: { @@ -45,9 +48,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "data", + optional: false, range: [106, 110], loc: { @@ -55,7 +61,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -77,7 +85,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "Output", + optional: false, range: [115, 121], loc: { @@ -101,9 +111,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "click", + optional: false, range: [126, 131], loc: { @@ -111,14 +124,18 @@ Program { end: { column: 7, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: NewExpression { type: "NewExpression", arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "EventEmitter", + optional: false, range: [138, 150], loc: { @@ -148,9 +165,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "SomeComponent", + optional: false, range: [79, 92], loc: { @@ -158,6 +179,7 @@ Program { end: { column: 19, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot index 2190670be4d..30900af22c0 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -25,7 +26,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Input', +- optional: false, range: [98, 103], loc: { @@ -49,9 +52,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'data', +- optional: false, range: [106, 110], loc: { @@ -59,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -81,7 +89,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Output', +- optional: false, range: [115, 121], loc: { @@ -105,9 +115,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'click', +- optional: false, range: [126, 131], loc: { @@ -115,14 +128,18 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 7, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: NewExpression { type: 'NewExpression', arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'EventEmitter', +- optional: false, range: [138, 150], loc: { @@ -152,9 +169,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [79, 92], loc: { @@ -162,6 +183,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 19, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot index 42d3d5a3c5c..89002b0a383 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -33,7 +34,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "configurable", + optional: false, range: [86, 98], loc: { @@ -57,9 +60,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop1", + optional: false, range: [112, 117], loc: { @@ -67,7 +73,9 @@ Program { end: { column: 34, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -101,7 +109,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: [], name: "configurable", + optional: false, range: [123, 135], loc: { @@ -125,9 +135,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "prop2", + optional: false, range: [152, 157], loc: { @@ -135,7 +148,9 @@ Program { end: { column: 14, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -153,9 +168,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [79, 80], loc: { @@ -163,6 +182,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 160], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot index 600f2728bab..837f9a425a7 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -37,7 +38,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'configurable', +- optional: false, range: [86, 98], loc: { @@ -61,9 +64,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop1', +- optional: false, range: [112, 117], loc: { @@ -71,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 34, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -105,7 +113,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'configurable', +- optional: false, range: [123, 135], loc: { @@ -129,9 +139,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop2', +- optional: false, range: [152, 157], loc: { @@ -139,7 +152,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 14, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -157,9 +172,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -167,6 +186,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 160], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot index dda047dc2e9..3ea99285bd0 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -18,7 +19,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [86, 89], loc: { @@ -34,9 +37,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [90, 91], loc: { @@ -44,7 +50,9 @@ Program { end: { column: 8, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -63,7 +71,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "bar", + optional: false, range: [96, 99], loc: { @@ -79,9 +89,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, range: [102, 103], loc: { @@ -89,7 +102,9 @@ Program { end: { column: 3, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -107,9 +122,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [79, 80], loc: { @@ -117,6 +136,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 106], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 01d21db7aba..bfed32cce86 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -22,7 +23,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [86, 89], loc: { @@ -38,9 +41,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [90, 91], loc: { @@ -48,7 +54,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 8, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -67,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [96, 99], loc: { @@ -83,9 +93,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, range: [102, 103], loc: { @@ -93,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 3, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -111,9 +126,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [79, 80], loc: { @@ -121,6 +140,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 106], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot index 02a59096f9b..6d0c6efc36c 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -18,7 +19,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "baz", + optional: false, range: [86, 89], loc: { @@ -34,9 +37,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [97, 98], loc: { @@ -44,7 +50,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -63,7 +71,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: [], name: "qux", + optional: false, range: [103, 106], loc: { @@ -79,9 +89,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [116, 117], loc: { @@ -89,7 +102,9 @@ Program { end: { column: 10, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -107,9 +122,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [79, 80], loc: { @@ -117,6 +136,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 8e633925fae..13aebd9d608 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -22,7 +23,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [86, 89], loc: { @@ -38,9 +41,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [97, 98], loc: { @@ -48,7 +54,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -67,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'qux', +- optional: false, range: [103, 106], loc: { @@ -83,9 +93,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [116, 117], loc: { @@ -93,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 10, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -111,9 +126,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -121,6 +140,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot index 225fb3a806d..9b9c1ecf16e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot index 66962c9338c..d167672eac0 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,59 @@ exports[`AST Fixtures legacy-fixtures types array-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSArrayType { + type: 'TSArrayType', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [84, 92], + loc: { + start: { column: 11, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot index 90bc8486378..0a99fe4c889 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Unpacked", + optional: false, range: [78, 86], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [92, 93], loc: { @@ -47,7 +52,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [109, 110], loc: { @@ -83,7 +90,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [124, 125], loc: { @@ -106,7 +115,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [140, 141], loc: { @@ -135,7 +146,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [152, 153], loc: { @@ -152,17 +165,7 @@ Program { }, extendsType: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Promise", - - range: [162, 169], - loc: { - start: { column: 14, line: 7 }, - end: { column: 21, line: 7 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSInferType { @@ -173,7 +176,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [176, 177], loc: { @@ -204,6 +209,18 @@ Program { end: { column: 30, line: 7 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Promise", + optional: false, + + range: [162, 169], + loc: { + start: { column: 14, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, range: [162, 178], loc: { @@ -215,7 +232,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [189, 190], loc: { @@ -234,7 +253,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [183, 184], loc: { @@ -260,7 +281,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [146, 147], loc: { @@ -286,7 +309,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [118, 119], loc: { @@ -317,7 +342,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot index 72a35e38426..d24b2949995 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Unpacked', +- optional: false, range: [78, 86], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [92, 93], loc: { @@ -51,6 +56,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], + elementType: TSParenthesizedType { + type: 'TSParenthesizedType', + typeAnnotation: TSInferType { @@ -58,6 +64,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme + typeParameter: TSTypeParameter { + type: 'TSTypeParameter', name: 'U', +- optional: false, range: [109, 110], loc: { @@ -98,7 +105,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [124, 125], loc: { @@ -121,7 +130,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [140, 141], - loc: { @@ -151,7 +162,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [152, 153], loc: { @@ -168,17 +181,18 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme }, extendsType: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Promise', - - range: [162, 169], - loc: { - start: { column: 14, line: 7 }, - end: { column: 21, line: 7 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Promise', ++ ++ range: [162, 169], ++ loc: { ++ start: { column: 14, line: 7 }, ++ end: { column: 21, line: 7 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSInferType { @@ -189,7 +203,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [176, 177], - loc: { @@ -221,7 +237,19 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme end: { column: 30, line: 7 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Promise', +- optional: false, +- range: [162, 169], +- loc: { +- start: { column: 14, line: 7 }, +- end: { column: 21, line: 7 }, +- }, +- }, +- range: [162, 178], loc: { start: { column: 14, line: 7 }, @@ -232,7 +260,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [189, 190], loc: { @@ -251,7 +281,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [183, 184], loc: { @@ -277,7 +309,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [146, 147], loc: { @@ -303,7 +337,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [118, 119], loc: { @@ -334,7 +370,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [87, 88], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot index 75f88840e0c..7154c778112 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [87, 88], loc: { @@ -45,7 +50,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [99, 100], loc: { @@ -53,6 +60,9 @@ Program { end: { column: 27, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSInferType { @@ -63,7 +73,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [108, 109], loc: { @@ -105,7 +117,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [111, 112], loc: { @@ -113,6 +127,9 @@ Program { end: { column: 39, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSInferType { @@ -123,7 +140,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [120, 121], loc: { @@ -181,7 +200,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [126, 127], loc: { @@ -212,7 +233,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [82, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot index 3e71f1e73e3..eea7b96d473 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [78, 81], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [87, 88], loc: { @@ -49,7 +54,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [99, 100], loc: { @@ -57,6 +64,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme end: { column: 27, line: 3 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSInferType { @@ -67,8 +77,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [108, 109], - loc: { - start: { column: 35, line: 3 }, @@ -76,8 +89,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - }, - }, - out: false, -+ name: 'U', - +- range: [108, 109], loc: { start: { column: 35, line: 3 }, @@ -110,7 +122,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [111, 112], loc: { @@ -118,6 +132,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme end: { column: 39, line: 3 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSInferType { @@ -128,7 +145,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [120, 121], - loc: { @@ -187,7 +206,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [126, 127], loc: { @@ -218,7 +239,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [82, 83], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot index 7f0ff3f1301..d2240994ff9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "X3", + optional: false, range: [78, 80], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [86, 87], loc: { @@ -57,7 +62,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [103, 104], loc: { @@ -99,24 +106,16 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "MustBeNumber", - - range: [123, 135], - loc: { - start: { column: 50, line: 3 }, - end: { column: 62, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [136, 137], loc: { @@ -139,6 +138,18 @@ Program { end: { column: 65, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "MustBeNumber", + optional: false, + + range: [123, 135], + loc: { + start: { column: 50, line: 3 }, + end: { column: 62, line: 3 }, + }, + }, range: [123, 138], loc: { @@ -162,7 +173,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [81, 82], loc: { @@ -195,9 +208,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "X4", + optional: false, range: [153, 155], loc: { @@ -211,7 +227,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [161, 162], loc: { @@ -246,7 +264,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [178, 179], loc: { @@ -286,7 +306,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [202, 203], loc: { @@ -328,24 +350,16 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "MustBeNumber", - - range: [224, 236], - loc: { - start: { column: 4, line: 5 }, - end: { column: 16, line: 5 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [237, 238], loc: { @@ -368,6 +382,18 @@ Program { end: { column: 19, line: 5 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "MustBeNumber", + optional: false, + + range: [224, 236], + loc: { + start: { column: 4, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, range: [224, 239], loc: { @@ -391,7 +417,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [156, 157], loc: { @@ -424,9 +452,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "X5", + optional: false, range: [256, 258], loc: { @@ -440,7 +471,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [264, 265], loc: { @@ -475,7 +508,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [281, 282], loc: { @@ -506,7 +541,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [305, 306], loc: { @@ -548,24 +585,16 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "MustBeNumber", - - range: [312, 324], - loc: { - start: { column: 4, line: 8 }, - end: { column: 16, line: 8 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [325, 326], loc: { @@ -588,6 +617,18 @@ Program { end: { column: 19, line: 8 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "MustBeNumber", + optional: false, + + range: [312, 324], + loc: { + start: { column: 4, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, range: [312, 327], loc: { @@ -611,7 +652,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [259, 260], loc: { @@ -644,9 +687,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "X6", + optional: false, range: [344, 346], loc: { @@ -660,7 +706,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [352, 353], loc: { @@ -686,7 +734,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [369, 370], loc: { @@ -726,7 +776,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [378, 379], loc: { @@ -768,24 +820,16 @@ Program { }, trueType: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "MustBeNumber", - - range: [400, 412], - loc: { - start: { column: 4, line: 11 }, - end: { column: 16, line: 11 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [413, 414], loc: { @@ -808,6 +852,18 @@ Program { end: { column: 19, line: 11 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "MustBeNumber", + optional: false, + + range: [400, 412], + loc: { + start: { column: 4, line: 11 }, + end: { column: 16, line: 11 }, + }, + }, range: [400, 415], loc: { @@ -831,7 +887,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [347, 348], loc: { @@ -864,9 +922,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "X7", + optional: false, range: [432, 434], loc: { @@ -880,7 +941,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [440, 441], loc: { @@ -915,7 +978,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [457, 458], loc: { @@ -955,7 +1020,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [481, 482], loc: { @@ -999,7 +1066,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [503, 504], loc: { @@ -1030,7 +1099,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [435, 436], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot index 66f821f85af..1b714bc6989 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X3', +- optional: false, range: [78, 80], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [86, 87], loc: { @@ -61,7 +66,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [103, 104], - loc: { @@ -104,24 +111,27 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'MustBeNumber', - - range: [123, 135], - loc: { - start: { column: 50, line: 3 }, - end: { column: 62, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'MustBeNumber', ++ ++ range: [123, 135], ++ loc: { ++ start: { column: 50, line: 3 }, ++ end: { column: 62, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [136, 137], loc: { @@ -142,6 +152,18 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS loc: { start: { column: 62, line: 3 }, end: { column: 65, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'MustBeNumber', +- optional: false, +- +- range: [123, 135], +- loc: { +- start: { column: 50, line: 3 }, +- end: { column: 62, line: 3 }, }, }, @@ -167,7 +189,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [81, 82], - loc: { @@ -201,9 +225,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X4', +- optional: false, range: [153, 155], loc: { @@ -217,7 +244,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [161, 162], loc: { @@ -252,7 +281,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [178, 179], - loc: { @@ -293,7 +324,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [202, 203], - loc: { @@ -336,24 +369,27 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'MustBeNumber', - - range: [224, 236], - loc: { - start: { column: 4, line: 5 }, - end: { column: 16, line: 5 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'MustBeNumber', ++ ++ range: [224, 236], ++ loc: { ++ start: { column: 4, line: 5 }, ++ end: { column: 16, line: 5 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [237, 238], loc: { @@ -376,7 +412,19 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS end: { column: 19, line: 5 }, }, }, - +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'MustBeNumber', +- optional: false, + +- range: [224, 236], +- loc: { +- start: { column: 4, line: 5 }, +- end: { column: 16, line: 5 }, +- }, +- }, +- range: [224, 239], loc: { start: { column: 4, line: 5 }, @@ -399,8 +447,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, ++ name: 'T', + - range: [156, 157], - loc: { - start: { column: 8, line: 4 }, @@ -408,8 +459,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -+ name: 'T', - +- range: [156, 157], loc: { start: { column: 8, line: 4 }, @@ -433,9 +483,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X5', +- optional: false, range: [256, 258], loc: { @@ -449,7 +502,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [264, 265], loc: { @@ -484,9 +539,10 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -+ name: 'U', - +- optional: false, +- - range: [281, 282], - loc: { - start: { column: 30, line: 7 }, @@ -494,7 +550,8 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -- ++ name: 'U', + range: [281, 297], loc: { start: { column: 30, line: 7 }, @@ -516,7 +573,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [305, 306], - loc: { @@ -559,24 +618,27 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'MustBeNumber', - - range: [312, 324], - loc: { - start: { column: 4, line: 8 }, - end: { column: 16, line: 8 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'MustBeNumber', ++ ++ range: [312, 324], ++ loc: { ++ start: { column: 4, line: 8 }, ++ end: { column: 16, line: 8 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [325, 326], loc: { @@ -597,6 +659,18 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS loc: { start: { column: 16, line: 8 }, end: { column: 19, line: 8 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'MustBeNumber', +- optional: false, +- +- range: [312, 324], +- loc: { +- start: { column: 4, line: 8 }, +- end: { column: 16, line: 8 }, }, }, @@ -622,7 +696,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [259, 260], - loc: { @@ -656,9 +732,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X6', +- optional: false, range: [344, 346], loc: { @@ -672,7 +751,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [352, 353], loc: { @@ -698,7 +779,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [369, 370], - loc: { @@ -739,7 +822,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [378, 379], - loc: { @@ -782,24 +867,27 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, trueType: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'MustBeNumber', - - range: [400, 412], - loc: { - start: { column: 4, line: 11 }, - end: { column: 16, line: 11 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'MustBeNumber', ++ ++ range: [400, 412], ++ loc: { ++ start: { column: 4, line: 11 }, ++ end: { column: 16, line: 11 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [413, 414], loc: { @@ -820,6 +908,18 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS loc: { start: { column: 16, line: 11 }, end: { column: 19, line: 11 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'MustBeNumber', +- optional: false, +- +- range: [400, 412], +- loc: { +- start: { column: 4, line: 11 }, +- end: { column: 16, line: 11 }, }, }, @@ -845,7 +945,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [347, 348], - loc: { @@ -879,9 +981,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X7', +- optional: false, range: [432, 434], loc: { @@ -895,7 +1000,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [440, 441], loc: { @@ -930,7 +1037,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [457, 458], - loc: { @@ -971,9 +1080,10 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -+ name: 'U', - +- optional: false, +- - range: [481, 482], - loc: { - start: { column: 54, line: 13 }, @@ -981,7 +1091,8 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -- ++ name: 'U', + range: [481, 497], loc: { start: { column: 54, line: 13 }, @@ -1016,7 +1127,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [503, 504], loc: { @@ -1047,7 +1160,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [435, 436], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot index 5729345d21c..799c9beb9ba 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Element", + optional: false, range: [78, 85], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [91, 92], loc: { @@ -47,7 +52,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [108, 109], loc: { @@ -81,7 +88,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [119, 120], loc: { @@ -100,7 +109,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [115, 116], loc: { @@ -131,7 +142,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [86, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot index bc029519def..5e5c20256cf 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Element', +- optional: false, range: [78, 85], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [91, 92], loc: { @@ -51,6 +56,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], + elementType: TSParenthesizedType { + type: 'TSParenthesizedType', + typeAnnotation: TSInferType { @@ -58,6 +64,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS + typeParameter: TSTypeParameter { + type: 'TSTypeParameter', name: 'U', +- optional: false, range: [108, 109], loc: { @@ -96,7 +103,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [119, 120], loc: { @@ -115,7 +124,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [115, 116], loc: { @@ -146,7 +157,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [86, 87], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot index c706c876155..f8289e15847 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConditionalType { @@ -82,6 +85,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 119], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot index be2ad0cc13c..ed615cbcd19 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,109 @@ exports[`AST Fixtures legacy-fixtures types conditional-with-null AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSConditionalType { + type: 'TSConditionalType', + checkType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [80, 86], + loc: { + start: { column: 7, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + extendsType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + falseType: TSNullKeyword { + type: 'TSNullKeyword', + + range: [114, 118], + loc: { + start: { column: 41, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + trueType: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [104, 111], + loc: { + start: { column: 31, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [80, 118], + loc: { + start: { column: 7, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + + range: [78, 118], + loc: { + start: { column: 5, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + + range: [77, 118], + loc: { + start: { column: 4, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + init: null, + + range: [77, 118], + loc: { + start: { column: 4, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 119], + loc: { + start: { column: 0, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 120], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot index 169e3213d25..c44680df911 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConditionalType { @@ -82,6 +85,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot index f451cd31629..a9d6aaafa0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,109 @@ exports[`AST Fixtures legacy-fixtures types conditional AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSConditionalType { + type: 'TSConditionalType', + checkType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [80, 86], + loc: { + start: { column: 7, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + extendsType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + falseType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [114, 120], + loc: { + start: { column: 41, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + trueType: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [104, 111], + loc: { + start: { column: 31, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [80, 120], + loc: { + start: { column: 7, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [78, 120], + loc: { + start: { column: 5, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [77, 120], + loc: { + start: { column: 4, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + init: null, + + range: [77, 120], + loc: { + start: { column: 4, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 121], + loc: { + start: { column: 0, line: 3 }, + end: { column: 48, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 122], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot index fe59ab02cad..7becf39220c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -66,6 +69,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot index 18d7b8a9fb1..323e019ff1f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-abstract AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -72,6 +75,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-abstract AST Alignment - }, }, ], +- declare: false, kind: 'var', range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot index 1c3027b53b7..293811334c3 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -66,6 +69,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot index 06360892a57..b396e883fd4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-empty AST Alignment - AS declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -72,6 +75,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-empty AST Alignment - AS }, }, ], +- declare: false, kind: 'var', range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot index f033a300a71..c857057fcb4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -20,14 +23,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [91, 92], loc: { @@ -63,7 +70,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [97, 98], loc: { @@ -94,7 +103,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [85, 86], loc: { @@ -148,6 +159,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 99], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot index 1726ad50b2f..19c035fb72c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -25,14 +28,18 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [91, 92], loc: { @@ -69,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [97, 98], loc: { @@ -100,7 +109,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [85, 86], - loc: { @@ -155,6 +166,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 99], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot index b67848f0878..5d1733dfb27 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot @@ -9,24 +9,17 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [80, 85], - loc: { - start: { column: 7, line: 3 }, - end: { column: 12, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSConstructorType { @@ -66,6 +59,18 @@ Program { end: { column: 30, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, range: [80, 103], loc: { @@ -96,6 +101,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot index 322828642b2..bccbac1b833 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,24 +13,28 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Array', - - range: [80, 85], - loc: { - start: { column: 7, line: 3 }, - end: { column: 12, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [80, 85], ++ loc: { ++ start: { column: 7, line: 3 }, ++ end: { column: 12, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSConstructorType { @@ -72,7 +76,19 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment end: { column: 30, line: 3 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- range: [80, 85], +- loc: { +- start: { column: 7, line: 3 }, +- end: { column: 12, line: 3 }, +- }, +- }, +- range: [80, 103], loc: { start: { column: 7, line: 3 }, @@ -102,6 +118,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment }, }, ], +- declare: false, kind: 'let', range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot index 2948097fb1c..dd4b9cc383a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -22,7 +25,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [88, 89], loc: { @@ -30,6 +35,8 @@ Program { end: { column: 16, line: 3 }, }, }, + decorators: [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSArrayType { @@ -113,6 +120,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot index 7dd96ce1e6a..8f5e827d8c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [88, 89], loc: { @@ -35,6 +40,8 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment end: { column: 16, line: 3 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSArrayType { @@ -119,6 +126,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment }, }, ], +- declare: false, kind: 'let', range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot index a4234ce3c19..775dc0a7251 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -20,7 +23,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -48,6 +53,7 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", optional: true, typeAnnotation: TSTypeAnnotation { @@ -124,6 +130,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot index c5fe0cca283..6514d646011 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -25,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -53,6 +58,7 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, typeAnnotation: TSTypeAnnotation { @@ -130,6 +136,7 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] }, }, ], +- declare: false, kind: 'let', range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot index a35ab7d7770..752b2d73dc6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -19,14 +22,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [87, 88], loc: { @@ -62,7 +69,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [93, 94], loc: { @@ -93,7 +102,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [81, 82], loc: { @@ -147,6 +158,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot index 8fcec2c0905..d376aae2939 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -24,14 +27,18 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [87, 88], loc: { @@ -68,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [93, 94], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [81, 82], - loc: { @@ -154,6 +165,7 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST }, }, ], +- declare: false, kind: 'let', range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot index 485bc5c50e6..70a3a44d61a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot @@ -9,24 +9,17 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [80, 85], - loc: { - start: { column: 7, line: 3 }, - end: { column: 12, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSFunctionType { @@ -65,6 +58,18 @@ Program { end: { column: 24, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, range: [80, 97], loc: { @@ -95,6 +100,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot index 98ba2c71171..bf666f461df 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,24 +13,28 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'Array', - - range: [80, 85], - loc: { - start: { column: 7, line: 3 }, - end: { column: 12, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [80, 85], ++ loc: { ++ start: { column: 7, line: 3 }, ++ end: { column: 12, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSFunctionType { @@ -71,7 +75,19 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - end: { column: 24, line: 3 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- range: [80, 85], +- loc: { +- start: { column: 7, line: 3 }, +- end: { column: 12, line: 3 }, +- }, +- }, +- range: [80, 97], loc: { start: { column: 7, line: 3 }, @@ -101,6 +117,7 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot index 59b1a0bf91f..f6aad4b354a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -21,10 +24,13 @@ Program { params: [ ArrayPattern { type: "ArrayPattern", + decorators: [], elements: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [86, 87], loc: { @@ -33,6 +39,7 @@ Program { }, }, ], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot index a786bec4d07..be570c8c543 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-array-destruction AST body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -26,10 +29,13 @@ exports[`AST Fixtures legacy-fixtures types function-with-array-destruction AST + parameters: Array [ ArrayPattern { type: 'ArrayPattern', +- decorators: Array [], elements: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [86, 87], loc: { @@ -38,6 +44,7 @@ exports[`AST Fixtures legacy-fixtures types function-with-array-destruction AST }, }, ], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot index 9483d5e94bc..2b07172adad 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -21,13 +24,17 @@ Program { params: [ ObjectPattern { type: "ObjectPattern", + decorators: [], + optional: false, properties: [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [87, 88], loc: { @@ -37,10 +44,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot index 2f06b281d40..8ffbb928e8a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-object-destruction AST body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -26,13 +29,17 @@ exports[`AST Fixtures legacy-fixtures types function-with-object-destruction AST + parameters: Array [ ObjectPattern { type: 'ObjectPattern', +- decorators: Array [], +- optional: false, properties: Array [ Property { type: 'Property', computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [87, 88], loc: { @@ -42,10 +49,13 @@ exports[`AST Fixtures legacy-fixtures types function-with-object-destruction AST }, kind: 'init', method: false, +- optional: false, shorthand: true, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot index 8d1b9c4abcb..78cfd6f6f5b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -21,7 +24,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [84, 85], loc: { @@ -29,6 +34,8 @@ Program { end: { column: 12, line: 3 }, }, }, + decorators: [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSArrayType { @@ -112,6 +119,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 105], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot index 7a302d9a418..90262f9c0dc 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [84, 85], loc: { @@ -34,6 +39,8 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A end: { column: 12, line: 3 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSArrayType { @@ -118,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [73, 105], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot index 554d54e3428..52d66c25f8d 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -19,7 +22,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -94,6 +99,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot index 6687e26e8c8..f6147ae4510 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-this AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -24,7 +27,9 @@ exports[`AST Fixtures legacy-fixtures types function-with-this AST Alignment - A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -100,6 +105,7 @@ exports[`AST Fixtures legacy-fixtures types function-with-this AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot index be2b938133d..17f5453b312 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -19,7 +22,9 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -47,6 +52,7 @@ Program { }, Identifier { type: "Identifier", + decorators: [], name: "b", optional: true, typeAnnotation: TSTypeAnnotation { @@ -123,6 +129,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot index 41bd32adba5..367d12afbcb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -24,7 +27,9 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -52,6 +57,7 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, typeAnnotation: TSTypeAnnotation { @@ -129,6 +135,7 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` }, }, ], +- declare: false, kind: 'let', range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot index 6a8370b6b8b..e889f7ff8ff 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { parameters: [ Identifier { type: "Identifier", + decorators: [], name: "key", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -52,6 +57,7 @@ Program { }, ], readonly: true, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot index 0500b9d57fb..7bb45645947 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,113 @@ exports[`AST Fixtures legacy-fixtures types index-signature-readonly AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSIndexSignature { + type: 'TSIndexSignature', + parameters: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'key', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [103, 109], + loc: { + start: { column: 17, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [101, 109], + loc: { + start: { column: 15, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [98, 109], + loc: { + start: { column: 12, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], + readonly: true, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [112, 118], + loc: { + start: { column: 26, line: 4 }, + end: { column: 32, line: 4 }, + }, + }, + + range: [110, 118], + loc: { + start: { column: 24, line: 4 }, + end: { column: 32, line: 4 }, + }, + }, + + range: [88, 119], + loc: { + start: { column: 2, line: 4 }, + end: { column: 33, line: 4 }, + }, + }, + ], + + range: [84, 121], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [73, 122], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 123], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot index e7fab0bebdf..1290d0b54eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { parameters: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -51,6 +56,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [88, 100], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot index 5f191002668..bc1599183a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,95 @@ exports[`AST Fixtures legacy-fixtures types index-signature-without-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSIndexSignature { + type: 'TSIndexSignature', + parameters: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [92, 98], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [90, 98], + loc: { + start: { column: 4, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [89, 98], + loc: { + start: { column: 3, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ], +- readonly: false, +- static: false, + + range: [88, 100], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ], + + range: [84, 102], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 104], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot index 48d1e43110b..8f98fb5c807 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { parameters: [ Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -51,6 +56,8 @@ Program { }, }, ], + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot index 4382f42ebd5..39cb215c305 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,113 @@ exports[`AST Fixtures legacy-fixtures types index-signature AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSIndexSignature { + type: 'TSIndexSignature', + parameters: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [92, 98], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [90, 98], + loc: { + start: { column: 4, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [89, 98], + loc: { + start: { column: 3, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ], +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [101, 107], + loc: { + start: { column: 15, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [99, 107], + loc: { + start: { column: 13, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [88, 108], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ], + + range: [84, 110], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 112], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot index 742fbfdcd81..0a9ea38fabe 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSIndexedAccessType { @@ -20,7 +23,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "K", + optional: false, range: [82, 83], loc: { @@ -39,7 +44,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [80, 81], loc: { @@ -84,6 +91,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 85], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot index cebd390f70d..13b1dbd2526 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,115 @@ exports[`AST Fixtures legacy-fixtures types indexed AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSIndexedAccessType { + type: 'TSIndexedAccessType', + indexType: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'K', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + objectType: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 84], + loc: { + start: { column: 7, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [78, 84], + loc: { + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + init: null, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 85], + loc: { + start: { column: 0, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot index 3cdaa13d47c..5ee5b38f53b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "size", + optional: false, range: [97, 101], loc: { @@ -23,7 +25,9 @@ Program { }, }, kind: "get", + optional: false, params: [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -42,6 +46,7 @@ Program { end: { column: 20, line: 4 }, }, }, + static: false, range: [93, 112], loc: { @@ -54,7 +59,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "size", + optional: false, range: [119, 123], loc: { @@ -63,10 +70,13 @@ Program { }, }, kind: "set", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "value", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -122,6 +132,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [115, 158], loc: { @@ -137,9 +149,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "Thing", + optional: false, range: [83, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot index 385e910cd90..c9675620d00 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [97, 101], loc: { @@ -27,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme }, }, kind: 'get', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -48,6 +52,7 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme end: { column: 20, line: 4 }, }, }, +- static: false, range: [93, 112], loc: { @@ -60,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [119, 123], loc: { @@ -69,11 +76,14 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme }, }, kind: 'set', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'value', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -129,6 +139,8 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme }, }, ], +- readonly: false, +- static: false, range: [115, 158], loc: { @@ -144,9 +156,13 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme end: { column: 1, line: 6 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Thing', +- optional: false, range: [83, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot index 8a6935a581d..2b505af45b4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "LinkedList", + optional: false, range: [78, 88], loc: { @@ -23,7 +26,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [94, 95], loc: { @@ -46,7 +51,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "next", + optional: false, range: [100, 104], loc: { @@ -54,28 +61,23 @@ Program { end: { column: 31, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "LinkedList", - - range: [106, 116], - loc: { - start: { column: 33, line: 3 }, - end: { column: 43, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [117, 118], loc: { @@ -98,6 +100,18 @@ Program { end: { column: 46, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "LinkedList", + optional: false, + + range: [106, 116], + loc: { + start: { column: 33, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, range: [106, 119], loc: { @@ -144,7 +158,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [89, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot index 1a756edb61f..21aa48fbc9a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'LinkedList', +- optional: false, range: [78, 88], loc: { @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [94, 95], loc: { @@ -50,7 +55,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'next', +- optional: false, range: [100, 104], loc: { @@ -58,28 +65,34 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS end: { column: 31, line: 3 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'LinkedList', - - range: [106, 116], - loc: { - start: { column: 33, line: 3 }, - end: { column: 43, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'LinkedList', ++ ++ range: [106, 116], ++ loc: { ++ start: { column: 33, line: 3 }, ++ end: { column: 43, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [117, 118], loc: { @@ -100,6 +113,18 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS loc: { start: { column: 43, line: 3 }, end: { column: 46, line: 3 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'LinkedList', +- optional: false, +- +- range: [106, 116], +- loc: { +- start: { column: 33, line: 3 }, +- end: { column: 43, line: 3 }, }, }, @@ -148,7 +173,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [89, 90], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot index c5ac10f6295..60ba2df8e35 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { @@ -68,6 +71,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 83], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot index 3d4e5e78f7e..0c3009c51c5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,95 @@ exports[`AST Fixtures legacy-fixtures types literal-number-negative AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: UnaryExpression { + type: 'UnaryExpression', + argument: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + operator: '-', + prefix: true, + + range: [80, 82], + loc: { + start: { column: 7, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [80, 82], + loc: { + start: { column: 7, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [78, 82], + loc: { + start: { column: 5, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: null, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 84], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot index 6c06c92f57d..04decd13466 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { @@ -57,6 +60,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 82], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot index 8c89c0f442e..aae165b9340 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,84 @@ exports[`AST Fixtures legacy-fixtures types literal-number AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + init: null, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot index 9fb6b4117f7..a5e0b48f53b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { @@ -57,6 +60,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 86], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot index e1c0de62017..81f3f350560 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,84 @@ exports[`AST Fixtures legacy-fixtures types literal-string AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '\\'foo\\'', + value: 'foo', + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [78, 85], + loc: { + start: { column: 5, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [77, 85], + loc: { + start: { column: 4, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + init: null, + + range: [77, 85], + loc: { + start: { column: 4, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot index 646e99d1564..ef00d6dd163 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Test", + optional: false, range: [78, 82], loc: { @@ -44,7 +47,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [117, 118], loc: { @@ -63,7 +68,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [115, 116], loc: { @@ -95,7 +102,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [104, 105], loc: { @@ -120,7 +129,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [93, 94], loc: { @@ -152,7 +163,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot index e18890770ec..368c485e82d 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Test', +- optional: false, range: [78, 82], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'P', +- optional: false, range: [117, 118], loc: { @@ -67,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [115, 116], loc: { @@ -99,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [104, 105], loc: { @@ -124,7 +133,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [93, 94], - loc: { @@ -157,7 +168,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot index a6cf5a6a9ce..5e7781c3ef6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -43,7 +46,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [95, 96], loc: { @@ -89,6 +94,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot index 624a79fb35d..5a1e7b20c51 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -47,8 +50,11 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', -- +- optional: false, ++ name: 'P', + - range: [95, 96], - loc: { - start: { column: 22, line: 3 }, @@ -56,8 +62,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment - }, - }, - out: false, -+ name: 'P', - +- range: [95, 106], loc: { start: { column: 22, line: 3 }, @@ -94,6 +99,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment }, }, ], +- declare: false, kind: 'let', range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot index 0bdfb991d52..fcdef4d6c30 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -43,7 +46,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [95, 96], loc: { @@ -89,6 +94,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot index e6d132ed161..6beae172122 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -47,8 +50,11 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', -- +- optional: false, ++ name: 'P', + - range: [95, 96], - loc: { - start: { column: 22, line: 3 }, @@ -56,8 +62,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - - }, - }, - out: false, -+ name: 'P', - +- range: [95, 106], loc: { start: { column: 22, line: 3 }, @@ -94,6 +99,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot index 8c1a4635b40..f70b1ed6956 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -43,7 +46,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [94, 95], loc: { @@ -89,6 +94,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot index cd82008e2c3..8c8500647fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -47,8 +50,11 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', -- +- optional: false, ++ name: 'P', + - range: [94, 95], - loc: { - start: { column: 21, line: 3 }, @@ -56,8 +62,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST - }, - }, - out: false, -+ name: 'P', - +- range: [94, 105], loc: { start: { column: 21, line: 3 }, @@ -94,6 +99,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST }, }, ], +- declare: false, kind: 'let', range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot index fe12ec4ef04..d57cfcd0f42 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -32,7 +35,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [85, 86], loc: { @@ -78,6 +83,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot index 11ad724238e..5af936438b5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -36,8 +39,11 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', -- +- optional: false, ++ name: 'P', + - range: [85, 86], - loc: { - start: { column: 12, line: 3 }, @@ -45,8 +51,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST - }, - }, - out: false, -+ name: 'P', - +- range: [85, 96], loc: { start: { column: 12, line: 3 }, @@ -83,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST }, }, ], +- declare: false, kind: 'let', range: [73, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot index 7c422caf01e..82119bfda8e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -41,7 +44,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "P", + optional: false, range: [85, 86], loc: { @@ -87,6 +92,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot index 75db4f14353..2fcdfabe098 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -45,8 +48,11 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', -- +- optional: false, ++ name: 'P', + - range: [85, 86], - loc: { - start: { column: 12, line: 3 }, @@ -54,8 +60,7 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` - }, - }, - out: false, -+ name: 'P', - +- range: [85, 96], loc: { start: { column: 12, line: 3 }, @@ -92,6 +97,7 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` }, }, ], +- declare: false, kind: 'let', range: [73, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot index 9b1b1ae826c..dbc54945f81 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot index 87b23389093..80ae05900af 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [78, 81], loc: { @@ -179,17 +182,7 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] + types: Array [ + TSNullKeyword { + type: 'TSNullKeyword', - -- range: [139, 143], -- loc: { -- start: { column: 23, line: 5 }, -- end: { column: 27, line: 5 }, -- }, -- }, -- TSArrayType { -- type: 'TSArrayType', -- elementType: TSBooleanKeyword { -- type: 'TSBooleanKeyword', ++ + range: [139, 143], + loc: { + start: { column: 23, line: 5 }, @@ -201,17 +194,27 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] + elementType: TSBooleanKeyword { + type: 'TSBooleanKeyword', -- range: [146, 153], -- loc: { -- start: { column: 30, line: 5 }, -- end: { column: 37, line: 5 }, +- range: [139, 143], +- loc: { +- start: { column: 23, line: 5 }, +- end: { column: 27, line: 5 }, +- }, +- }, +- TSArrayType { +- type: 'TSArrayType', +- elementType: TSBooleanKeyword { +- type: 'TSBooleanKeyword', + range: [146, 153], + loc: { + start: { column: 30, line: 5 }, + end: { column: 37, line: 5 }, + }, + }, -+ + +- range: [146, 153], +- loc: { +- start: { column: 30, line: 5 }, +- end: { column: 37, line: 5 }, + range: [146, 155], + loc: { + start: { column: 30, line: 5 }, @@ -241,54 +244,54 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] + end: { column: 40, line: 5 }, + }, }, -+ ], -+ -+ range: [126, 156], -+ loc: { -+ start: { column: 10, line: 5 }, -+ end: { column: 40, line: 5 }, - }, +- }, - ], -+ }, -+ ], ++ ], - range: [126, 156], - loc: { - start: { column: 10, line: 5 }, - end: { column: 40, line: 5 }, -- }, ++ range: [126, 156], ++ loc: { ++ start: { column: 10, line: 5 }, ++ end: { column: 40, line: 5 }, ++ }, + }, ++ ], ++ + range: [121, 157], + loc: { + start: { column: 5, line: 5 }, + end: { column: 41, line: 5 }, }, - ], -- ++ }, ++ TSTypeLiteral { ++ type: 'TSTypeLiteral', ++ members: Array [], + - range: [121, 157], - loc: { - start: { column: 5, line: 5 }, - end: { column: 41, line: 5 }, ++ range: [160, 162], ++ loc: { ++ start: { column: 44, line: 5 }, ++ end: { column: 46, line: 5 }, ++ }, }, - }, - TSTypeLiteral { - type: 'TSTypeLiteral', - members: Array [], -+ TSTypeLiteral { -+ type: 'TSTypeLiteral', -+ members: Array [], ++ ], - range: [160, 162], - loc: { - start: { column: 44, line: 5 }, - end: { column: 46, line: 5 }, -+ range: [160, 162], -+ loc: { -+ start: { column: 44, line: 5 }, -+ end: { column: 46, line: 5 }, -+ }, - }, -+ ], -+ +- }, + range: [121, 162], + loc: { + start: { column: 5, line: 5 }, diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot index 7c92699d391..0b336f277a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Thing", + optional: false, range: [78, 83], loc: { @@ -24,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "size", + optional: false, range: [94, 98], loc: { @@ -33,7 +38,9 @@ Program { }, }, kind: "get", + optional: false, params: [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -52,6 +59,7 @@ Program { end: { column: 20, line: 4 }, }, }, + static: false, range: [90, 109], loc: { @@ -64,7 +72,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "size", + optional: false, range: [116, 120], loc: { @@ -73,10 +83,13 @@ Program { }, }, kind: "set", + optional: false, params: [ Identifier { type: "Identifier", + decorators: [], name: "value", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -132,6 +145,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [112, 155], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot index d1b1d336bcf..f2c26b3d6fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Thing', +- optional: false, range: [78, 83], loc: { @@ -28,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [94, 98], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A }, }, kind: 'get', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -58,6 +65,7 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A end: { column: 20, line: 4 }, }, }, +- static: false, range: [90, 109], loc: { @@ -70,7 +78,9 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [116, 120], loc: { @@ -79,11 +89,14 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A }, }, kind: 'set', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'value', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -139,6 +152,8 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A }, }, ], +- readonly: false, +- static: false, range: [112, 155], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot index c30d5480c1f..02cc273d157 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Mapper", + optional: false, range: [78, 84], loc: { @@ -21,14 +24,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [104, 105], loc: { @@ -64,7 +71,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [110, 111], loc: { @@ -102,7 +111,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [88, 89], loc: { @@ -124,7 +135,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot index d5831586688..3e272fa01fb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Mapper', +- optional: false, range: [78, 84], loc: { @@ -26,14 +29,18 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [104, 105], loc: { @@ -70,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [110, 111], loc: { @@ -108,7 +117,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [88, 89], - loc: { @@ -131,7 +142,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [95, 96], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot index 1b19115ffe8..989cdb4163c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Processor", + optional: false, range: [78, 87], loc: { @@ -21,14 +24,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [104, 105], loc: { @@ -64,7 +71,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [110, 111], loc: { @@ -102,7 +111,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot index 5b560fa04c4..022afd59b60 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Processor', +- optional: false, range: [78, 87], loc: { @@ -26,14 +29,18 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [104, 105], loc: { @@ -70,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [110, 111], loc: { @@ -108,7 +117,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [95, 96], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot index faca7d2d1f9..3289fff4fc2 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Consumer", + optional: false, range: [78, 86], loc: { @@ -21,14 +24,18 @@ Program { params: [ Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [99, 100], loc: { @@ -92,7 +99,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [90, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot index 1c8d89c3680..6d432fe68d9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in AST Alignment - body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Consumer', +- optional: false, range: [78, 86], loc: { @@ -26,14 +29,18 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in AST Alignment - + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [99, 100], loc: { @@ -98,7 +105,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in AST Alignment - in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [90, 91], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot index b815cfcfa19..2b88be0b988 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Provider", + optional: false, range: [78, 86], loc: { @@ -25,7 +28,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [102, 103], loc: { @@ -63,7 +68,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [91, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot index 9afebcfe430..55cf4924e65 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-out AST Alignment body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Provider', +- optional: false, range: [78, 86], loc: { @@ -31,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-out AST Alignment type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [102, 103], loc: { @@ -69,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-out AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [91, 92], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot index 5729d78a6fb..a5c59c38fe1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot index 2a275a36440..85783e1a93c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,70 @@ exports[`AST Fixtures legacy-fixtures types parenthesized-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [84, 99], + loc: { + start: { column: 11, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot index 5012a3b27dc..19b7f5d47af 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot @@ -9,39 +9,22 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [80, 85], - loc: { - start: { column: 7, line: 3 }, - end: { column: 12, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [86, 91], - loc: { - start: { column: 13, line: 3 }, - end: { column: 18, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSNumberKeyword { @@ -61,6 +44,18 @@ Program { end: { column: 26, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [86, 91], + loc: { + start: { column: 13, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, range: [86, 99], loc: { @@ -76,6 +71,18 @@ Program { end: { column: 27, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, range: [80, 100], loc: { @@ -106,6 +113,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 101], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot index 7a6abfb9236..1d1e3d2d477 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,159 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [80, 85], ++ loc: { ++ start: { column: 7, line: 3 }, ++ end: { column: 12, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [86, 91], ++ loc: { ++ start: { column: 13, line: 3 }, ++ end: { column: 18, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + ], + + range: [91, 99], + loc: { + start: { column: 18, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- +- range: [86, 91], +- loc: { +- start: { column: 13, line: 3 }, +- end: { column: 18, line: 3 }, +- }, +- }, + + range: [86, 99], + loc: { + start: { column: 13, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [85, 100], + loc: { + start: { column: 12, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, +- +- range: [80, 85], +- loc: { +- start: { column: 7, line: 3 }, +- end: { column: 12, line: 3 }, +- }, +- }, + + range: [80, 100], + loc: { + start: { column: 7, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [78, 100], + loc: { + start: { column: 5, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [77, 100], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + init: null, + + range: [77, 100], + loc: { + start: { column: 4, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot index 50b96bafcce..21655befda9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot @@ -9,24 +9,17 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Array", - - range: [80, 85], - loc: { - start: { column: 7, line: 3 }, - end: { column: 12, line: 3 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSNumberKeyword { @@ -46,6 +39,18 @@ Program { end: { column: 20, line: 3 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Array", + optional: false, + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, range: [80, 93], loc: { @@ -76,6 +81,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot index 5653a047406..ef82ec276a6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,116 @@ exports[`AST Fixtures legacy-fixtures types reference-generic AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'Array', ++ ++ range: [80, 85], ++ loc: { ++ start: { column: 7, line: 3 }, ++ end: { column: 12, line: 3 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [86, 92], + loc: { + start: { column: 13, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Array', +- optional: false, + +- range: [80, 85], +- loc: { +- start: { column: 7, line: 3 }, +- end: { column: 12, line: 3 }, +- }, +- }, +- + range: [80, 93], + loc: { + start: { column: 7, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [78, 93], + loc: { + start: { column: 5, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + init: null, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot index c3beb71c60b..8805dcedca1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot @@ -9,16 +9,21 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [80, 81], loc: { @@ -56,6 +61,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 82], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot index c396b9e2ddb..2d73832918f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,85 @@ exports[`AST Fixtures legacy-fixtures types reference AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + init: null, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot index e489dedcf78..9942b2c7959 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot index e85a5a9b7bf..b07fdd831c6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,76 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-1 AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: TemplateLiteral { + type: 'TemplateLiteral', + expressions: Array [], + quasis: Array [ + TemplateElement { + type: 'TemplateElement', + tail: true, + value: Object { + 'cooked': 'foo', + 'raw': 'foo', + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot index 4ac13fbd2c3..b0f8d40f163 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot index f15ba271fc3..404715ae22a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [78, 79], loc: { @@ -30,18 +33,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen - 'cooked': 'foo', - 'raw': 'foo', - }, -+ typeAnnotation: TSLiteralType { -+ type: 'TSLiteralType', -+ literal: TemplateLiteral { -+ type: 'TemplateLiteral', -+ expressions: Array [ -+ TSLiteralType { -+ type: 'TSLiteralType', -+ literal: Literal { -+ type: 'Literal', -+ raw: '\\'bar\\'', -+ value: 'bar', - +- - range: [82, 88], - loc: { - start: { column: 9, line: 3 }, @@ -55,12 +47,17 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen - 'cooked': '', - 'raw': '', - }, -+ range: [88, 93], -+ loc: { -+ start: { column: 15, line: 3 }, -+ end: { column: 20, line: 3 }, -+ }, -+ }, ++ typeAnnotation: TSLiteralType { ++ type: 'TSLiteralType', ++ literal: TemplateLiteral { ++ type: 'TemplateLiteral', ++ expressions: Array [ ++ TSLiteralType { ++ type: 'TSLiteralType', ++ literal: Literal { ++ type: 'Literal', ++ raw: '\\'bar\\'', ++ value: 'bar', - range: [93, 95], - loc: { @@ -76,7 +73,13 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen - type: 'Literal', - raw: '\\'bar\\'', - value: 'bar', -- ++ range: [88, 93], ++ loc: { ++ start: { column: 15, line: 3 }, ++ end: { column: 20, line: 3 }, ++ }, ++ }, + range: [88, 93], loc: { start: { column: 15, line: 3 }, @@ -102,7 +105,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen + start: { column: 9, line: 3 }, + end: { column: 15, line: 3 }, + }, -+ }, + }, + TemplateElement { + type: 'TemplateElement', + tail: true, @@ -116,7 +119,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen + start: { column: 20, line: 3 }, + end: { column: 22, line: 3 }, + }, - }, ++ }, + ], + + range: [82, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot index 30a5603b2a0..fbf01b73f26 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Color", + optional: false, range: [78, 83], loc: { @@ -76,9 +79,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Quantity", + optional: false, range: [107, 115], loc: { @@ -146,9 +152,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "SeussFish", + optional: false, range: [138, 147], loc: { @@ -196,7 +205,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Quantity", + optional: false, range: [153, 161], loc: { @@ -215,7 +226,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "Color", + optional: false, range: [164, 169], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot index 570ef602314..44cf2dd8755 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Color', +- optional: false, range: [78, 83], loc: { @@ -80,9 +83,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Quantity', +- optional: false, range: [107, 115], loc: { @@ -150,9 +156,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SeussFish', +- optional: false, range: [138, 147], loc: { @@ -170,6 +179,20 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen - 'cooked': '', - 'raw': '', - }, +- +- range: [150, 153], +- loc: { +- start: { column: 17, line: 5 }, +- end: { column: 20, line: 5 }, +- }, +- }, +- TemplateElement { +- type: 'TemplateElement', +- tail: true, +- value: Object { +- 'cooked': ' fish', +- 'raw': ' fish', +- }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: TemplateLiteral { @@ -184,20 +207,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen + type: 'Identifier', + name: 'Quantity', -- range: [150, 153], -- loc: { -- start: { column: 17, line: 5 }, -- end: { column: 20, line: 5 }, -- }, -- }, -- TemplateElement { -- type: 'TemplateElement', -- tail: true, -- value: Object { -- 'cooked': ' fish', -- 'raw': ' fish', -- }, -- - range: [169, 176], - loc: { - start: { column: 36, line: 5 }, @@ -213,7 +222,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Quantity', +- optional: false, + range: [153, 161], + loc: { + start: { column: 20, line: 5 }, @@ -243,7 +254,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Color', +- optional: false, + range: [164, 169], + loc: { + start: { column: 31, line: 5 }, diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot index 36213a03e94..08cdee8255c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "EnthusiasticGreeting", + optional: false, range: [78, 98], loc: { @@ -93,24 +96,16 @@ Program { types: [ TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Uppercase", - - range: [124, 133], - loc: { - start: { column: 5, line: 4 }, - end: { column: 14, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [134, 135], loc: { @@ -133,6 +128,18 @@ Program { end: { column: 17, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Uppercase", + optional: false, + + range: [124, 133], + loc: { + start: { column: 5, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, range: [124, 136], loc: { @@ -142,24 +149,16 @@ Program { }, TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Lowercase", - - range: [142, 151], - loc: { - start: { column: 23, line: 4 }, - end: { column: 32, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [152, 153], loc: { @@ -182,6 +181,18 @@ Program { end: { column: 35, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Lowercase", + optional: false, + + range: [142, 151], + loc: { + start: { column: 23, line: 4 }, + end: { column: 32, line: 4 }, + }, + }, range: [142, 154], loc: { @@ -191,24 +202,16 @@ Program { }, TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Capitalize", - - range: [160, 170], - loc: { - start: { column: 41, line: 4 }, - end: { column: 51, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [171, 172], loc: { @@ -231,6 +234,18 @@ Program { end: { column: 54, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Capitalize", + optional: false, + + range: [160, 170], + loc: { + start: { column: 41, line: 4 }, + end: { column: 51, line: 4 }, + }, + }, range: [160, 173], loc: { @@ -240,24 +255,16 @@ Program { }, TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "Uncapitalize", - - range: [179, 191], - loc: { - start: { column: 60, line: 4 }, - end: { column: 72, line: 4 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [192, 193], loc: { @@ -280,6 +287,18 @@ Program { end: { column: 75, line: 4 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "Uncapitalize", + optional: false, + + range: [179, 191], + loc: { + start: { column: 60, line: 4 }, + end: { column: 72, line: 4 }, + }, + }, range: [179, 194], loc: { @@ -313,7 +332,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [99, 100], loc: { @@ -346,9 +367,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "HELLO", + optional: false, range: [203, 208], loc: { @@ -358,17 +382,7 @@ Program { }, typeAnnotation: TSTypeReference { type: "TSTypeReference", - typeName: Identifier { - type: "Identifier", - name: "EnthusiasticGreeting", - - range: [211, 231], - loc: { - start: { column: 13, line: 5 }, - end: { column: 33, line: 5 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSLiteralType { @@ -399,6 +413,18 @@ Program { end: { column: 42, line: 5 }, }, }, + typeName: Identifier { + type: "Identifier", + decorators: [], + name: "EnthusiasticGreeting", + optional: false, + + range: [211, 231], + loc: { + start: { column: 13, line: 5 }, + end: { column: 33, line: 5 }, + }, + }, range: [211, 240], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot index a1f3c64cd6b..1b076038097 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'EnthusiasticGreeting', +- optional: false, range: [78, 98], loc: { @@ -121,24 +124,16 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - types: Array [ - TSTypeReference { - type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'Uppercase', -- -- range: [124, 133], -- loc: { -- start: { column: 5, line: 4 }, -- end: { column: 14, line: 4 }, -- }, -- }, -- typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ - TSTypeReference { - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, + range: [134, 135], + loc: { + start: { column: 15, line: 4 }, @@ -175,28 +170,21 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen end: { column: 17, line: 4 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Uppercase', +- optional: false, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Lowercase', -- range: [124, 136], -- loc: { -- start: { column: 5, line: 4 }, -- end: { column: 17, line: 4 }, -- }, -- }, -- TSTypeReference { -- type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'Lowercase', -- -- range: [142, 151], +- range: [124, 133], - loc: { -- start: { column: 23, line: 4 }, -- end: { column: 32, line: 4 }, +- start: { column: 5, line: 4 }, +- end: { column: 14, line: 4 }, + range: [142, 151], + loc: { + start: { column: 23, line: 4 }, @@ -204,14 +192,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + }, }, - }, -- typeParameters: TSTypeParameterInstantiation { -- type: 'TSTypeParameterInstantiation', -- params: Array [ -- TSTypeReference { -- type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'T', + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ @@ -220,7 +200,25 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + typeName: Identifier { + type: 'Identifier', + name: 'T', -+ + +- range: [124, 136], +- loc: { +- start: { column: 5, line: 4 }, +- end: { column: 17, line: 4 }, +- }, +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'T', +- optional: false, + range: [152, 153], + loc: { + start: { column: 33, line: 4 }, @@ -256,29 +254,22 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + start: { column: 23, line: 4 }, end: { column: 35, line: 4 }, }, -- }, -- -- range: [142, 154], -- loc: { -- start: { column: 23, line: 4 }, -- end: { column: 35, line: 4 }, }, -- }, -- TSTypeReference { -- type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', -- name: 'Capitalize', +- decorators: Array [], +- name: 'Lowercase', +- optional: false, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Capitalize', -- range: [160, 170], +- range: [142, 151], - loc: { -- start: { column: 41, line: 4 }, -- end: { column: 51, line: 4 }, +- start: { column: 23, line: 4 }, +- end: { column: 32, line: 4 }, + range: [160, 170], + loc: { + start: { column: 41, line: 4 }, @@ -286,14 +277,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + }, }, - }, -- typeParameters: TSTypeParameterInstantiation { -- type: 'TSTypeParameterInstantiation', -- params: Array [ -- TSTypeReference { -- type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'T', + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ @@ -303,13 +286,31 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + type: 'Identifier', + name: 'T', +- range: [142, 154], +- loc: { +- start: { column: 23, line: 4 }, +- end: { column: 35, line: 4 }, +- }, +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'T', +- optional: false, + range: [171, 172], + loc: { + start: { column: 52, line: 4 }, + end: { column: 53, line: 4 }, + }, + }, -+ + range: [171, 172], loc: { start: { column: 52, line: 4 }, @@ -338,29 +339,22 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + start: { column: 41, line: 4 }, end: { column: 54, line: 4 }, }, -- }, -- -- range: [160, 173], -- loc: { -- start: { column: 41, line: 4 }, -- end: { column: 54, line: 4 }, }, -- }, -- TSTypeReference { -- type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', -- name: 'Uncapitalize', +- decorators: Array [], +- name: 'Capitalize', +- optional: false, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Uncapitalize', -- range: [179, 191], +- range: [160, 170], - loc: { -- start: { column: 60, line: 4 }, -- end: { column: 72, line: 4 }, +- start: { column: 41, line: 4 }, +- end: { column: 51, line: 4 }, + range: [179, 191], + loc: { + start: { column: 60, line: 4 }, @@ -368,14 +362,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + }, }, - }, -- typeParameters: TSTypeParameterInstantiation { -- type: 'TSTypeParameterInstantiation', -- params: Array [ -- TSTypeReference { -- type: 'TSTypeReference', -- typeName: Identifier { -- type: 'Identifier', -- name: 'T', + typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ @@ -384,7 +370,25 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + typeName: Identifier { + type: 'Identifier', + name: 'T', -+ + +- range: [160, 173], +- loc: { +- start: { column: 41, line: 4 }, +- end: { column: 54, line: 4 }, +- }, +- }, +- TSTypeReference { +- type: 'TSTypeReference', +- typeArguments: TSTypeParameterInstantiation { +- type: 'TSTypeParameterInstantiation', +- params: Array [ +- TSTypeReference { +- type: 'TSTypeReference', +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'T', +- optional: false, + range: [192, 193], + loc: { + start: { column: 73, line: 4 }, @@ -421,6 +425,11 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen end: { column: 75, line: 4 }, }, }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'Uncapitalize', +- optional: false, + ], + quasis: Array [ + TemplateElement { @@ -430,11 +439,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': '', + 'raw': '', + }, - -- range: [179, 194], -- loc: { -- start: { column: 60, line: 4 }, -- end: { column: 75, line: 4 }, ++ + range: [121, 124], + loc: { + start: { column: 2, line: 4 }, @@ -448,13 +453,16 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': ' - ', + 'raw': ' - ', + }, -+ + +- range: [179, 191], + range: [136, 142], -+ loc: { + loc: { +- start: { column: 60, line: 4 }, +- end: { column: 72, line: 4 }, + start: { column: 17, line: 4 }, + end: { column: 23, line: 4 }, -+ }, -+ }, + }, + }, + TemplateElement { + type: 'TemplateElement', + tail: false, @@ -462,7 +470,11 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + 'cooked': ' - ', + 'raw': ' - ', + }, -+ + +- range: [179, 194], +- loc: { +- start: { column: 60, line: 4 }, +- end: { column: 75, line: 4 }, + range: [154, 160], + loc: { + start: { column: 35, line: 4 }, @@ -531,7 +543,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [99, 100], - loc: { @@ -565,9 +579,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'HELLO', +- optional: false, range: [203, 208], loc: { @@ -577,17 +594,18 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen }, typeAnnotation: TSTypeReference { type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', - name: 'EnthusiasticGreeting', - - range: [211, 231], - loc: { - start: { column: 13, line: 5 }, - end: { column: 33, line: 5 }, - }, - }, - typeParameters: TSTypeParameterInstantiation { +- typeArguments: TSTypeParameterInstantiation { ++ typeName: Identifier { ++ type: 'Identifier', ++ name: 'EnthusiasticGreeting', ++ ++ range: [211, 231], ++ loc: { ++ start: { column: 13, line: 5 }, ++ end: { column: 33, line: 5 }, ++ }, ++ }, ++ typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ TSLiteralType { @@ -616,6 +634,18 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen loc: { start: { column: 33, line: 5 }, end: { column: 42, line: 5 }, +- }, +- }, +- typeName: Identifier { +- type: 'Identifier', +- decorators: Array [], +- name: 'EnthusiasticGreeting', +- optional: false, +- +- range: [211, 231], +- loc: { +- start: { column: 13, line: 5 }, +- end: { column: 33, line: 5 }, }, }, diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot index 352030ef386..822ae4ea336 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ @@ -14,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: [], + definite: false, key: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [92, 93], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 10, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,9 +63,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method", + optional: false, range: [113, 119], loc: { @@ -67,6 +77,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -92,7 +103,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [158, 159], loc: { @@ -122,13 +135,16 @@ Program { end: { column: 3, line: 8 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSThisType { @@ -191,9 +207,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method2", + optional: false, range: [175, 182], loc: { @@ -202,6 +221,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -227,7 +247,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [216, 217], loc: { @@ -257,20 +279,25 @@ Program { end: { column: 3, line: 12 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [189, 190], loc: { @@ -336,9 +363,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method3", + optional: false, range: [233, 240], loc: { @@ -347,6 +377,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -360,9 +391,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [271, 273], loc: { @@ -388,7 +422,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [287, 288], loc: { @@ -422,6 +458,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [267, 289], @@ -437,7 +474,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [301, 303], loc: { @@ -468,13 +507,16 @@ Program { end: { column: 3, line: 17 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSThisType { @@ -537,9 +579,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method4", + optional: false, range: [321, 328], loc: { @@ -548,6 +593,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -561,9 +607,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [356, 358], loc: { @@ -589,7 +638,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [372, 373], loc: { @@ -623,6 +674,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [352, 374], @@ -638,7 +690,9 @@ Program { arguments: [], callee: Identifier { type: "Identifier", + decorators: [], name: "fn", + optional: false, range: [386, 388], loc: { @@ -669,20 +723,25 @@ Program { end: { column: 3, line: 22 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [335, 336], loc: { @@ -747,9 +806,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "staticMethod", + optional: false, range: [406, 418], loc: { @@ -758,6 +820,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -783,7 +846,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [454, 455], loc: { @@ -813,20 +878,25 @@ Program { end: { column: 3, line: 26 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [425, 426], loc: { @@ -891,9 +961,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "typeof", + optional: false, range: [471, 477], loc: { @@ -902,6 +975,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -947,20 +1021,25 @@ Program { end: { column: 3, line: 30 }, }, }, + declare: false, expression: false, generator: false, id: null, params: [ Identifier { type: "Identifier", + decorators: [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [484, 485], loc: { @@ -1030,9 +1109,13 @@ Program { end: { column: 1, line: 31 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [79, 80], loc: { @@ -1040,6 +1123,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 524], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot index 11f2406bcb5..9e0dd132e21 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [92, 93], loc: { @@ -28,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 10, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -60,9 +67,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [113, 119], loc: { @@ -71,6 +81,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -96,7 +107,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [158, 159], loc: { @@ -126,13 +139,16 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 8 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSThisType { @@ -195,9 +211,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method2', +- optional: false, range: [175, 182], loc: { @@ -206,6 +225,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -231,7 +251,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [216, 217], loc: { @@ -261,20 +283,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 12 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [189, 190], loc: { @@ -340,9 +367,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method3', +- optional: false, range: [233, 240], loc: { @@ -351,6 +381,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -364,9 +395,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [271, 273], loc: { @@ -392,7 +426,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [287, 288], loc: { @@ -426,6 +462,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, ], +- declare: false, kind: 'var', range: [267, 289], @@ -441,7 +478,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [301, 303], loc: { @@ -472,13 +511,16 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 17 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSThisType { @@ -541,9 +583,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method4', +- optional: false, range: [321, 328], loc: { @@ -552,6 +597,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -565,9 +611,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [356, 358], loc: { @@ -593,7 +642,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [372, 373], loc: { @@ -627,6 +678,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, ], +- declare: false, kind: 'var', range: [352, 374], @@ -642,7 +694,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [386, 388], loc: { @@ -673,20 +727,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 22 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [335, 336], loc: { @@ -751,9 +810,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'staticMethod', +- optional: false, range: [406, 418], loc: { @@ -762,6 +824,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -787,7 +850,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [454, 455], loc: { @@ -817,20 +882,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 26 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [425, 426], loc: { @@ -895,9 +965,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'typeof', +- optional: false, range: [471, 477], loc: { @@ -906,6 +979,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -951,20 +1025,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 30 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [484, 485], loc: { @@ -1034,9 +1113,13 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 1, line: 31 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -1044,6 +1127,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 524], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot index c87626f17e1..cd31f761574 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "clone", + optional: false, range: [91, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -57,6 +62,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -101,9 +107,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "Message", + optional: false, range: [79, 86], loc: { @@ -111,6 +121,7 @@ Program { end: { column: 13, line: 3 }, }, }, + implements: [], superClass: null, range: [73, 129], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot index f4e9993acae..2f079c26764 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'clone', +- optional: false, range: [91, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -61,6 +66,7 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -105,9 +111,13 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Message', +- optional: false, range: [79, 86], loc: { @@ -115,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = end: { column: 13, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 129], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot index 239f33768f0..f2472dfa34b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -47,6 +50,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 83], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot index f467aab6aae..93ce1725a9e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,74 @@ exports[`AST Fixtures legacy-fixtures types tuple-empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [], + + range: [80, 82], + loc: { + start: { column: 7, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [78, 82], + loc: { + start: { column: 5, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: null, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 84], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot index 99d8dc3bbeb..707abc21ee7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -30,7 +33,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [81, 82], loc: { @@ -59,7 +64,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [92, 93], loc: { @@ -108,7 +115,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [104, 105], loc: { @@ -155,6 +164,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot index 487dca4144b..cf045fd04e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,188 @@ exports[`AST Fixtures legacy-fixtures types tuple-named-optional AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + optional: false, + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [92, 93], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + optional: true, + + range: [92, 102], + loc: { + start: { column: 19, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [117, 123], + loc: { + start: { column: 44, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + ], + + range: [108, 123], + loc: { + start: { column: 35, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [104, 105], + loc: { + start: { column: 31, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + optional: true, + + range: [104, 123], + loc: { + start: { column: 31, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + ], + + range: [80, 124], + loc: { + start: { column: 7, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + + range: [78, 124], + loc: { + start: { column: 5, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + + range: [77, 124], + loc: { + start: { column: 4, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + init: null, + + range: [77, 124], + loc: { + start: { column: 4, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 125], + loc: { + start: { column: 0, line: 3 }, + end: { column: 52, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 126], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot index 45c75cbc463..b59584ba377 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -30,7 +33,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [81, 82], loc: { @@ -70,7 +75,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [95, 96], loc: { @@ -124,6 +131,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot index 4355a551b82..c7398b84a5b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,155 @@ exports[`AST Fixtures legacy-fixtures types tuple-named-rest AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + optional: false, + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSRestType { + type: 'TSRestType', + typeAnnotation: TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSArrayType { + type: 'TSArrayType', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [98, 104], + loc: { + start: { column: 25, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [98, 106], + loc: { + start: { column: 25, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + optional: false, + + range: [95, 106], + loc: { + start: { column: 22, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [92, 106], + loc: { + start: { column: 19, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + ], + + range: [80, 107], + loc: { + start: { column: 7, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [78, 107], + loc: { + start: { column: 5, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [77, 107], + loc: { + start: { column: 4, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + init: null, + + range: [77, 107], + loc: { + start: { column: 4, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot index 64bc8b2e2f6..a734af5b7e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { @@ -32,7 +35,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [85, 86], loc: { @@ -61,7 +66,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [96, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot index 8767560841d..44ce3bf0db0 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,114 @@ exports[`AST Fixtures legacy-fixtures types tuple-named-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [88, 94], + loc: { + start: { column: 15, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + optional: false, + + range: [85, 94], + loc: { + start: { column: 12, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [100, 106], + loc: { + start: { column: 27, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [96, 97], + loc: { + start: { column: 23, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + optional: true, + + range: [96, 106], + loc: { + start: { column: 23, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + ], + + range: [84, 107], + loc: { + start: { column: 11, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot index 7dea97ebde4..a1e56710e95 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -30,7 +33,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [81, 82], loc: { @@ -59,7 +64,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [92, 93], loc: { @@ -88,7 +95,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [103, 104], loc: { @@ -135,6 +144,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 114], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot index 99fb9783e7c..46056560b92 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,168 @@ exports[`AST Fixtures legacy-fixtures types tuple-named AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + optional: false, + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [92, 93], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + optional: false, + + range: [92, 101], + loc: { + start: { column: 19, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [106, 112], + loc: { + start: { column: 33, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [103, 104], + loc: { + start: { column: 30, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + optional: false, + + range: [103, 112], + loc: { + start: { column: 30, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + ], + + range: [80, 113], + loc: { + start: { column: 7, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [78, 113], + loc: { + start: { column: 5, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [77, 113], + loc: { + start: { column: 4, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + init: null, + + range: [77, 113], + loc: { + start: { column: 4, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 114], + loc: { + start: { column: 0, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 115], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot index 73cfc3cad6b..085e71318cc 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -113,6 +116,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot index 92d042d52fb..c18e7df81ac 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types tuple-optional AST Alignment - AST 1 declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTupleType { @@ -146,6 +149,7 @@ exports[`AST Fixtures legacy-fixtures types tuple-optional AST Alignment - AST 1 }, }, ], +- declare: false, kind: 'let', range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot index 4661a8567f5..5ae74be0a29 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -84,6 +87,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 102], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot index f5b3150c2e7..39b744ef4e5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,111 @@ exports[`AST Fixtures legacy-fixtures types tuple-rest AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [81, 87], + loc: { + start: { column: 8, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + TSRestType { + type: 'TSRestType', + typeAnnotation: TSArrayType { + type: 'TSArrayType', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [92, 100], + loc: { + start: { column: 19, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [89, 100], + loc: { + start: { column: 16, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [80, 101], + loc: { + start: { column: 7, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [78, 101], + loc: { + start: { column: 5, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [77, 101], + loc: { + start: { column: 4, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + init: null, + + range: [77, 101], + loc: { + start: { column: 4, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot index ee875d4f166..72e55c01a01 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot index 861edac4e34..c6091651029 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures legacy-fixtures types tuple-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [85, 91], + loc: { + start: { column: 12, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + TSOptionalType { + type: 'TSOptionalType', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [93, 100], + loc: { + start: { column: 20, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [84, 101], + loc: { + start: { column: 11, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot index 41466b9f8f2..a5ac7394e1d 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -75,6 +78,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 105], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot index 9daf8bf8637..17d1d9f4695 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,102 @@ exports[`AST Fixtures legacy-fixtures types tuple AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [81, 87], + loc: { + start: { column: 8, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [89, 95], + loc: { + start: { column: 16, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [97, 103], + loc: { + start: { column: 24, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + ], + + range: [80, 104], + loc: { + start: { column: 7, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [78, 104], + loc: { + start: { column: 5, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [77, 104], + loc: { + start: { column: 4, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + init: null, + + range: [77, 104], + loc: { + start: { column: 4, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 105], + loc: { + start: { column: 0, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 106], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot index 2b64d5846c8..af94ebe300b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "obj", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeLiteral { @@ -22,7 +25,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, range: [84, 85], loc: { @@ -30,6 +35,9 @@ Program { end: { column: 12, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -86,6 +94,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 96], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot index f7e7f886601..66cd9e9abe8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,118 @@ exports[`AST Fixtures legacy-fixtures types type-literal AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'obj', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [84, 85], + loc: { + start: { column: 11, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [87, 93], + loc: { + start: { column: 14, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [84, 93], + loc: { + start: { column: 11, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [80, 95], + loc: { + start: { column: 7, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [77, 95], + loc: { + start: { column: 4, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + init: null, + + range: [77, 95], + loc: { + start: { column: 4, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 96], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot index 29698cef44e..150915876a7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { @@ -21,7 +24,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [86, 87], loc: { @@ -66,6 +71,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 88], @@ -79,9 +85,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { @@ -126,6 +135,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [89, 110], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot index ae11f119f07..1cc236c53e0 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,159 @@ exports[`AST Fixtures legacy-fixtures types type-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'keyof', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [80, 87], + loc: { + start: { column: 7, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [78, 87], + loc: { + start: { column: 5, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + init: null, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'unique', + typeAnnotation: TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [103, 109], + loc: { + start: { column: 14, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [96, 109], + loc: { + start: { column: 7, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [94, 109], + loc: { + start: { column: 5, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [93, 109], + loc: { + start: { column: 4, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + init: null, + + range: [93, 109], + loc: { + start: { column: 4, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [89, 110], + loc: { + start: { column: 0, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot index cb47a67aee4..c78aefba38d 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "self", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -55,6 +58,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 95], @@ -68,9 +72,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -88,7 +95,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "foo", + optional: false, range: [117, 120], loc: { @@ -133,6 +142,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [96, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot index 742698e35d8..e032e84b0c5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'self', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeQuery { @@ -62,6 +65,7 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] }, }, ], +- declare: false, kind: 'let', range: [73, 95], @@ -75,9 +79,12 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeQuery { @@ -98,7 +105,9 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [117, 120], loc: { @@ -143,6 +152,7 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] }, }, ], +- declare: false, kind: 'let', range: [96, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot index da18ddbed86..7b4638ac81a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -20,7 +23,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, range: [87, 88], loc: { @@ -30,7 +35,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "z", + optional: false, range: [89, 90], loc: { @@ -45,14 +52,16 @@ Program { end: { column: 17, line: 3 }, }, }, - typeParameters: TSTypeParameterInstantiation { + typeArguments: TSTypeParameterInstantiation { type: "TSTypeParameterInstantiation", params: [ TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "w", + optional: false, range: [91, 92], loc: { @@ -105,6 +114,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index 1ad2b5d62c4..4ff83eed65f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,139 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeQuery { + type: 'TSTypeQuery', + exprName: TSQualifiedName { + type: 'TSQualifiedName', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'z', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, +- typeArguments: TSTypeParameterInstantiation { ++ typeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'w', +- optional: false, + + range: [91, 92], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [91, 92], + loc: { + start: { column: 18, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [80, 93], + loc: { + start: { column: 7, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [78, 93], + loc: { + start: { column: 5, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + init: null, + + range: [77, 93], + loc: { + start: { column: 4, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot index 31eaebb2e2d..fddee09790b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -20,7 +23,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: [], name: "y", + optional: false, range: [87, 88], loc: { @@ -30,7 +35,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: [], name: "z", + optional: false, range: [89, 90], loc: { @@ -75,6 +82,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 91], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot index 27f2e96b44e..9626fdabc89 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,106 @@ exports[`AST Fixtures legacy-fixtures types typeof AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeQuery { + type: 'TSTypeQuery', + exprName: TSQualifiedName { + type: 'TSQualifiedName', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'z', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [80, 90], + loc: { + start: { column: 7, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [78, 90], + loc: { + start: { column: 5, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [77, 90], + loc: { + start: { column: 4, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + init: null, + + range: [77, 90], + loc: { + start: { column: 4, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot index 0adf4ef0127..f15ca890604 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "union", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -75,6 +78,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 110], @@ -88,9 +92,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "intersection", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSIntersectionType { @@ -145,6 +152,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [111, 145], @@ -158,9 +166,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "precedence1", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -235,6 +246,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [146, 191], @@ -248,9 +260,12 @@ Program { declarations: [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: [], name: "precedence2", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -325,6 +340,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [192, 237], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot index ab9ae31400d..f06a5479ddf 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'union', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -79,6 +82,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [73, 110], @@ -92,9 +96,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersection', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSIntersectionType { @@ -149,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [111, 145], @@ -162,9 +170,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence1', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -268,6 +279,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [146, 191], @@ -281,9 +293,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence2', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -387,6 +402,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [192, 237], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot index 4798d7da045..13a4dc55881 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot index 9bf8457567f..2a439c04296 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,70 @@ exports[`AST Fixtures legacy-fixtures types union-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSIntersectionType { + type: 'TSIntersectionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [84, 99], + loc: { + start: { column: 11, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/parameter/ArrayPattern/spec.ts b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts index 420a9327873..9fd684b8044 100644 --- a/packages/ast-spec/src/parameter/ArrayPattern/spec.ts +++ b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts @@ -7,7 +7,7 @@ import type { DestructuringPattern } from '../../unions/DestructuringPattern'; export interface ArrayPattern extends BaseNode { type: AST_NODE_TYPES.ArrayPattern; elements: (DestructuringPattern | null)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts index ee558c2167c..208a44e8298 100644 --- a/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts +++ b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts @@ -9,7 +9,7 @@ export interface AssignmentPattern extends BaseNode { type: AST_NODE_TYPES.AssignmentPattern; left: BindingName; right: Expression; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/ObjectPattern/spec.ts b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts index 12c89878794..76c53798a4d 100644 --- a/packages/ast-spec/src/parameter/ObjectPattern/spec.ts +++ b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts @@ -8,7 +8,7 @@ import type { RestElement } from '../RestElement/spec'; export interface ObjectPattern extends BaseNode { type: AST_NODE_TYPES.ObjectPattern; properties: (Property | RestElement)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/RestElement/spec.ts b/packages/ast-spec/src/parameter/RestElement/spec.ts index 006f5e48ba3..59f07798864 100644 --- a/packages/ast-spec/src/parameter/RestElement/spec.ts +++ b/packages/ast-spec/src/parameter/RestElement/spec.ts @@ -8,8 +8,8 @@ import type { AssignmentPattern } from '../AssignmentPattern/spec'; export interface RestElement extends BaseNode { type: AST_NODE_TYPES.RestElement; argument: DestructuringPattern; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - value?: AssignmentPattern; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + value: AssignmentPattern | undefined; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/fixture.ts b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/fixture.ts new file mode 100644 index 00000000000..15fcc76d927 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/fixture.ts @@ -0,0 +1 @@ +function foo(override parameter) {} diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..10b3877c585 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-function-parameter Babel - Error 1`] = `[SyntaxError: A parameter property is only allowed in a constructor implementation. (1:13)]`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..622f9f761c1 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-function-parameter TSESTree - Error 1`] = ` +"TSError +> 1 | function foo(override parameter) {} + | ^^^^^^^^ A parameter property is only allowed in a constructor implementation. + 2 |" +`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..fdd63861522 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-function-parameter Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..10b3877c585 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-function-parameter Babel - Error 1`] = `[SyntaxError: A parameter property is only allowed in a constructor implementation. (1:13)]`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..2ed033795ab --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-function-parameter/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-function-parameter Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/fixture.ts b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/fixture.ts new file mode 100644 index 00000000000..4a03af84366 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + method(override parameter) {} +} diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..63ae30ee6f5 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-method-parameter Babel - Error 1`] = `[SyntaxError: A parameter property is only allowed in a constructor implementation. (2:9)]`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..20c1175484e --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-method-parameter TSESTree - Error 1`] = ` +"TSError + 1 | class Foo { +> 2 | method(override parameter) {} + | ^^^^^^^^ A parameter property is only allowed in a constructor implementation. + 3 | } + 4 |" +`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..500c7d90879 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-method-parameter Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..63ae30ee6f5 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-method-parameter Babel - Error 1`] = `[SyntaxError: A parameter property is only allowed in a constructor implementation. (2:9)]`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..8865ee198d9 --- /dev/null +++ b/packages/ast-spec/src/parameter/TSParameterProperty/fixtures/_error_/override-method-parameter/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures parameter TSParameterProperty _error_ override-method-parameter Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts index 0cf3c4a911d..56b5f559529 100644 --- a/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts +++ b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts @@ -8,11 +8,10 @@ import type { RestElement } from '../RestElement/spec'; export interface TSParameterProperty extends BaseNode { type: AST_NODE_TYPES.TSParameterProperty; - accessibility?: Accessibility; - readonly?: boolean; - static?: boolean; - export?: boolean; - override?: boolean; + accessibility: Accessibility | undefined; + readonly: boolean; + static: boolean; + override: boolean; parameter: AssignmentPattern | BindingName | RestElement; - decorators?: Decorator[]; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/special/Program/spec.ts b/packages/ast-spec/src/special/Program/spec.ts index 81d69e1e604..e338dbf677e 100644 --- a/packages/ast-spec/src/special/Program/spec.ts +++ b/packages/ast-spec/src/special/Program/spec.ts @@ -1,13 +1,13 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { BaseNode } from '../../base/BaseNode'; +import type { NodeOrTokenData } from '../../base/NodeOrTokenData'; import type { Comment } from '../../unions/Comment'; import type { ProgramStatement } from '../../unions/Statement'; import type { Token } from '../../unions/Token'; -export interface Program extends BaseNode { +export interface Program extends NodeOrTokenData { type: AST_NODE_TYPES.Program; body: ProgramStatement[]; sourceType: 'module' | 'script'; - comments?: Comment[]; - tokens?: Token[]; + comments: Comment[] | undefined; + tokens: Token[] | undefined; } diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/1-TSESTree-AST.shot index a6d847de1c2..ef5668193ae 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/1-TSESTree-AST.shot @@ -33,7 +33,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [17, 18], loc: { @@ -51,7 +53,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot index a1609757d3c..272b11db8f6 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot @@ -37,7 +37,9 @@ exports[`AST Fixtures special TSTypeParameter arrow-const-modifier-extends AST A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [17, 18], loc: { @@ -55,7 +57,9 @@ exports[`AST Fixtures special TSTypeParameter arrow-const-modifier-extends AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [7, 8], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/1-TSESTree-AST.shot index beab46e12b9..73bffe1a371 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/1-TSESTree-AST.shot @@ -32,7 +32,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/5-AST-Alignment-AST.shot index 0fd5e92e286..74a35f8fcd8 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/arrow-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -36,7 +36,9 @@ exports[`AST Fixtures special TSTypeParameter arrow-const-modifier AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [7, 8], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/1-TSESTree-AST.shot index 4c7658d5f79..07a3ebcc8fc 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 22, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "E", + optional: false, range: [6, 7], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 1 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/5-AST-Alignment-AST.shot index b8aa62a507c..2a8f32cddbb 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-in-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-in-modifier AST A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-in-modifier AST A end: { column: 22, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'E', +- optional: false, range: [6, 7], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-in-modifier AST A end: { column: 7, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-in-modifier AST A in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot index 99c1b4bfa76..dcd6e04ab45 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 29, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "B", + optional: false, range: [6, 7], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 1 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -37,7 +43,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [24, 25], loc: { @@ -55,7 +63,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [14, 15], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot index 6b9faf086d6..09f4c2fef77 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-extends body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-extends end: { column: 29, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [6, 7], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-extends end: { column: 7, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -41,7 +47,9 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-extends type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [24, 25], loc: { @@ -59,7 +67,9 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-extends - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [14, 15], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot index e4ea2237032..894c1752a12 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 22, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "C", + optional: false, range: [6, 7], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 1 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [8, 9], loc: { @@ -58,7 +66,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index 274981ae125..7a64e239d88 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-multiple body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-multiple end: { column: 22, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [6, 7], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-multiple end: { column: 7, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,9 +46,10 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -+ name: 'T', - +- optional: false, +- - range: [8, 9], - loc: { - start: { column: 8, line: 1 }, @@ -50,7 +57,8 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-multiple - }, - }, - out: false, -- ++ name: 'T', + range: [8, 9], loc: { start: { column: 8, line: 1 }, @@ -63,7 +71,9 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/1-TSESTree-AST.shot index 6a0bab05f37..67a3d5754e1 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 19, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "A", + optional: false, range: [6, 7], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 1 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [14, 15], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot index 27b0483a19b..d8b4d9eadee 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier AST Alig end: { column: 19, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [6, 7], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier AST Alig end: { column: 7, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures special TSTypeParameter class-decl-const-modifier AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [14, 15], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/1-TSESTree-AST.shot index 132ed8b6e37..124790f2fbc 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -16,9 +17,13 @@ Program { end: { column: 22, line: 1 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "D", + optional: false, range: [6, 7], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 1 }, }, }, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/5-AST-Alignment-AST.shot index f6ed4a29e37..c8d0f76fe9d 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-decl-in-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-in-const-modifier AST A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures special TSTypeParameter class-decl-in-const-modifier AST A end: { column: 22, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'D', +- optional: false, range: [6, 7], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures special TSTypeParameter class-decl-in-const-modifier AST A end: { column: 7, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures special TSTypeParameter class-decl-in-const-modifier AST A in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/1-TSESTree-AST.shot index 2ae40e1f3f4..9d3bd6eaa12 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExpressionStatement", expression: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 22, line: 1 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -29,7 +33,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/5-AST-Alignment-AST.shot index d212dd9308f..32a31c4e8e4 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-in-modifier/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-in-modifier AST A type: 'ExpressionStatement', expression: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-in-modifier AST A end: { column: 22, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -33,7 +37,9 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-in-modifier AST A in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot index 9c4dee68d2b..125a353ad2f 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExpressionStatement", expression: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 29, line: 1 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -30,7 +34,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [24, 25], loc: { @@ -48,7 +54,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [14, 15], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot index 3d17a9cdd49..076a347f025 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-extends type: 'ExpressionStatement', expression: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-extends end: { column: 29, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -34,7 +38,9 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-extends type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [24, 25], loc: { @@ -52,7 +58,9 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-extends - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [14, 15], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot index 183080d0ea2..a8c6cf44d81 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExpressionStatement", expression: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 22, line: 1 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -29,7 +33,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [8, 9], loc: { @@ -51,7 +57,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index b6d1dee5b19..8ff0271450e 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-multiple type: 'ExpressionStatement', expression: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-multiple end: { column: 22, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -33,9 +37,10 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -+ name: 'T', - +- optional: false, +- - range: [8, 9], - loc: { - start: { column: 8, line: 1 }, @@ -43,7 +48,8 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-multiple - }, - }, - out: false, -- ++ name: 'T', + range: [8, 9], loc: { start: { column: 8, line: 1 }, @@ -56,7 +62,9 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/1-TSESTree-AST.shot index 97670b76950..ffc7d16c1be 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExpressionStatement", expression: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 19, line: 1 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -29,7 +33,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [14, 15], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot index 2363475fdb4..05e22d460f7 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier AST Alig type: 'ExpressionStatement', expression: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier AST Alig end: { column: 19, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -33,7 +37,9 @@ exports[`AST Fixtures special TSTypeParameter class-expr-const-modifier AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [14, 15], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/1-TSESTree-AST.shot index fa67e5d5be0..5a7a38bb6cb 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExpressionStatement", expression: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: [], @@ -18,7 +19,10 @@ Program { end: { column: 22, line: 1 }, }, }, + declare: false, + decorators: [], id: null, + implements: [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -29,7 +33,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/5-AST-Alignment-AST.shot index f3f3121a24c..e92dc3b1d94 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/class-expr-in-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures special TSTypeParameter class-expr-in-const-modifier AST A type: 'ExpressionStatement', expression: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures special TSTypeParameter class-expr-in-const-modifier AST A end: { column: 22, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -33,7 +37,9 @@ exports[`AST Fixtures special TSTypeParameter class-expr-in-const-modifier AST A in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/1-TSESTree-AST.shot index 11f14029939..4b1dc68aa05 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "d", + optional: false, range: [17, 18], loc: { @@ -30,7 +32,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [25, 26], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/5-AST-Alignment-AST.shot index 15e908f2a61..a77f9f4551d 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/declare-func-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -16,7 +16,9 @@ exports[`AST Fixtures special TSTypeParameter declare-func-const-modifier AST Al generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [17, 18], loc: { @@ -34,7 +36,9 @@ exports[`AST Fixtures special TSTypeParameter declare-func-const-modifier AST Al - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [25, 26], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot index 5572b5335c8..edd2373c7cd 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 34, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "b", + optional: false, range: [9, 10], loc: { @@ -40,7 +43,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [27, 28], loc: { @@ -58,7 +63,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot index 737f0d3abc7..f8731ecd937 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-extends A end: { column: 34, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [9, 10], loc: { @@ -44,7 +47,9 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-extends A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [27, 28], loc: { @@ -62,7 +67,9 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-extends A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot index 71d3cd47f02..1f5ca163794 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 27, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "c", + optional: false, range: [9, 10], loc: { @@ -39,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [11, 12], loc: { @@ -61,7 +66,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [20, 21], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index eba1adb09f4..49e154acacc 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-multiple end: { column: 27, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [9, 10], loc: { @@ -43,9 +46,10 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -+ name: 'T', - +- optional: false, +- - range: [11, 12], - loc: { - start: { column: 11, line: 1 }, @@ -53,7 +57,8 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-multiple - }, - }, - out: false, -- ++ name: 'T', + range: [11, 12], loc: { start: { column: 11, line: 1 }, @@ -66,7 +71,9 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [20, 21], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/1-TSESTree-AST.shot index 439f20b8d92..56a976debdb 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: [], name: "a", + optional: false, range: [9, 10], loc: { @@ -39,7 +42,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot index 71ee0e188f1..2bc3d071c6d 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-decl-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier AST Align end: { column: 24, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -43,7 +46,9 @@ exports[`AST Fixtures special TSTypeParameter func-decl-const-modifier AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot index 4687caca30c..d22b0f6d6f9 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/1-TSESTree-AST.shot @@ -19,6 +19,7 @@ Program { end: { column: 34, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -33,7 +34,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [27, 28], loc: { @@ -51,7 +54,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot index 64cbd211b5d..874eddf9050 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot @@ -23,6 +23,7 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-extends A end: { column: 34, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -37,7 +38,9 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-extends A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [27, 28], loc: { @@ -55,7 +58,9 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-extends A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot index 981d3e4bfbc..2af61b6a3d0 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -19,6 +19,7 @@ Program { end: { column: 27, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -32,7 +33,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [11, 12], loc: { @@ -54,7 +57,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [20, 21], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index 2a50d483de2..4c17ab31e05 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -23,6 +23,7 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-multiple end: { column: 27, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -36,9 +37,10 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -+ name: 'T', - +- optional: false, +- - range: [11, 12], - loc: { - start: { column: 11, line: 1 }, @@ -46,7 +48,8 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-multiple - }, - }, - out: false, -- ++ name: 'T', + range: [11, 12], loc: { start: { column: 11, line: 1 }, @@ -59,7 +62,9 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [20, 21], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/1-TSESTree-AST.shot index 249dc8e4253..812a9a584fd 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/1-TSESTree-AST.shot @@ -19,6 +19,7 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -32,7 +33,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [17, 18], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot index a5476c5645a..6846f0270b8 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/func-expr-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -23,6 +23,7 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier AST Align end: { column: 24, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -36,7 +37,9 @@ exports[`AST Fixtures special TSTypeParameter func-expr-const-modifier AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [17, 18], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/1-TSESTree-AST.shot index 21c5d81390d..5a0302a6b4d 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 26, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "M", + optional: false, range: [10, 11], loc: { @@ -35,7 +39,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index 4add40cf5d1..d5e84b269a2 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-in-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures special TSTypeParameter interface-const-in-modifier-multip end: { column: 26, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [10, 11], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures special TSTypeParameter interface-const-in-modifier-multip in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/1-TSESTree-AST.shot index eb7f3b8a588..dc82e1e4638 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 33, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "J", + optional: false, range: [10, 11], loc: { @@ -36,7 +40,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [28, 29], loc: { @@ -54,7 +60,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot index 47c6ccd25b6..623b81b8b4d 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-extends/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-extends A end: { column: 33, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'J', +- optional: false, range: [10, 11], loc: { @@ -40,7 +44,9 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-extends A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [28, 29], loc: { @@ -58,7 +64,9 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-extends A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [18, 19], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/1-TSESTree-AST.shot index 341ae78b252..b1d7a768004 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 26, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "I", + optional: false, range: [10, 11], loc: { @@ -35,7 +39,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [12, 13], loc: { @@ -57,7 +63,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index 80b85b253f0..90fa3b6e9a2 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-multiple end: { column: 26, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'I', +- optional: false, range: [10, 11], loc: { @@ -39,9 +43,10 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -+ name: 'T', - +- optional: false, +- - range: [12, 13], - loc: { - start: { column: 12, line: 1 }, @@ -49,7 +54,8 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-multiple - }, - }, - out: false, -- ++ name: 'T', + range: [12, 13], loc: { start: { column: 12, line: 1 }, @@ -62,7 +68,9 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/1-TSESTree-AST.shot index 65601c74de4..12c0c5b4e40 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "I", + optional: false, range: [10, 11], loc: { @@ -35,7 +39,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/5-AST-Alignment-AST.shot index f24056fd5d6..6a5035aefdf 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-const-modifier/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier AST Align end: { column: 23, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'I', +- optional: false, range: [10, 11], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures special TSTypeParameter interface-const-modifier AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [18, 19], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/1-TSESTree-AST.shot index 2971baddac5..cc71f3fee6e 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 26, line: 1 }, }, }, + declare: false, + extends: [], id: Identifier { type: "Identifier", + decorators: [], name: "L", + optional: false, range: [10, 11], loc: { @@ -35,7 +39,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot index 3579f6bbe03..832132ccc64 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures special TSTypeParameter interface-in-const-modifier-multip end: { column: 26, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'L', +- optional: false, range: [10, 11], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures special TSTypeParameter interface-in-const-modifier-multip in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/1-TSESTree-AST.shot index 6b8bb7862af..147fb616c0c 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method", + optional: false, range: [12, 18], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 22, line: 2 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -51,7 +57,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [25, 26], loc: { @@ -92,9 +100,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method", + optional: false, range: [35, 41], loc: { @@ -103,6 +114,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -118,6 +130,7 @@ Program { end: { column: 32, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -132,7 +145,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [58, 59], loc: { @@ -150,7 +165,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [48, 49], loc: { @@ -191,9 +208,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: [], key: Identifier { type: "Identifier", + decorators: [], name: "method", + optional: false, range: [68, 74], loc: { @@ -202,6 +222,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -217,6 +238,7 @@ Program { end: { column: 25, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -230,7 +252,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "T", + optional: false, range: [75, 76], loc: { @@ -252,7 +276,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: [], name: "U", + optional: false, range: [84, 85], loc: { @@ -298,9 +324,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: [], id: Identifier { type: "Identifier", + decorators: [], name: "_", + optional: false, range: [6, 7], loc: { @@ -308,6 +338,7 @@ Program { end: { column: 7, line: 1 }, }, }, + implements: [], superClass: null, range: [0, 93], diff --git a/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/5-AST-Alignment-AST.shot index 14bbb7928aa..bc2c908f083 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/special/TSTypeParameter/fixtures/method-const-modifiers/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [12, 18], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme end: { column: 22, line: 2 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -55,8 +61,11 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, ++ name: 'T', + - range: [25, 26], - loc: { - start: { column: 15, line: 2 }, @@ -64,8 +73,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme - }, - }, - out: false, -+ name: 'T', - +- range: [19, 26], loc: { start: { column: 9, line: 2 }, @@ -99,9 +107,12 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [35, 41], loc: { @@ -110,6 +121,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -125,6 +137,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme end: { column: 32, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -139,7 +152,9 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [58, 59], loc: { @@ -157,7 +172,9 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [48, 49], - loc: { @@ -201,9 +218,12 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [68, 74], loc: { @@ -212,6 +232,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -227,6 +248,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme end: { column: 25, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -240,8 +262,11 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, ++ name: 'T', + - range: [75, 76], - loc: { - start: { column: 9, line: 4 }, @@ -249,8 +274,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme - }, - }, - out: false, -+ name: 'T', - +- range: [75, 76], loc: { start: { column: 9, line: 4 }, @@ -263,7 +287,9 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [84, 85], - loc: { @@ -312,9 +338,13 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: '_', +- optional: false, range: [6, 7], loc: { @@ -322,6 +352,7 @@ exports[`AST Fixtures special TSTypeParameter method-const-modifiers AST Alignme end: { column: 7, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 93], diff --git a/packages/ast-spec/src/special/TSTypeParameter/spec.ts b/packages/ast-spec/src/special/TSTypeParameter/spec.ts index 1d0bc76f127..a1295bfa7a9 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/spec.ts +++ b/packages/ast-spec/src/special/TSTypeParameter/spec.ts @@ -6,8 +6,8 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSTypeParameter extends BaseNode { type: AST_NODE_TYPES.TSTypeParameter; name: Identifier; - constraint?: TypeNode; - default?: TypeNode; + constraint: TypeNode | undefined; + default: TypeNode | undefined; in: boolean; out: boolean; const: boolean; diff --git a/packages/ast-spec/src/special/VariableDeclarator/spec.ts b/packages/ast-spec/src/special/VariableDeclarator/spec.ts index 619c6a57d5d..50f129faf58 100644 --- a/packages/ast-spec/src/special/VariableDeclarator/spec.ts +++ b/packages/ast-spec/src/special/VariableDeclarator/spec.ts @@ -7,5 +7,5 @@ export interface VariableDeclarator extends BaseNode { type: AST_NODE_TYPES.VariableDeclarator; id: BindingName; init: Expression | null; - definite?: boolean; + definite: boolean; } diff --git a/packages/ast-spec/src/statement/ExpressionStatement/spec.ts b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts index f5fd336a960..9ae5cd1f31d 100644 --- a/packages/ast-spec/src/statement/ExpressionStatement/spec.ts +++ b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts @@ -5,5 +5,5 @@ import type { Expression } from '../../unions/Expression'; export interface ExpressionStatement extends BaseNode { type: AST_NODE_TYPES.ExpressionStatement; expression: Expression; - directive?: string; + directive: string | undefined; } diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/fixture.ts b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/fixture.ts new file mode 100644 index 00000000000..e1a5a7980c3 --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/fixture.ts @@ -0,0 +1,3 @@ +{ + throw +} diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..f723750f0ee --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ThrowStatement _error_ missing-argument Babel - Error 1`] = `[SyntaxError: Illegal newline after throw. (2:9)]`; diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..cf149c8bdc2 --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ThrowStatement _error_ missing-argument TSESTree - Error 1`] = ` +"TSError + 1 | { +> 2 | throw + | ^^^^^ A throw statement must throw an expression. + 3 | } + 4 |" +`; diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..79c7461a897 --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ThrowStatement _error_ missing-argument Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..f723750f0ee --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ThrowStatement _error_ missing-argument Babel - Error 1`] = `[SyntaxError: Illegal newline after throw. (2:9)]`; diff --git a/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..51974790455 --- /dev/null +++ b/packages/ast-spec/src/statement/ThrowStatement/fixtures/_error_/missing-argument/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures statement ThrowStatement _error_ missing-argument Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/type/TSImportType/spec.ts b/packages/ast-spec/src/type/TSImportType/spec.ts index b2eea1a78e0..3eb30235d9b 100644 --- a/packages/ast-spec/src/type/TSImportType/spec.ts +++ b/packages/ast-spec/src/type/TSImportType/spec.ts @@ -6,8 +6,10 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSImportType extends BaseNode { type: AST_NODE_TYPES.TSImportType; - isTypeOf: boolean; - parameter: TypeNode; + argument: TypeNode; qualifier: EntityName | null; + typeArguments: TSTypeParameterInstantiation | null; + + /** @deprecated Use {@link `typeArguments`} instead. */ typeParameters: TSTypeParameterInstantiation | null; } diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/fixture.ts b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/fixture.ts new file mode 100644 index 00000000000..0f620d4925e --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/fixture.ts @@ -0,0 +1,4 @@ +type Mapped = { + member: member; + [key in keyof O]: number; +}; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..a18ec232c74 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ looks-like-mapped-type-but-with-members Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "]" (3:16)]`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..3ddaaa553ab --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ looks-like-mapped-type-but-with-members TSESTree - Error 1`] = ` +"TSError + 1 | type Mapped = { + 2 | member: member; +> 3 | [key in keyof O]: number; + | ^ ']' expected. + 4 | }; + 5 |" +`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..be7ee0f9c84 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ looks-like-mapped-type-but-with-members Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..a18ec232c74 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ looks-like-mapped-type-but-with-members Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "]" (3:16)]`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..be7ee0f9c84 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/looks-like-mapped-type-but-with-members/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ looks-like-mapped-type-but-with-members Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/fixture.ts b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/fixture.ts new file mode 100644 index 00000000000..2067882f9e2 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/fixture.ts @@ -0,0 +1,4 @@ +type Mapped = { + [key in keyof O]: number; + member: member; +}; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/1-Babel-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/1-Babel-Error.shot new file mode 100644 index 00000000000..bfe056cd787 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/1-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ with-member Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "}" (3:2)]`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..6ace2444c88 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ with-member TSESTree - Error 1`] = ` +"TSError + 1 | type Mapped = { + 2 | [key in keyof O]: number; +> 3 | member: member; + | ^^^^^^^^^^^^^^^ A mapped type may not declare properties or methods. + 4 | }; + 5 |" +`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/2-Alignment-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/2-Alignment-Error.shot new file mode 100644 index 00000000000..42d0ee954c5 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/2-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ with-member Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..bfe056cd787 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ with-member Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "}" (3:2)]`; diff --git a/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..26b43912008 --- /dev/null +++ b/packages/ast-spec/src/type/TSMappedType/fixtures/_error_/with-member/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures type TSMappedType _error_ with-member Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/type/TSMappedType/spec.ts b/packages/ast-spec/src/type/TSMappedType/spec.ts index db5abd4063a..8b81c4f77bb 100644 --- a/packages/ast-spec/src/type/TSMappedType/spec.ts +++ b/packages/ast-spec/src/type/TSMappedType/spec.ts @@ -6,8 +6,8 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSMappedType extends BaseNode { type: AST_NODE_TYPES.TSMappedType; typeParameter: TSTypeParameter; - readonly?: boolean | '-' | '+'; - optional?: boolean | '-' | '+'; - typeAnnotation?: TypeNode; + readonly: boolean | '-' | '+' | undefined; + optional: boolean | '-' | '+' | undefined; + typeAnnotation: TypeNode | undefined; nameType: TypeNode | null; } diff --git a/packages/ast-spec/src/type/TSTypeOperator/spec.ts b/packages/ast-spec/src/type/TSTypeOperator/spec.ts index c83b8721eed..f6d530c084f 100644 --- a/packages/ast-spec/src/type/TSTypeOperator/spec.ts +++ b/packages/ast-spec/src/type/TSTypeOperator/spec.ts @@ -5,5 +5,5 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSTypeOperator extends BaseNode { type: AST_NODE_TYPES.TSTypeOperator; operator: 'keyof' | 'readonly' | 'unique'; - typeAnnotation?: TypeNode; + typeAnnotation: TypeNode | undefined; } diff --git a/packages/ast-spec/src/type/TSTypeQuery/spec.ts b/packages/ast-spec/src/type/TSTypeQuery/spec.ts index 634c307ad2c..b6ec9fdf6ec 100644 --- a/packages/ast-spec/src/type/TSTypeQuery/spec.ts +++ b/packages/ast-spec/src/type/TSTypeQuery/spec.ts @@ -2,9 +2,13 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; import type { TSTypeParameterInstantiation } from '../../special/spec'; import type { EntityName } from '../../unions/EntityName'; +import type { TSImportType } from '../TSImportType/spec'; export interface TSTypeQuery extends BaseNode { type: AST_NODE_TYPES.TSTypeQuery; - exprName: EntityName; - typeParameters?: TSTypeParameterInstantiation; + exprName: EntityName | TSImportType; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; } diff --git a/packages/ast-spec/src/type/TSTypeReference/spec.ts b/packages/ast-spec/src/type/TSTypeReference/spec.ts index 9d88fe7f6b4..c7b5b340b2f 100644 --- a/packages/ast-spec/src/type/TSTypeReference/spec.ts +++ b/packages/ast-spec/src/type/TSTypeReference/spec.ts @@ -5,6 +5,10 @@ import type { EntityName } from '../../unions/EntityName'; export interface TSTypeReference extends BaseNode { type: AST_NODE_TYPES.TSTypeReference; + typeArguments: TSTypeParameterInstantiation | undefined; + + /** @deprecated Use {@link `typeArguments`} instead. */ + typeParameters: TSTypeParameterInstantiation | undefined; + typeName: EntityName; - typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/unions/ExportDeclaration.ts b/packages/ast-spec/src/unions/ExportDeclaration.ts index b78996d1405..b3a25fd3811 100644 --- a/packages/ast-spec/src/unions/ExportDeclaration.ts +++ b/packages/ast-spec/src/unions/ExportDeclaration.ts @@ -8,6 +8,7 @@ import type { } from '../declaration/FunctionDeclaration/spec'; import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; +import type { TSImportEqualsDeclaration } from '../declaration/TSImportEqualsDeclaration/spec'; import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; @@ -37,6 +38,7 @@ export type NamedExportDeclarations = | FunctionDeclarationWithOptionalName | TSDeclareFunction | TSEnumDeclaration + | TSImportEqualsDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration diff --git a/packages/ast-spec/src/unions/Modifier.ts b/packages/ast-spec/src/unions/Modifier.ts deleted file mode 100644 index f2501e6585c..00000000000 --- a/packages/ast-spec/src/unions/Modifier.ts +++ /dev/null @@ -1,16 +0,0 @@ -import type { TSAbstractKeyword } from '../type/TSAbstractKeyword/spec'; -import type { TSAsyncKeyword } from '../type/TSAsyncKeyword/spec'; -import type { TSPrivateKeyword } from '../type/TSPrivateKeyword/spec'; -import type { TSProtectedKeyword } from '../type/TSProtectedKeyword/spec'; -import type { TSPublicKeyword } from '../type/TSPublicKeyword/spec'; -import type { TSReadonlyKeyword } from '../type/TSReadonlyKeyword/spec'; -import type { TSStaticKeyword } from '../type/TSStaticKeyword/spec'; - -export type Modifier = - | TSAbstractKeyword - | TSAsyncKeyword - | TSPrivateKeyword - | TSProtectedKeyword - | TSPublicKeyword - | TSReadonlyKeyword - | TSStaticKeyword; diff --git a/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts b/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts new file mode 100644 index 00000000000..95f993b9e4d --- /dev/null +++ b/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts @@ -0,0 +1,20 @@ +import type { + AssignmentOperator, + BinaryOperator, + SyntaxKind, +} from 'typescript'; + +import type { BinaryOperatorToText } from '../src'; + +type BinaryOperatorWithoutInvalidTypes = Exclude< + BinaryOperator, + | AssignmentOperator // --> AssignmentExpression + | SyntaxKind.CommaToken // -> SequenceExpression + | SyntaxKind.QuestionQuestionToken // -> LogicalExpression +>; +type _Test = { + readonly [T in BinaryOperatorWithoutInvalidTypes]: BinaryOperatorToText[T]; + // If there are any BinaryOperator members that don't have a corresponding + // BinaryOperatorToText, then this line will error with "Type 'T' cannot + // be used to index type 'BinaryOperatorToText'." +}; diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 4b7b8657e76..67a51cd0dd1 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -1,30 +1,80 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AST Fixtures List fixtures with AST differences 1`] = ` -Set { +[ + "declaration/ClassDeclaration/fixtures/abstract/fixture.ts", + "declaration/ClassDeclaration/fixtures/declare/fixture.ts", + "declaration/ClassDeclaration/fixtures/decorator-many/fixture.ts", + "declaration/ClassDeclaration/fixtures/decorator-one/fixture.ts", + "declaration/ClassDeclaration/fixtures/empty/fixture.ts", + "declaration/ClassDeclaration/fixtures/extends-literal/fixture.ts", + "declaration/ClassDeclaration/fixtures/extends-type-param/fixture.ts", + "declaration/ClassDeclaration/fixtures/extends/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-many/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-one/fixture.ts", "declaration/ClassDeclaration/fixtures/type-param/fixture.ts", "declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/fixture.ts", "declaration/ClassDeclaration/fixtures/with-member-one/fixture.ts", + "declaration/ExportAllDeclaration/fixtures/assertion/fixture.ts", "declaration/ExportAllDeclaration/fixtures/kind-type/fixture.ts", + "declaration/ExportAllDeclaration/fixtures/named/fixture.ts", "declaration/ExportAllDeclaration/fixtures/type-kind/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/anonymous-class/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/anonymous-function/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/class-expression/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/class/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/function/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/identifier/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/class/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/declare-function/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/function-declaration/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/identifier-braced/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/identifier-many/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/namespace/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/type-alias/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/variable-declaration/fixture.ts", + "declaration/FunctionDeclaration/fixtures/async/fixture.ts", + "declaration/FunctionDeclaration/fixtures/empty/fixture.ts", + "declaration/FunctionDeclaration/fixtures/generator/fixture.ts", + "declaration/FunctionDeclaration/fixtures/param-many/fixture.ts", + "declaration/FunctionDeclaration/fixtures/param-one/fixture.ts", + "declaration/FunctionDeclaration/fixtures/returnType/fixture.ts", "declaration/FunctionDeclaration/fixtures/type-param-many/fixture.ts", "declaration/FunctionDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/ImportDeclaration/fixtures/assertion/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-named-many/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-named-none/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-named-one/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-namespace/fixture.ts", + "declaration/ImportDeclaration/fixtures/default/fixture.ts", + "declaration/ImportDeclaration/fixtures/named-many/fixture.ts", + "declaration/ImportDeclaration/fixtures/named-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/empty/fixture.ts", + "declaration/TSDeclareFunction/fixtures/generator/fixture.ts", + "declaration/TSDeclareFunction/fixtures/param-many/fixture.ts", + "declaration/TSDeclareFunction/fixtures/param-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/returnType/fixture.ts", "declaration/TSDeclareFunction/fixtures/type-param-many/fixture.ts", "declaration/TSDeclareFunction/fixtures/type-param-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/without-declare/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/const/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/declare/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/empty/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/with-member-one/fixture.ts", + "declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/fixture.ts", + "declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/fixture.ts", "declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/declare/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/empty/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts", "declaration/TSModuleDeclaration/fixtures/global/fixture.ts", "declaration/TSModuleDeclaration/fixtures/module-declare-no-body/fixture.ts", "declaration/TSModuleDeclaration/fixtures/module-declare/fixture.ts", @@ -34,14 +84,27 @@ Set { "declaration/TSModuleDeclaration/fixtures/namespace-declare/fixture.ts", "declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/fixture.ts", "declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/fixture.ts", + "declaration/TSModuleDeclaration/fixtures/namespace-nested-once/fixture.ts", + "declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/fixture.ts", + "declaration/TSNamespaceExportDeclaration/fixtures/valid/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/declare/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/valid/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts", "element/AccessorProperty/fixtures/key-computed-complex/fixture.ts", "element/AccessorProperty/fixtures/key-computed-number/fixture.ts", "element/AccessorProperty/fixtures/key-computed-string/fixture.ts", + "element/AccessorProperty/fixtures/key-number/fixture.ts", "element/AccessorProperty/fixtures/key-private/fixture.ts", "element/AccessorProperty/fixtures/key-string/fixture.ts", - "element/AccessorProperty/fixtures/modifier-abstract-with-value/fixture.ts", "element/AccessorProperty/fixtures/modifier-abstract/fixture.ts", "element/AccessorProperty/fixtures/modifier-declare/fixture.ts", "element/AccessorProperty/fixtures/modifier-override/fixture.ts", @@ -55,22 +118,47 @@ Set { "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts", "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts", "expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts", + "jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx", + "jsx/JSXNamespacedName/fixtures/component/fixture.tsx", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/fixture.ts", "legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/fixture.ts", "legacy-fixtures/babylon-convergence/fixtures/type-parameters/fixture.ts", - "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-override-method/fixture.ts", + "legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/fixture.ts", "legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/fixture.ts", + "legacy-fixtures/basics/fixtures/async-function-expression/fixture.ts", + "legacy-fixtures/basics/fixtures/async-function-with-var-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/call-signatures-with-generics/fixture.ts", "legacy-fixtures/basics/fixtures/call-signatures/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-expression/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-multi-assign/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-multi/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-operator/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-simple/fixture.ts", + "legacy-fixtures/basics/fixtures/catch-clause-with-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/fixture.ts", + "legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/fixture.ts", "legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/fixture.ts", "legacy-fixtures/basics/fixtures/class-static-blocks/fixture.ts", @@ -97,6 +185,7 @@ Set { "legacy-fixtures/basics/fixtures/class-with-optional-methods/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-optional-properties/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/fixture.ts", + "legacy-fixtures/basics/fixtures/class-with-override-method/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-override-property/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-private-optional-property/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/fixture.ts", @@ -109,9 +198,18 @@ Set { "legacy-fixtures/basics/fixtures/class-with-type-parameter-default/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-type-parameter/fixture.ts", + "legacy-fixtures/basics/fixtures/const-enum/fixture.ts", "legacy-fixtures/basics/fixtures/declare-class-with-optional-method/fixture.ts", + "legacy-fixtures/basics/fixtures/declare-function/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment-nested/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment-object/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment-property/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment/fixture.ts", "legacy-fixtures/basics/fixtures/directive-in-module/fixture.ts", "legacy-fixtures/basics/fixtures/directive-in-namespace/fixture.ts", + "legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/fixture.ts", + "legacy-fixtures/basics/fixtures/export-all-with-import-assertions/fixture.ts", + "legacy-fixtures/basics/fixtures/export-as-namespace/fixture.ts", "legacy-fixtures/basics/fixtures/export-assignment/fixture.ts", "legacy-fixtures/basics/fixtures/export-declare-const-named-enum/fixture.ts", "legacy-fixtures/basics/fixtures/export-declare-named-enum/fixture.ts", @@ -120,23 +218,35 @@ Set { "legacy-fixtures/basics/fixtures/export-default-interface/fixture.ts", "legacy-fixtures/basics/fixtures/export-named-class-with-generic/fixture.ts", "legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/fixture.ts", + "legacy-fixtures/basics/fixtures/export-named-enum/fixture.ts", + "legacy-fixtures/basics/fixtures/export-star-as-ns-from/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-as/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-from-as/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-from/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-star-from/fixture.ts", "legacy-fixtures/basics/fixtures/export-type/fixture.ts", "legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/fixture.ts", + "legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/fixture.ts", + "legacy-fixtures/basics/fixtures/function-overloads/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-await/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-types-assignation/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-types/fixture.ts", + "legacy-fixtures/basics/fixtures/global-this/fixture.ts", "legacy-fixtures/basics/fixtures/import-equal-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-equal-type-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-export-equal-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-default/fixture.ts", + "legacy-fixtures/basics/fixtures/import-type-empty/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-named-as/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-named/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-star-as-ns/fixture.ts", + "legacy-fixtures/basics/fixtures/import-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/interface-extends-multiple/fixture.ts", "legacy-fixtures/basics/fixtures/interface-extends/fixture.ts", "legacy-fixtures/basics/fixtures/interface-type-parameters/fixture.ts", @@ -147,35 +257,98 @@ Set { "legacy-fixtures/basics/fixtures/interface-with-jsdoc/fixture.ts", "legacy-fixtures/basics/fixtures/interface-with-method/fixture.ts", "legacy-fixtures/basics/fixtures/interface-with-optional-properties/fixture.ts", + "legacy-fixtures/basics/fixtures/interface-without-type-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/intrinsic-keyword/fixture.ts", + "legacy-fixtures/basics/fixtures/keyof-operator/fixture.ts", "legacy-fixtures/basics/fixtures/keyword-variables/fixture.ts", + "legacy-fixtures/basics/fixtures/nested-type-arguments/fixture.ts", + "legacy-fixtures/basics/fixtures/never-type-param/fixture.ts", + "legacy-fixtures/basics/fixtures/non-null-assertion-operator/fixture.ts", + "legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/fixture.ts", + "legacy-fixtures/basics/fixtures/nullish-coalescing/fixture.ts", "legacy-fixtures/basics/fixtures/object-with-escaped-properties/fixture.ts", "legacy-fixtures/basics/fixtures/object-with-typed-methods/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-call/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-element-access/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-with-parens/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain/fixture.ts", "legacy-fixtures/basics/fixtures/private-fields-in-in/fixture.ts", + "legacy-fixtures/basics/fixtures/readonly-arrays/fixture.ts", + "legacy-fixtures/basics/fixtures/readonly-tuples/fixture.ts", + "legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/fixture.ts", + "legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/fixture.ts", + "legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/fixture.ts", + "legacy-fixtures/basics/fixtures/symbol-type-param/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration/fixture.ts", + "legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-in-function/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-in-method/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/fixture.ts", + "legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/type-guard-in-function/fixture.ts", "legacy-fixtures/basics/fixtures/type-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-guard-in-method/fixture.ts", "legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/fixture.ts", "legacy-fixtures/basics/fixtures/type-import-type/fixture.ts", + "legacy-fixtures/basics/fixtures/type-only-export-specifiers/fixture.ts", + "legacy-fixtures/basics/fixtures/type-only-import-specifiers/fixture.ts", "legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/fixture.ts", "legacy-fixtures/basics/fixtures/type-parameters-comments/fixture.ts", "legacy-fixtures/basics/fixtures/type-reference-comments/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-bigint/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-boolean/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-false/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-never/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-null/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-number/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-object/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-string/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-symbol/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-true/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-undefined/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-unknown/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-void/fixture.ts", "legacy-fixtures/basics/fixtures/typed-method-signature/fixture.ts", "legacy-fixtures/basics/fixtures/typed-this/fixture.ts", "legacy-fixtures/basics/fixtures/union-intersection/fixture.ts", + "legacy-fixtures/basics/fixtures/unique-symbol/fixture.ts", + "legacy-fixtures/basics/fixtures/unknown-type-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/var-with-dotted-type/fixture.ts", + "legacy-fixtures/basics/fixtures/var-with-type/fixture.ts", + "legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/fixture.ts", + "legacy-fixtures/class-decorators/fixtures/class-decorator-factory/fixture.ts", + "legacy-fixtures/class-decorators/fixtures/class-decorator/fixture.ts", "legacy-fixtures/class-decorators/fixtures/class-parameter-property/fixture.ts", "legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/fixture.ts", "legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/fixture.ts", + "legacy-fixtures/comments/fixtures/type-assertion-regression-test/fixture.ts", + "legacy-fixtures/declare/fixtures/abstract-class/fixture.ts", + "legacy-fixtures/declare/fixtures/class/fixture.ts", + "legacy-fixtures/declare/fixtures/enum/fixture.ts", + "legacy-fixtures/declare/fixtures/function/fixture.ts", + "legacy-fixtures/declare/fixtures/interface/fixture.ts", "legacy-fixtures/declare/fixtures/module/fixture.ts", "legacy-fixtures/declare/fixtures/namespace/fixture.ts", + "legacy-fixtures/declare/fixtures/type-alias/fixture.ts", + "legacy-fixtures/declare/fixtures/variable/fixture.ts", + "legacy-fixtures/expressions/fixtures/call-expression-type-arguments/fixture.ts", + "legacy-fixtures/expressions/fixtures/new-expression-type-arguments/fixture.ts", + "legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/fixture.ts", + "legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/fixture.ts", "legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/fixture.ts", "legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/fixture.ts", "legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/fixture.ts", @@ -196,10 +369,13 @@ Set { "legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/fixture.ts", "legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/fixture.ts", "legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/fixture.ts", + "legacy-fixtures/types/fixtures/array-type/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer-nested/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer-simple/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer-with-constraint/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer/fixture.ts", + "legacy-fixtures/types/fixtures/conditional-with-null/fixture.ts", + "legacy-fixtures/types/fixtures/conditional/fixture.ts", "legacy-fixtures/types/fixtures/constructor-abstract/fixture.ts", "legacy-fixtures/types/fixtures/constructor-empty/fixture.ts", "legacy-fixtures/types/fixtures/constructor-generic/fixture.ts", @@ -213,8 +389,15 @@ Set { "legacy-fixtures/types/fixtures/function-with-rest/fixture.ts", "legacy-fixtures/types/fixtures/function-with-this/fixture.ts", "legacy-fixtures/types/fixtures/function/fixture.ts", + "legacy-fixtures/types/fixtures/index-signature-readonly/fixture.ts", + "legacy-fixtures/types/fixtures/index-signature-without-type/fixture.ts", + "legacy-fixtures/types/fixtures/index-signature/fixture.ts", + "legacy-fixtures/types/fixtures/indexed/fixture.ts", "legacy-fixtures/types/fixtures/interface-with-accessors/fixture.ts", "legacy-fixtures/types/fixtures/intersection-type/fixture.ts", + "legacy-fixtures/types/fixtures/literal-number-negative/fixture.ts", + "legacy-fixtures/types/fixtures/literal-number/fixture.ts", + "legacy-fixtures/types/fixtures/literal-string/fixture.ts", "legacy-fixtures/types/fixtures/mapped-named-type/fixture.ts", "legacy-fixtures/types/fixtures/mapped-readonly-minus/fixture.ts", "legacy-fixtures/types/fixtures/mapped-readonly-plus/fixture.ts", @@ -227,14 +410,32 @@ Set { "legacy-fixtures/types/fixtures/optional-variance-in-out/fixture.ts", "legacy-fixtures/types/fixtures/optional-variance-in/fixture.ts", "legacy-fixtures/types/fixtures/optional-variance-out/fixture.ts", + "legacy-fixtures/types/fixtures/parenthesized-type/fixture.ts", + "legacy-fixtures/types/fixtures/reference-generic-nested/fixture.ts", + "legacy-fixtures/types/fixtures/reference-generic/fixture.ts", + "legacy-fixtures/types/fixtures/reference/fixture.ts", + "legacy-fixtures/types/fixtures/template-literal-type-1/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-2/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-3/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-4/fixture.ts", "legacy-fixtures/types/fixtures/this-type-expanded/fixture.ts", "legacy-fixtures/types/fixtures/this-type/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-empty/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named-optional/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named-rest/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named-type/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named/fixture.ts", "legacy-fixtures/types/fixtures/tuple-optional/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-rest/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-type/fixture.ts", + "legacy-fixtures/types/fixtures/tuple/fixture.ts", + "legacy-fixtures/types/fixtures/type-literal/fixture.ts", + "legacy-fixtures/types/fixtures/type-operator/fixture.ts", "legacy-fixtures/types/fixtures/typeof-this/fixture.ts", + "legacy-fixtures/types/fixtures/typeof-with-type-parameters/fixture.ts", + "legacy-fixtures/types/fixtures/typeof/fixture.ts", "legacy-fixtures/types/fixtures/union-intersection/fixture.ts", + "legacy-fixtures/types/fixtures/union-type/fixture.ts", "special/TSTypeParameter/fixtures/arrow-const-modifier-extends/fixture.ts", "special/TSTypeParameter/fixtures/arrow-const-modifier/fixture.ts", "special/TSTypeParameter/fixtures/class-decl-const-in-modifier/fixture.ts", @@ -260,5 +461,5 @@ Set { "special/TSTypeParameter/fixtures/interface-const-modifier/fixture.ts", "special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/fixture.ts", "special/TSTypeParameter/fixtures/method-const-modifiers/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 bdb34fe6b4b..3baa5a85efc 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -2,11 +2,10 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` { - "Babel errored but TSESTree didn't": Set { + "Babel errored but TSESTree didn't": [ "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/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/assertion/fixture.ts", "declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/fixture.ts", "declaration/TSDeclareFunction/fixtures/_error_/async/fixture.ts", @@ -18,17 +17,10 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "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", "element/AccessorProperty/fixtures/_error_/modifier-override-with-no-extends/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-static-constructor/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-override-property/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/abstract-interface/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/await-without-async-function/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-private-identifier-field-with-accessibility-error/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-constructor-and-type-parameters/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/class-with-export-parameter-properties/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/class-with-implements-and-extends/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/class-with-static-parameter-properties/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/class-with-two-methods-computed-constructor/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/const-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-number/fixture.ts", @@ -36,17 +28,8 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "legacy-fixtures/basics/fixtures/_error_/export-named-enum-computed-var-ref/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/export-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/import-type-error/fixture.ts", - "legacy-fixtures/basics/fixtures/_error_/interface-with-construct-signature-with-parameter-accessibility/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/new-target-in-arrow-function-body/fixture.ts", "legacy-fixtures/basics/fixtures/_error_/var-with-definite-assignment/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends-implements/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/class-empty-extends/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/class-extends-empty-implements/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/class-multiple-implements/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-enum-declaration/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-function/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-interface-declaration/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/decorator-on-variable/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-call-expression/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments-in-new-expression/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-arguments/fixture.ts", @@ -56,39 +39,19 @@ exports[`AST Fixtures List fixtures with Error differences 1`] = ` "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method-signature/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters-in-method/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/empty-type-parameters/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/enum-with-keywords/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/index-signature-parameters/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-empty-extends/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-implements/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-export/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-private/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-protected/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-public/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-index-signature-static/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-export/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-private/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-protected/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-public/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-readonly/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-method-static/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-multiple-extends/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-export/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-private/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-protected/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-public/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-static/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/interface-property-with-default-value/fixture.ts", "legacy-fixtures/errorRecovery/fixtures/_error_/interface-with-optional-index-signature/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/object-assertion-not-allowed/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/object-optional-not-allowed/fixture.ts", - "legacy-fixtures/errorRecovery/fixtures/_error_/solo-const/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-array-pattern-decorator/fixture.ts", "legacy-fixtures/parameter-decorators/fixtures/_error_/parameter-rest-element-decorator/fixture.ts", - }, - "TSESTree errored but Babel didn't": Set { + ], + "TSESTree errored but Babel didn't": [ "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts", + "element/AccessorProperty/fixtures/_error_/modifier-abstract-accessor-with-value/fixture.ts", + "legacy-fixtures/basics/fixtures/_error_/abstract-class-with-abstract-constructor/fixture.ts", "legacy-fixtures/expressions/fixtures/_error_/instantiation-expression/fixture.ts", - }, + ], } `; diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index 7a512bf413c..b15734b809f 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`AST Fixtures List fixtures with Token differences 1`] = ` -Set { +[ "declaration/ClassDeclaration/fixtures/implements-many/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-one/fixture.ts", "declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts", @@ -26,6 +26,8 @@ Set { "element/AccessorProperty/fixtures/modifier-private/fixture.ts", "element/AccessorProperty/fixtures/modifier-protected/fixture.ts", "element/AccessorProperty/fixtures/modifier-public/fixture.ts", + "jsx/JSXNamespacedName/fixtures/component-dashed/fixture.tsx", + "jsx/JSXNamespacedName/fixtures/component/fixture.tsx", "legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/fixture.ts", "legacy-fixtures/basics/fixtures/async-function-with-var-declaration/fixture.ts", @@ -129,5 +131,5 @@ Set { "special/TSTypeParameter/fixtures/interface-const-modifier-multiple/fixture.ts", "special/TSTypeParameter/fixtures/interface-const-modifier/fixture.ts", "special/TSTypeParameter/fixtures/interface-in-const-modifier-multiple/fixture.ts", -} +] `; diff --git a/packages/ast-spec/tests/fixtures-without-babel-support.shot b/packages/ast-spec/tests/fixtures-without-babel-support.shot index 0ecfffa63d0..d2037dc15b3 100644 --- a/packages/ast-spec/tests/fixtures-without-babel-support.shot +++ b/packages/ast-spec/tests/fixtures-without-babel-support.shot @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures List fixtures we expect babel to not support 1`] = `Map {}`; +exports[`AST Fixtures List fixtures we expect babel to not support 1`] = `[]`; diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts index df70fe613eb..55fcebf6104 100644 --- a/packages/ast-spec/tests/fixtures.test.ts +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -1,5 +1,5 @@ import fs from 'fs'; -import glob from 'glob'; +import glob = require('glob'); import makeDir from 'make-dir'; import path from 'path'; @@ -12,6 +12,7 @@ import type { } from './util/parsers/parser-types'; import { ParserResponseType } from './util/parsers/parser-types'; import { parseTSESTree } from './util/parsers/typescript-estree'; +import { serializeError } from './util/serialize-error'; import { diffHasChanges, snapshotDiff } from './util/snapshot-diff'; const PACKAGE_ROOT = path.resolve(__dirname, '..'); @@ -38,10 +39,18 @@ const fixturesWithErrorDifferences = { } as const; const VALID_FIXTURES: readonly string[] = glob.sync( - `${SRC_DIR}/**/fixtures/*/fixture.{ts,tsx}`, + `**/fixtures/*/fixture.{ts,tsx}`, + { + cwd: SRC_DIR, + absolute: true, + }, ); const ERROR_FIXTURES: readonly string[] = glob.sync( - `${SRC_DIR}/**/fixtures/_error_/*/fixture.{ts,tsx}`, + `**/fixtures/_error_/*/fixture.{ts,tsx}`, + { + cwd: SRC_DIR, + absolute: true, + }, ); const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map( @@ -66,7 +75,7 @@ const FIXTURES: readonly Fixture[] = [...VALID_FIXTURES, ...ERROR_FIXTURES].map( isError: absolute.includes('/_error_/'), isJSX: ext.endsWith('x'), name, - relative: path.relative(SRC_DIR, absolute), + relative: path.relative(SRC_DIR, absolute).replace(/\\/g, '/'), segments, snapshotFiles: { success: { @@ -163,7 +172,9 @@ function nestDescribe(fixture: Fixture, segments = fixture.segments): void { } it('TSESTree - Error', () => { - expect(tsestreeParsed.error).toMatchSpecificSnapshot( + expect( + serializeError(tsestreeParsed.error, contents), + ).toMatchSpecificSnapshot( fixture.snapshotFiles.error.tsestree(snapshotCounter++), ); }); @@ -326,22 +337,35 @@ describe('AST Fixtures', () => { // once we've run all the tests, snapshot the list of fixtures that have differences for easy reference it('List fixtures with AST differences', () => { - expect(fixturesWithASTDifferences).toMatchSpecificSnapshot( + expect( + Array.from(fixturesWithASTDifferences).sort(), + ).toMatchSpecificSnapshot( path.resolve(__dirname, 'fixtures-with-differences-ast.shot'), ); }); it('List fixtures with Token differences', () => { - expect(fixturesWithTokenDifferences).toMatchSpecificSnapshot( + expect( + Array.from(fixturesWithTokenDifferences).sort(), + ).toMatchSpecificSnapshot( path.resolve(__dirname, 'fixtures-with-differences-tokens.shot'), ); }); it('List fixtures with Error differences', () => { - expect(fixturesWithErrorDifferences).toMatchSpecificSnapshot( + expect( + Object.fromEntries( + Object.entries(fixturesWithErrorDifferences).map(([key, value]) => [ + key, + Array.from(value).sort(), + ]), + ), + ).toMatchSpecificSnapshot( path.resolve(__dirname, 'fixtures-with-differences-errors.shot'), ); }); it('List fixtures we expect babel to not support', () => { - expect(fixturesConfiguredToExpectBabelToNotSupport).toMatchSpecificSnapshot( + expect( + Array.from(fixturesConfiguredToExpectBabelToNotSupport).sort(), + ).toMatchSpecificSnapshot( path.resolve(__dirname, 'fixtures-without-babel-support.shot'), ); }); diff --git a/packages/ast-spec/tests/util/parsers/babel.ts b/packages/ast-spec/tests/util/parsers/babel.ts index 5e874be85af..37ad64aeb4a 100644 --- a/packages/ast-spec/tests/util/parsers/babel.ts +++ b/packages/ast-spec/tests/util/parsers/babel.ts @@ -1,10 +1,10 @@ -import type { ParserPlugin } from '@babel/eslint-parser'; +import type { ParserOptions } from '@babel/core'; import { parse } from '@babel/eslint-parser'; import type { Fixture, ParserResponse } from './parser-types'; import { ParserResponseType } from './parser-types'; -const PLUGINS: ParserPlugin[] = [ +const PLUGINS: NonNullable = [ 'decoratorAutoAccessors', // TODO - enable classFeatures instead of classProperties when we support it // 'classFeatures', diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts index 4538d8ed4a9..496ba192236 100644 --- a/packages/ast-spec/tests/util/parsers/parser-types.ts +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -45,4 +45,4 @@ export interface ParserResponseError { readonly type: ParserResponseType.Error; readonly error: unknown; } -export type ParserResponse = ParserResponseSuccess | ParserResponseError; +export type ParserResponse = ParserResponseError | ParserResponseSuccess; diff --git a/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts b/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts index c04f3d12ae2..a517c0eed31 100644 --- a/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts +++ b/packages/ast-spec/tests/util/parsers/typescript-estree-import.ts @@ -13,6 +13,5 @@ * This should be the only place in the package that we import from typescript-estree. */ -// We need to ignore this lint error regarding it being missing from the package.json, see above. -// eslint-disable-next-line import/no-extraneous-dependencies -export { parse } from '@typescript-eslint/typescript-estree'; +// eslint-disable-next-line no-restricted-imports -- the only safe and valid import from typescript-estree in this package +export { parse, TSError } from '@typescript-eslint/typescript-estree'; diff --git a/packages/ast-spec/tests/util/parsers/typescript-estree.ts b/packages/ast-spec/tests/util/parsers/typescript-estree.ts index 6cfe656f4bf..e73330a2f57 100644 --- a/packages/ast-spec/tests/util/parsers/typescript-estree.ts +++ b/packages/ast-spec/tests/util/parsers/typescript-estree.ts @@ -8,10 +8,12 @@ export function parseTSESTree( ): ParserResponse { try { const result = parse(contents, { + allowInvalidAST: fixture.config.allowInvalidAST, comment: false, jsx: fixture.ext.endsWith('x'), loc: true, range: true, + suppressDeprecatedPropertyWarnings: true, tokens: true, }); const { tokens: _, comments: __, ...program } = result; diff --git a/packages/ast-spec/tests/util/serialize-error.ts b/packages/ast-spec/tests/util/serialize-error.ts new file mode 100644 index 00000000000..5906c6e0ee7 --- /dev/null +++ b/packages/ast-spec/tests/util/serialize-error.ts @@ -0,0 +1,28 @@ +import { codeFrameColumns } from '@babel/code-frame'; + +import { TSError } from './parsers/typescript-estree-import'; + +export function serializeError(error: unknown, contents: string): unknown { + if (!(error instanceof TSError)) { + return error; + } + + const { + name, + message, + location: { start, end }, + } = error; + + return ( + name + + '\n' + + codeFrameColumns( + contents, + { + start: { line: start.line, column: start.column + 1 }, + end: { line: end.line, column: end.column + 1 }, + }, + { highlightCode: false, message }, + ) + ); +} diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json index 89b0284199a..2812814bb30 100644 --- a/packages/ast-spec/tsconfig.build.json +++ b/packages/ast-spec/tsconfig.build.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "composite": true, + "jsx": "preserve", "outDir": "./dist", "rootDir": "./src", "resolveJsonModule": true diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json index 35ae2aa3a17..e9ea868f11b 100644 --- a/packages/ast-spec/tsconfig.json +++ b/packages/ast-spec/tsconfig.json @@ -4,14 +4,7 @@ "composite": false, "rootDir": "." }, - "include": [ - "src", - "typings", - "tests", - "tools", - "./rollup.config.ts", - "**/fixtures/**/config.ts" - ], + "include": ["src", "typings", "tests", "tools", "**/fixtures/**/config.ts"], "exclude": ["**/fixtures/**/fixture.ts"], "references": [{ "path": "../typescript-estree/tsconfig.build.json" }] } diff --git a/packages/ast-spec/typings/global.d.ts b/packages/ast-spec/typings/global.d.ts index 4464c06fbcf..7dd0713ea5d 100644 --- a/packages/ast-spec/typings/global.d.ts +++ b/packages/ast-spec/typings/global.d.ts @@ -4,6 +4,12 @@ * This is a convenient property because it saves us from a lot of `../`! */ interface ASTFixtureConfig { + /** + * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. + * This case only usually occurs when attempting to lint invalid code. + */ + readonly allowInvalidAST?: boolean; + /** * Specifies that we expect that babel doesn't yet support the code in this fixture, so we expect that it will error. * This should not be used if we expect babel to throw for this feature due to a valid parser error! diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index aaea63583ca..4fc91a03b5f 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,180 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Features + +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove `RuleTester` in `/utils` in favour of the new `/rule-tester` package ([#6816](https://github.com/typescript-eslint/typescript-eslint/issues/6816)) ([c33f497](https://github.com/typescript-eslint/typescript-eslint/commit/c33f497ad8aec7c123c7374f7aff3e24025fe861)) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 44c57e36fb9..1dbfdbdddea 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.56.0", + "version": "6.0.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,9 +14,10 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/type-utils": "5.56.0", - "@typescript-eslint/utils": "5.56.0", + "@typescript-eslint/rule-tester": "6.0.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/type-utils": "6.0.0", + "@typescript-eslint/utils": "6.0.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json index e7ac6302d69..0aad8a17fa7 100644 --- a/packages/eslint-plugin-internal/project.json +++ b/packages/eslint-plugin-internal/project.json @@ -5,10 +5,13 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/eslint-plugin-internal/**/*.ts"] + "lintFilePatterns": [ + "packages/eslint-plugin-internal/**/*.{mts,cts,ts,tsx}" + ], + "ignorePath": ".eslintignore" } } } diff --git a/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts b/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts index 0c671d8432f..7b34aa0fd26 100644 --- a/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts +++ b/packages/eslint-plugin-internal/src/rules/no-poorly-typed-ts-props.ts @@ -36,7 +36,7 @@ export default createRule({ docs: { description: "Enforce that rules don't use TS API properties with known bad type definitions", - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, fixable: 'code', @@ -51,9 +51,7 @@ export default createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); - const checker = program.getTypeChecker(); + const services = ESLintUtils.getParserServices(context); return { 'MemberExpression[computed = false]'( @@ -65,15 +63,13 @@ export default createRule({ } // make sure the type name matches - const tsObjectNode = esTreeNodeToTSNodeMap.get(node.object); - const objectType = checker.getTypeAtLocation(tsObjectNode); + const objectType = services.getTypeAtLocation(node.object); const objectSymbol = objectType.getSymbol(); if (objectSymbol?.getName() !== banned.type) { continue; } - const tsNode = esTreeNodeToTSNodeMap.get(node.property); - const symbol = checker.getSymbolAtLocation(tsNode); + const symbol = services.getSymbolAtLocation(node.property); const decls = symbol?.getDeclarations(); const isFromTs = decls?.some(decl => decl.getSourceFile().fileName.includes('/node_modules/typescript/'), diff --git a/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts b/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts index fd7279c3823..8c4676a32ad 100644 --- a/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts +++ b/packages/eslint-plugin-internal/src/rules/no-typescript-default-import.ts @@ -21,7 +21,7 @@ export default createRule({ docs: { description: "Enforce that packages rules don't do `import ts from 'typescript';`", - recommended: 'error', + recommended: 'recommended', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts b/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts index 28f7439472b..758328efe21 100644 --- a/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts +++ b/packages/eslint-plugin-internal/src/rules/no-typescript-estree-import.ts @@ -16,7 +16,7 @@ export default createRule({ type: 'problem', docs: { description: `Enforce that eslint-plugin rules don't require anything from ${TSESTREE_NAME} or ${TYPES_NAME}`, - recommended: 'error', + recommended: 'recommended', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts index 313a32eea5b..be81846a116 100644 --- a/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts +++ b/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts @@ -67,7 +67,7 @@ function doIndent(line: string, indent: number): string { return line; } -function getQuote(code: string): "'" | '"' | null { +function getQuote(code: string): '"' | "'" | null { const hasSingleQuote = code.includes("'"); const hasDoubleQuote = code.includes('"'); if (hasSingleQuote && hasDoubleQuote) { @@ -95,12 +95,12 @@ type Options = [ type MessageIds = | 'invalidFormatting' | 'invalidFormattingErrorTest' + | 'prettierException' | 'singleLineQuotes' | 'templateLiteralEmptyEnds' | 'templateLiteralLastLineIndent' - | 'templateStringRequiresIndent' | 'templateStringMinimumIndent' - | 'prettierException'; + | 'templateStringRequiresIndent'; export default createRule({ name: 'plugin-test-formatting', @@ -108,7 +108,7 @@ export default createRule({ type: 'problem', docs: { description: `Enforce that eslint-plugin test snippets are correctly formatted`, - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, fixable: 'code', @@ -148,9 +148,8 @@ export default createRule({ ], create(context, [{ formatWithPrettier }]) { const sourceCode = context.getSourceCode(); - const { program, esTreeNodeToTSNodeMap } = - ESLintUtils.getParserServices(context); - const checker = program.getTypeChecker(); + const services = ESLintUtils.getParserServices(context); + const checker = services.program.getTypeChecker(); const checkedObjects = new Set(); @@ -522,14 +521,14 @@ export default createRule({ const type = getContextualType( checker, - esTreeNodeToTSNodeMap.get(node), + services.esTreeNodeToTSNodeMap.get(node), ); if (!type) { return; } const typeString = checker.typeToString(type); - if (/^RunTests\b/.test(typeString)) { + if (/^(TSESLint\.)?RunTests\b/.test(typeString)) { checkedObjects.add(node); for (const prop of node.properties) { @@ -559,12 +558,12 @@ export default createRule({ return; } - if (/^ValidTestCase\b/.test(typeString)) { + if (/^(TSESLint\.)?ValidTestCase\b/.test(typeString)) { checkInvalidTest(node); return; } - if (/^InvalidTestCase\b/.test(typeString)) { + if (/^(TSESLint\.)?InvalidTestCase\b/.test(typeString)) { checkInvalidTest(node); for (const testProp of node.properties) { if ( diff --git a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts index 4099e2f02be..e042f328614 100755 --- a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts +++ b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts @@ -13,7 +13,7 @@ export default createRule({ meta: { type: 'problem', docs: { - recommended: 'error', + recommended: 'recommended', description: 'Enforce consistent usage of `AST_NODE_TYPES`, `AST_TOKEN_TYPES` and `DefinitionType` enums', }, diff --git a/packages/eslint-plugin-internal/tests/RuleTester.ts b/packages/eslint-plugin-internal/tests/RuleTester.ts index 260e222194b..f56f93ee81f 100644 --- a/packages/eslint-plugin-internal/tests/RuleTester.ts +++ b/packages/eslint-plugin-internal/tests/RuleTester.ts @@ -1,10 +1,8 @@ -import { ESLintUtils } from '@typescript-eslint/utils'; import path from 'path'; function getFixturesRootDir(): string { return path.join(__dirname, 'fixtures'); } -const { batchedSingleLineTests, RuleTester } = ESLintUtils; - -export { RuleTester, batchedSingleLineTests, getFixturesRootDir }; +export { RuleTester } from '@typescript-eslint/rule-tester'; +export { getFixturesRootDir }; diff --git a/packages/eslint-plugin-internal/tests/rules/no-poorly-typed-ts-props.test.ts b/packages/eslint-plugin-internal/tests/rules/no-poorly-typed-ts-props.test.ts index b0b80f56cc3..5e75c5e2b7e 100644 --- a/packages/eslint-plugin-internal/tests/rules/no-poorly-typed-ts-props.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/no-poorly-typed-ts-props.test.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-poorly-typed-ts-props'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts b/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts index 35d2f13d329..45590e5012d 100644 --- a/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/no-typescript-default-import.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-typescript-default-import'; -import { batchedSingleLineTests, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -16,30 +17,21 @@ ruleTester.run('no-typescript-default-import', rule, { 'import ts = foo;', "import ts = require('nottypescript');", ], - invalid: batchedSingleLineTests({ - code: ` -import ts from 'typescript'; -import ts, { SyntaxKind } from 'typescript'; -import ts = require('typescript'); - `, - output: ` -import * as ts from 'typescript'; -import ts, { SyntaxKind } from 'typescript'; -import * as ts from 'typescript'; - `, - errors: [ - { - messageId: 'noTSDefaultImport', - line: 2, - }, - { - messageId: 'noTSDefaultImport', - line: 3, - }, - { - messageId: 'noTSDefaultImport', - line: 4, - }, - ], - }), + invalid: [ + { + code: "import ts from 'typescript';", + output: `import * as ts from 'typescript';`, + errors: [{ messageId: 'noTSDefaultImport' }], + }, + { + code: "import ts, { SyntaxKind } from 'typescript';", + output: null, + errors: [{ messageId: 'noTSDefaultImport' }], + }, + { + code: "import ts = require('typescript');", + output: `import * as ts from 'typescript';`, + errors: [{ messageId: 'noTSDefaultImport' }], + }, + ], }); diff --git a/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts b/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts index 1cde420e337..46eb2edabbe 100644 --- a/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-typescript-estree-import'; -import { batchedSingleLineTests, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -14,48 +15,36 @@ ruleTester.run('no-typescript-estree-import', rule, { "import foo from '@typescript-eslint/utils';", "import * as foo from '@typescript-eslint/utils';", ], - invalid: batchedSingleLineTests({ - code: ` -import { foo } from '@typescript-eslint/typescript-estree'; -import foo from '@typescript-eslint/typescript-estree'; -import * as foo from '@typescript-eslint/typescript-estree'; -import { foo } from '@typescript-eslint/types'; -import foo from '@typescript-eslint/types'; -import * as foo from '@typescript-eslint/types'; - `, - output: ` -import { foo } from '@typescript-eslint/utils'; -import foo from '@typescript-eslint/utils'; -import * as foo from '@typescript-eslint/utils'; -import { foo } from '@typescript-eslint/utils'; -import foo from '@typescript-eslint/utils'; -import * as foo from '@typescript-eslint/utils'; - `, - errors: [ - { - messageId: 'dontImportPackage', - line: 2, - }, - { - messageId: 'dontImportPackage', - line: 3, - }, - { - messageId: 'dontImportPackage', - line: 4, - }, - { - messageId: 'dontImportPackage', - line: 5, - }, - { - messageId: 'dontImportPackage', - line: 6, - }, - { - messageId: 'dontImportPackage', - line: 7, - }, - ], - }), + invalid: [ + { + code: "import { foo } from '@typescript-eslint/typescript-estree';", + output: "import { foo } from '@typescript-eslint/utils';", + errors: [{ messageId: 'dontImportPackage' }], + }, + { + code: "import foo from '@typescript-eslint/typescript-estree';", + output: "import foo from '@typescript-eslint/utils';", + errors: [{ messageId: 'dontImportPackage' }], + }, + { + code: "import * as foo from '@typescript-eslint/typescript-estree';", + output: "import * as foo from '@typescript-eslint/utils';", + errors: [{ messageId: 'dontImportPackage' }], + }, + { + code: "import { foo } from '@typescript-eslint/types';", + output: "import { foo } from '@typescript-eslint/utils';", + errors: [{ messageId: 'dontImportPackage' }], + }, + { + code: "import foo from '@typescript-eslint/types';", + output: "import foo from '@typescript-eslint/utils';", + errors: [{ messageId: 'dontImportPackage' }], + }, + { + code: "import * as foo from '@typescript-eslint/types';", + output: "import * as foo from '@typescript-eslint/utils';", + errors: [{ messageId: 'dontImportPackage' }], + }, + ], }); diff --git a/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts b/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts index f5745996d38..f9dee0411ab 100644 --- a/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/plugin-test-formatting.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/plugin-test-formatting'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts b/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts index ea162462ca6..44f9f6118ba 100644 --- a/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts @@ -1,8 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { DefinitionType } from '@typescript-eslint/scope-manager'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/prefer-ast-types-enum'; -import { batchedSingleLineTests, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -29,33 +29,42 @@ ruleTester.run('prefer-ast-types-enum', rule, { } `, ], - invalid: batchedSingleLineTests({ - code: ` -node.type === 'Literal'; -node.type === 'Keyword'; -node.type === 'Parameter'; - `, - output: ` -node.type === AST_NODE_TYPES.Literal; -node.type === AST_TOKEN_TYPES.Keyword; -node.type === DefinitionType.Parameter; - `, - errors: [ - { - data: { enumName: 'AST_NODE_TYPES', literal: AST_NODE_TYPES.Literal }, - messageId: 'preferEnum', - line: 2, - }, - { - data: { enumName: 'AST_TOKEN_TYPES', literal: AST_TOKEN_TYPES.Keyword }, - messageId: 'preferEnum', - line: 3, - }, - { - data: { enumName: 'DefinitionType', literal: DefinitionType.Parameter }, - messageId: 'preferEnum', - line: 4, - }, - ], - }), + invalid: [ + { + code: "node.type === 'Literal';", + output: 'node.type === AST_NODE_TYPES.Literal;', + errors: [ + { + data: { enumName: 'AST_NODE_TYPES', literal: AST_NODE_TYPES.Literal }, + messageId: 'preferEnum', + }, + ], + }, + { + code: "node.type === 'Keyword';", + output: 'node.type === AST_TOKEN_TYPES.Keyword;', + errors: [ + { + data: { + enumName: 'AST_TOKEN_TYPES', + literal: AST_TOKEN_TYPES.Keyword, + }, + messageId: 'preferEnum', + }, + ], + }, + { + code: "node.type === 'Parameter';", + output: 'node.type === DefinitionType.Parameter;', + errors: [ + { + data: { + enumName: 'DefinitionType', + literal: DefinitionType.Parameter, + }, + messageId: 'preferEnum', + }, + ], + }, + ], }); diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 2d72dc3d18a..46def434875 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,203 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) + + +### BREAKING CHANGES + +* drop support for ESLint v6 +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/README.md b/packages/eslint-plugin-tslint/README.md index 57c414230ec..d02ff879760 100644 --- a/packages/eslint-plugin-tslint/README.md +++ b/packages/eslint-plugin-tslint/README.md @@ -5,6 +5,8 @@ [![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint) [![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/eslint-plugin-tslint.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin-tslint) -👉 See **https://typescript-eslint.io/architecture/eslint-plugin-tslint** for documentation on this package. +👉 See **https://typescript-eslint.io/packages/eslint-plugin-tslint** for documentation on this package. > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index a29cb347ea0..4a794f7d032 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,24 +1,26 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "5.56.0", + "version": "6.0.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "ESLint plugin that wraps a TSLint configuration and lints the whole source using TSLint", - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin", - "tslint" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -28,6 +30,12 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "tslint" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "clean": "tsc -b tsconfig.build.json --clean", @@ -38,16 +46,18 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.56.0", - "lodash": "^4.17.21" + "@typescript-eslint/utils": "6.0.0" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0", + "eslint": "^7.0.0 || ^8.0.0", "tslint": "^5.0.0 || ^6.0.0", "typescript": "*" }, "devDependencies": { - "@types/lodash": "*", - "@typescript-eslint/parser": "5.56.0" + "@typescript-eslint/parser": "6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } diff --git a/packages/eslint-plugin-tslint/project.json b/packages/eslint-plugin-tslint/project.json index 29bcb865041..b69d03550d0 100644 --- a/packages/eslint-plugin-tslint/project.json +++ b/packages/eslint-plugin-tslint/project.json @@ -5,10 +5,13 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/eslint-plugin-tslint/**/*.ts"] + "lintFilePatterns": [ + "packages/eslint-plugin-tslint/**/*.{mts,cts,ts,tsx}" + ], + "ignorePath": ".eslintignore" } } } diff --git a/packages/eslint-plugin-tslint/src/rules/config.ts b/packages/eslint-plugin-tslint/src/rules/config.ts index 97b77e7d080..23b7558b80f 100644 --- a/packages/eslint-plugin-tslint/src/rules/config.ts +++ b/packages/eslint-plugin-tslint/src/rules/config.ts @@ -1,10 +1,28 @@ import { ESLintUtils } from '@typescript-eslint/utils'; -import memoize from 'lodash/memoize'; +import path from 'path'; import type { RuleSeverity } from 'tslint'; import { Configuration } from 'tslint'; import { CustomLinter } from '../custom-linter'; +function memoize unknown>( + func: T, + resolver: (...args: Parameters) => string, +): T { + const cache = new Map>(); + const memoized = function (...args) { + const key = resolver(...(args as Parameters)); + + if (cache.has(key)) { + return cache.get(key)!; + } + const result = func(...args); + cache.set(key, result as ReturnType); + return result; + } as T; + return memoized; +} + // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const version: string = require('../../package.json'); @@ -15,14 +33,14 @@ const createRule = ESLintUtils.RuleCreator( ); export type RawRulesConfig = Record< string, - | null - | undefined - | boolean | unknown[] + | boolean | { - severity?: RuleSeverity | 'warn' | 'none' | 'default'; + severity?: RuleSeverity | 'default' | 'none' | 'warn'; options?: unknown; } + | null + | undefined >; export type MessageIds = 'failure'; @@ -65,7 +83,6 @@ export default createRule({ docs: { description: 'Wraps a TSLint configuration and lints the whole source using TSLint', // eslint-disable-line eslint-plugin/require-meta-docs-description - recommended: false, }, fixable: 'code', type: 'problem', @@ -102,10 +119,10 @@ export default createRule({ context, [{ rules: tslintRules, rulesDirectory: tslintRulesDirectory, lintFile }], ) { - const fileName = context.getFilename(); + const fileName = path.resolve(context.getCwd(), context.getFilename()); const sourceCode = context.getSourceCode().text; - const parserServices = ESLintUtils.getParserServices(context); - const program = parserServices.program; + const services = ESLintUtils.getParserServices(context); + const program = services.program; /** * Create an instance of TSLint diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/4.ts b/packages/eslint-plugin-tslint/tests/fixture-project/4.ts deleted file mode 100644 index 1ca8bbace36..00000000000 --- a/packages/eslint-plugin-tslint/tests/fixture-project/4.ts +++ /dev/null @@ -1 +0,0 @@ -var foo = true // semicolon diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/1.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/1.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/fixture-project/1.ts rename to packages/eslint-plugin-tslint/tests/fixtures/fixture-project/1.ts diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/2.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/2.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/fixture-project/2.ts rename to packages/eslint-plugin-tslint/tests/fixtures/fixture-project/2.ts diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/3.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/3.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/fixture-project/3.ts rename to packages/eslint-plugin-tslint/tests/fixtures/fixture-project/3.ts diff --git a/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts new file mode 100644 index 00000000000..e1173e87a22 --- /dev/null +++ b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/4.ts @@ -0,0 +1 @@ +var foo = true; // semicolon diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/5.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/5.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/fixture-project/5.ts rename to packages/eslint-plugin-tslint/tests/fixtures/fixture-project/5.ts diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/6.ts b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/6.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/fixture-project/6.ts rename to packages/eslint-plugin-tslint/tests/fixtures/fixture-project/6.ts diff --git a/packages/eslint-plugin-tslint/tests/fixture-project/tsconfig.json b/packages/eslint-plugin-tslint/tests/fixtures/fixture-project/tsconfig.json similarity index 100% rename from packages/eslint-plugin-tslint/tests/fixture-project/tsconfig.json rename to packages/eslint-plugin-tslint/tests/fixtures/fixture-project/tsconfig.json diff --git a/packages/eslint-plugin-tslint/tests/test-project/extra.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/extra.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/extra.ts rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/extra.ts diff --git a/packages/eslint-plugin-tslint/tests/test-project/file-spec.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/file-spec.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/file-spec.ts rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/file-spec.ts diff --git a/packages/eslint-plugin-tslint/tests/test-project/file.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/file.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/file.ts rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/file.ts diff --git a/packages/eslint-plugin-tslint/tests/test-project/source.ts b/packages/eslint-plugin-tslint/tests/fixtures/test-project/source.ts similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/source.ts rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/source.ts diff --git a/packages/eslint-plugin-tslint/tests/test-project/tsconfig-files.json b/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig-files.json similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/tsconfig-files.json rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig-files.json diff --git a/packages/eslint-plugin-tslint/tests/test-project/tsconfig.json b/packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig.json similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/tsconfig.json rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/tsconfig.json diff --git a/packages/eslint-plugin-tslint/tests/test-project/tslint.json b/packages/eslint-plugin-tslint/tests/fixtures/test-project/tslint.json similarity index 100% rename from packages/eslint-plugin-tslint/tests/test-project/tslint.json rename to packages/eslint-plugin-tslint/tests/fixtures/test-project/tslint.json diff --git a/packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js b/packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js similarity index 83% rename from packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js rename to packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js index 2d923f2e41f..76537897f03 100644 --- a/packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js +++ b/packages/eslint-plugin-tslint/tests/fixtures/test-tslint-rules-directory/alwaysFailRule.js @@ -1,10 +1,9 @@ - const Lint = require('tslint'); class Rule extends Lint.Rules.AbstractRule { apply(sourceFile) { return this.applyWithWalker( - new AlwaysFailWalker(sourceFile, this.getOptions()) + new AlwaysFailWalker(sourceFile, this.getOptions()), ); } } @@ -12,7 +11,7 @@ class Rule extends Lint.Rules.AbstractRule { class AlwaysFailWalker extends Lint.RuleWalker { visitSourceFile(node) { this.addFailure( - this.createFailure(node.getStart(), node.getWidth(), 'failure') + this.createFailure(node.getStart(), node.getWidth(), 'failure'), ); } } diff --git a/packages/eslint-plugin-tslint/tests/index.spec.ts b/packages/eslint-plugin-tslint/tests/index.spec.ts index 6c0d8cdf994..238cc318506 100644 --- a/packages/eslint-plugin-tslint/tests/index.spec.ts +++ b/packages/eslint-plugin-tslint/tests/index.spec.ts @@ -1,7 +1,10 @@ -import { TSESLint } from '@typescript-eslint/utils'; import * as parser from '@typescript-eslint/parser'; +import { TSESLint } from '@typescript-eslint/utils'; import { readFileSync } from 'fs'; -import rule, { Options } from '../src/rules/config'; +import path = require('path'); + +import type { Options } from '../src/rules/config'; +import rule from '../src/rules/config'; const ruleTester = new TSESLint.RuleTester({ parserOptions: { @@ -12,7 +15,7 @@ const ruleTester = new TSESLint.RuleTester({ * Project is needed to generate the parserServices * within @typescript-eslint/parser */ - project: './tests/fixture-project/tsconfig.json', + project: './tests/fixtures/fixture-project/tsconfig.json', warnOnUnsupportedTypeScriptVersion: false, }, parser: require.resolve('@typescript-eslint/parser'), @@ -34,7 +37,7 @@ const tslintRulesConfig: Options = [ */ const tslintRulesDirectoryConfig: Options = [ { - rulesDirectory: ['./tests/test-tslint-rules-directory'], + rulesDirectory: ['./tests/fixtures/test-tslint-rules-directory'], rules: { 'always-fail': { severity: 'error', @@ -43,37 +46,44 @@ const tslintRulesDirectoryConfig: Options = [ }, ]; +const TEST_PROJECT_PATH = path.resolve( + __dirname, + 'fixtures', + 'test-project', + 'tsconfig.json', +); + ruleTester.run('tslint/config', rule, { valid: [ { code: 'var foo = true;', options: tslintRulesConfig, - filename: './tests/fixture-project/1.ts', + filename: './tests/fixtures/fixture-project/1.ts', }, { - filename: './tests/test-project/file-spec.ts', - code: readFileSync('./tests/test-project/file-spec.ts', 'utf8').replace( - /\n/g, - ' ', - ), + filename: './tests/fixtures/test-project/file-spec.ts', + code: readFileSync( + './tests/fixtures/test-project/file-spec.ts', + 'utf8', + ).replace(/\n/g, ' '), parserOptions: { - project: `${__dirname}/test-project/tsconfig.json`, + project: TEST_PROJECT_PATH, }, options: tslintRulesConfig, }, { code: 'throw "should be ok because rule is not loaded";', options: tslintRulesConfig, - filename: './tests/fixture-project/2.ts', + filename: './tests/fixtures/fixture-project/2.ts', }, ], invalid: [ { - options: [{ lintFile: './tests/test-project/tslint.json' }], + options: [{ lintFile: './tests/fixtures/test-project/tslint.json' }], code: 'throw "err" // no-string-throw', output: 'throw new Error("err") // no-string-throw', - filename: './tests/fixture-project/3.ts', + filename: './tests/fixtures/fixture-project/3.ts', errors: [ { messageId: 'failure', @@ -89,7 +99,7 @@ ruleTester.run('tslint/config', rule, { code: 'var foo = true // semicolon', options: tslintRulesConfig, output: 'var foo = true; // semicolon', - filename: './tests/fixture-project/4.ts', + filename: './tests/fixtures/fixture-project/4.ts', errors: [ { messageId: 'failure', @@ -105,8 +115,8 @@ ruleTester.run('tslint/config', rule, { { code: 'var foo = true // fail', options: tslintRulesDirectoryConfig, - output: 'var foo = true // fail', - filename: './tests/fixture-project/5.ts', + output: null, + filename: './tests/fixtures/fixture-project/5.ts', errors: [ { messageId: 'failure', @@ -120,18 +130,22 @@ ruleTester.run('tslint/config', rule, { ], }, { - filename: './tests/test-project/source.ts', - code: readFileSync('./tests/test-project/source.ts', 'utf8').replace( - /\n/g, - ' ', - ), + filename: './tests/fixtures/test-project/source.ts', + code: readFileSync( + './tests/fixtures/test-project/source.ts', + 'utf8', + ).replace(/\n/g, ' '), parserOptions: { - project: `${__dirname}/test-project/tsconfig.json`, + project: TEST_PROJECT_PATH, }, options: [ { rulesDirectory: [ - `${__dirname}/../../../node_modules/tslint/lib/rules`, + path.join( + path.dirname(require.resolve('tslint/package.json')), + 'lib', + 'rules', + ), ], rules: { 'restrict-plus-operands': true }, }, @@ -173,7 +187,7 @@ describe('tslint/error', () => { it('should error on default parser', () => { testOutput('foo;', { parserOptions: { - project: `${__dirname}/test-project/tsconfig.json`, + project: TEST_PROJECT_PATH, }, rules: { 'tslint/config': [2, tslintRulesConfig], @@ -186,25 +200,33 @@ describe('tslint/error', () => { jest.spyOn(console, 'warn').mockImplementation(); linter.defineRule('tslint/config', rule); linter.defineParser('@typescript-eslint/parser', parser); + + const filePath = path.resolve( + __dirname, + 'fixtures', + 'test-project', + 'extra.ts', + ); + expect(() => linter.verify( 'foo;', { parserOptions: { - project: `${__dirname}/test-project/tsconfig.json`, + project: TEST_PROJECT_PATH, }, rules: { 'tslint/config': [2, {}], }, parser: '@typescript-eslint/parser', }, - `${__dirname}/test-project/extra.ts`, + filePath, ), ).not.toThrow(); expect(console.warn).toHaveBeenCalledWith( expect.stringContaining( - `Tried to lint ${__dirname}/test-project/extra.ts but found no valid, enabled rules for this file type and file path in the resolved configuration.`, + `Tried to lint ${filePath} but found no valid, enabled rules for this file type and file path in the resolved configuration.`, ), ); jest.resetAllMocks(); diff --git a/packages/eslint-plugin-tslint/tsconfig.build.json b/packages/eslint-plugin-tslint/tsconfig.build.json index ce8f56e7294..86650784975 100644 --- a/packages/eslint-plugin-tslint/tsconfig.build.json +++ b/packages/eslint-plugin-tslint/tsconfig.build.json @@ -1,6 +1,10 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + // specifically disable declarations for the plugin + // see reasoning in packages/eslint-plugin/rules.d.ts + "declaration": false, + "declarationMap": false, "outDir": "./dist", "rootDir": "./src", "resolveJsonModule": true diff --git a/packages/eslint-plugin-tslint/tsconfig.json b/packages/eslint-plugin-tslint/tsconfig.json index b2f22d5b95d..4ba17c6d60a 100644 --- a/packages/eslint-plugin-tslint/tsconfig.json +++ b/packages/eslint-plugin-tslint/tsconfig.json @@ -5,6 +5,6 @@ "rootDir": "." }, "include": ["src", "tests"], - "exclude": ["tests/test-project", "tests/test-tslint-rules-directory"], + "exclude": ["tests/fixtures"], "references": [{ "path": "../utils/tsconfig.build.json" }] } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 4443a498877..6fc0bf0c164 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,286 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* bumped ts-api-utils to 0.0.39 ([#6497](https://github.com/typescript-eslint/typescript-eslint/issues/6497)) ([217c710](https://github.com/typescript-eslint/typescript-eslint/commit/217c710d99445994b9c8db7b9bee9b9cc63bc4cb)) +* correct handling of additionalProperties in object schemas ([#6939](https://github.com/typescript-eslint/typescript-eslint/issues/6939)) ([489c7a5](https://github.com/typescript-eslint/typescript-eslint/commit/489c7a50ae99ef66df152a68fd447f7e42a23558)) +* correct lint error after merge ([277fdb5](https://github.com/typescript-eslint/typescript-eslint/commit/277fdb5ac76bd761ae6f5d1052445dcff2e848a1)) +* **eslint-plugin:** [explicit-module-boundary-types] remove shouldTrackReferences option from schema ([#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399)) ([6d32734](https://github.com/typescript-eslint/typescript-eslint/commit/6d32734b1312f60ee7d12d4bb19fc1cf52e7f0a5)) +* **eslint-plugin:** allow parser@^6.0.0 ([#6630](https://github.com/typescript-eslint/typescript-eslint/issues/6630)) ([92908bd](https://github.com/typescript-eslint/typescript-eslint/commit/92908bdd9c102ff599da6a4791e8ad3e6d3dc593)) +* **eslint-plugin:** remove valid-typeof disable in eslint-recommended ([#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381)) ([b82df5e](https://github.com/typescript-eslint/typescript-eslint/commit/b82df5eaed437727566cde2b53410001505f1b13)) +* fix illegal decorator check ([#6723](https://github.com/typescript-eslint/typescript-eslint/issues/6723)) ([c456f8c](https://github.com/typescript-eslint/typescript-eslint/commit/c456f8cdef5a931c631bfbcfc84d8a25caaf019f)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* replace tsutils with ts-api-tools ([#6428](https://github.com/typescript-eslint/typescript-eslint/issues/6428)) ([79327b4](https://github.com/typescript-eslint/typescript-eslint/commit/79327b4999999cde3003901b40527af002c4906a)) +* **type-utils:** treat intrinsic types as if they are from lib and never match error types ([#6869](https://github.com/typescript-eslint/typescript-eslint/issues/6869)) ([ecb57de](https://github.com/typescript-eslint/typescript-eslint/commit/ecb57de5eb50511bed163f6e1b27e31b8577344e)) +* **typescript-estree:** account for namespace nesting in AST conversion ([#6272](https://github.com/typescript-eslint/typescript-eslint/issues/6272)) ([09e3877](https://github.com/typescript-eslint/typescript-eslint/commit/09e38776c63fea3328f71df36644ee11dd137cc1)) +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* bump minimum supported TS version to 4.2.4 ([#5915](https://github.com/typescript-eslint/typescript-eslint/issues/5915)) ([a8e71d5](https://github.com/typescript-eslint/typescript-eslint/commit/a8e71d52169f32ab9e836ec96d980ba52deffe12)) +* bump ts-api-utils to v0.0.21 ([#6459](https://github.com/typescript-eslint/typescript-eslint/issues/6459)) ([3915661](https://github.com/typescript-eslint/typescript-eslint/commit/391566172dbc6013be79952fc68a588bf653fa8d)) +* bump ts-api-utils to v0.0.22 ([#6472](https://github.com/typescript-eslint/typescript-eslint/issues/6472)) ([b88cd23](https://github.com/typescript-eslint/typescript-eslint/commit/b88cd2332921efcca7ec5f4176f19779346d963b)) +* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-nullish-coalescing]: add support for assignment expressions ([#5234](https://github.com/typescript-eslint/typescript-eslint/issues/5234)) ([4bdbe67](https://github.com/typescript-eslint/typescript-eslint/commit/4bdbe67955fd591c25e58b13e674ba05bf5ed585)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) +* **eslint-plugin:** [prefer-readonly-parameter-types] added an optional type allowlist ([#4436](https://github.com/typescript-eslint/typescript-eslint/issues/4436)) ([c9427b7](https://github.com/typescript-eslint/typescript-eslint/commit/c9427b78b69f1a6a2453ef2df2be5bf96b7b00bc)) +* **eslint-plugin:** [restrict-plus-operands] change checkCompoundAssignments to skipCompoundAssignments ([#7027](https://github.com/typescript-eslint/typescript-eslint/issues/7027)) ([dc801d8](https://github.com/typescript-eslint/typescript-eslint/commit/dc801d892ecc1af678ff37166481f4b69186164c)) +* **eslint-plugin:** add config that disables type-aware linting ([#6470](https://github.com/typescript-eslint/typescript-eslint/issues/6470)) ([3b063cf](https://github.com/typescript-eslint/typescript-eslint/commit/3b063cfadce50985f8ec6d8f44f5b1cbd5c1ea57)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* **eslint-plugin:** deprecate no-type-alias ([#6229](https://github.com/typescript-eslint/typescript-eslint/issues/6229)) ([820bdf2](https://github.com/typescript-eslint/typescript-eslint/commit/820bdf2a3934d4186d51186693ced02df64a57ce)) +* **eslint-plugin:** final final config changes for v6 ([#7157](https://github.com/typescript-eslint/typescript-eslint/issues/7157)) ([e35c5c1](https://github.com/typescript-eslint/typescript-eslint/commit/e35c5c1c39f3d76b916ad1c1ac2c7bf05b379193)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* fork json schema types for better compat with ESLint rule validation ([#6963](https://github.com/typescript-eslint/typescript-eslint/issues/6963)) ([a4967f2](https://github.com/typescript-eslint/typescript-eslint/commit/a4967f2e8cc7b0432d8dfe804772e60042c5384c)) +* improve rule schemas, add test to validate schemas, add tooling to generate schema types ([#6899](https://github.com/typescript-eslint/typescript-eslint/issues/6899)) ([acc1a43](https://github.com/typescript-eslint/typescript-eslint/commit/acc1a43e02a403ff74a54c28c2c495f00d0be038)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove `RuleTester` in `/utils` in favour of the new `/rule-tester` package ([#6816](https://github.com/typescript-eslint/typescript-eslint/issues/6816)) ([c33f497](https://github.com/typescript-eslint/typescript-eslint/commit/c33f497ad8aec7c123c7374f7aff3e24025fe861)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) +* **typescript-estree:** added allowInvalidAST option to not throw on invalid tokens ([#6247](https://github.com/typescript-eslint/typescript-eslint/issues/6247)) ([a3b177d](https://github.com/typescript-eslint/typescript-eslint/commit/a3b177d59adaf8ea76b205befc8b12d86447f1fb)) +* **typescript-estree:** check for illegal decorators on function declarations ([#6590](https://github.com/typescript-eslint/typescript-eslint/issues/6590)) ([1b39cfd](https://github.com/typescript-eslint/typescript-eslint/commit/1b39cfd307955deb8e407cf8dd3a6ca1ed1b8df6)) +* **typescript-estree:** check modifiers on every node ([#6615](https://github.com/typescript-eslint/typescript-eslint/issues/6615)) ([62d6230](https://github.com/typescript-eslint/typescript-eslint/commit/62d62304e16b553274a80d8ab2653543a22f2391)) +* **typescript-estree:** remove optionality from AST boolean properties ([#6274](https://github.com/typescript-eslint/typescript-eslint/issues/6274)) ([df131e2](https://github.com/typescript-eslint/typescript-eslint/commit/df131e258c93e5714c88c0373cfeb2e1e75afc75)) +* **typescript-estree:** throw errors for object methods without function bodies ([#6589](https://github.com/typescript-eslint/typescript-eslint/issues/6589)) ([1d78576](https://github.com/typescript-eslint/typescript-eslint/commit/1d78576d41323e35c2d2a2ecc92f6ee76ed61d57)) +* **typescript-estree:** throw errors when abstract property has initializer ([#6613](https://github.com/typescript-eslint/typescript-eslint/issues/6613)) ([dcdbc76](https://github.com/typescript-eslint/typescript-eslint/commit/dcdbc76d5418a383968d15e32d2eba7a9d2d7e79)) + + +### BREAKING CHANGES + +* **eslint-plugin:** Adds an additional class of checks to the rule +* drop support for ESLint v6 +* drops support for node v17 +* Bumps the minimum supported range and removes handling for old versions +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + + +### Bug Fixes + +* **eslint-plugin:** [comma-spacing] allow no space after trailing comma in objects and arrays ([#6938](https://github.com/typescript-eslint/typescript-eslint/issues/6938)) ([24bdacc](https://github.com/typescript-eslint/typescript-eslint/commit/24bdacc7e5df40c92031a1bd7e9815d66a35b31d)) +* **eslint-plugin:** [prefer-includes] escape special characters ([#7161](https://github.com/typescript-eslint/typescript-eslint/issues/7161)) ([5a347a5](https://github.com/typescript-eslint/typescript-eslint/commit/5a347a5978bc5737412bd12d61eb6058163cf4a0)), closes [#7145](https://github.com/typescript-eslint/typescript-eslint/issues/7145) +* **eslint-plugin:** replace auto-fix of class literal property style rule with suggestion ([#7054](https://github.com/typescript-eslint/typescript-eslint/issues/7054)) ([a8c824a](https://github.com/typescript-eslint/typescript-eslint/commit/a8c824a1e84453f93cd2b464fc102bc878c1aff3)) + + +### Features + +* **eslint-plugin:** [prefer-nullish-coalescing] add `ignorePrimitives` option ([#6487](https://github.com/typescript-eslint/typescript-eslint/issues/6487)) ([6edaa04](https://github.com/typescript-eslint/typescript-eslint/commit/6edaa04565576f0af7e60bc08602bd781c847804)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* **eslint-plugin:** [ban-types] ban types in extends and implements ([#7129](https://github.com/typescript-eslint/typescript-eslint/issues/7129)) ([997783f](https://github.com/typescript-eslint/typescript-eslint/commit/997783ff108ca18af709667ef3fdfa7134a8eefe)) +* use graphemer instead of grapheme-splitter ([#7069](https://github.com/typescript-eslint/typescript-eslint/issues/7069)) ([faea3ff](https://github.com/typescript-eslint/typescript-eslint/commit/faea3ff8b4d750974c41262b44db314f20d0c99c)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + + +### Features + +* **eslint-plugin:** [restrict-plus-operands] add allow* options ([#6161](https://github.com/typescript-eslint/typescript-eslint/issues/6161)) ([def09f8](https://github.com/typescript-eslint/typescript-eslint/commit/def09f88cdb4a85cebb8619b45931f7e2c88dfc0)) + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + + +### Bug Fixes + +* **eslint-plugin:** [prefer-regexp-exec] skip malformed regexes ([#6935](https://github.com/typescript-eslint/typescript-eslint/issues/6935)) ([05ed60e](https://github.com/typescript-eslint/typescript-eslint/commit/05ed60e25f1de9d1bb83d56c81a349130960bec8)) +* **eslint-plugin:** [unified-signatures] no parameters function ([#6940](https://github.com/typescript-eslint/typescript-eslint/issues/6940)) ([2970861](https://github.com/typescript-eslint/typescript-eslint/commit/297086154acc568a0ae8eb41c8977b7a7ba4e0ed)) + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + + +### Bug Fixes + +* **eslint-plugin:** [no-unnecessary-condition] allow nullish coalescing for naked type parameter ([#6910](https://github.com/typescript-eslint/typescript-eslint/issues/6910)) ([3e5f858](https://github.com/typescript-eslint/typescript-eslint/commit/3e5f8583f1e4fe045c2fe2143d6f280b7381f96b)) + + +### Features + +* **eslint-plugin:** [ban-types] add NonNullable suggestion and allow custom suggestions ([#6876](https://github.com/typescript-eslint/typescript-eslint/issues/6876)) ([ff65235](https://github.com/typescript-eslint/typescript-eslint/commit/ff65235246bb6214fb64f0e0317373ca99f8bcbe)) + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + + +### Bug Fixes + +* **eslint-plugin:** [unified-signatures] allow overloads with different named and different number of parameters ([#6877](https://github.com/typescript-eslint/typescript-eslint/issues/6877)) ([939d665](https://github.com/typescript-eslint/typescript-eslint/commit/939d6656ebcb94fab048a08d719b3e77362ab5b4)) + + +### Features + +* **eslint-plugin:** [no-unsafe-enum-comparison] add rule ([#6107](https://github.com/typescript-eslint/typescript-eslint/issues/6107)) ([915f9c2](https://github.com/typescript-eslint/typescript-eslint/commit/915f9c2dc8934eef491a672786ec9f016f3658ba)) + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + + +### Bug Fixes + +* **eslint-plugin:** [strict-boolean-expressions] support mixed enums in allowNullableEnum option ([#6740](https://github.com/typescript-eslint/typescript-eslint/issues/6740)) ([49be8a8](https://github.com/typescript-eslint/typescript-eslint/commit/49be8a814c82f3784308ef5a6e90478eb56e55c1)) + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + + +### Bug Fixes + +* **eslint-plugin:** [no-unnecessary-boolean-literal-compare] simplify fixer and add support for double negation ([#6620](https://github.com/typescript-eslint/typescript-eslint/issues/6620)) ([81c8519](https://github.com/typescript-eslint/typescript-eslint/commit/81c85193d27d2e7f6d12bc259088b9b73dbe1e8b)) +* **eslint-plugin:** correct crashes with getTypeArguments for ts < 3.7 ([#6767](https://github.com/typescript-eslint/typescript-eslint/issues/6767)) ([59eab58](https://github.com/typescript-eslint/typescript-eslint/commit/59eab587890a915387444d00c4a9387aed602718)) + + +### Features + +* **eslint-plugin:** [consistent-type-assertions] add suggestions for objectLiteralTypeAssertions ([#6642](https://github.com/typescript-eslint/typescript-eslint/issues/6642)) ([720e811](https://github.com/typescript-eslint/typescript-eslint/commit/720e81138b66c94c60c4a4471b86b7d8567b6df0)) +* **eslint-plugin:** [consistent-type-assertions] autofix angle bracket assertions to as ([#6641](https://github.com/typescript-eslint/typescript-eslint/issues/6641)) ([ad8ea64](https://github.com/typescript-eslint/typescript-eslint/commit/ad8ea64dbdf06c92ff72b48022f041693a8d7076)) +* **eslint-plugin:** add `no-duplicate-type-constituents` rule ([#5728](https://github.com/typescript-eslint/typescript-eslint/issues/5728)) ([bc31078](https://github.com/typescript-eslint/typescript-eslint/commit/bc31078cf86d69eee881e4a7daeffa347c1d82a7)) + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 9c98f8c7d4b..3f894c88344 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -8,3 +8,5 @@ An ESLint plugin which provides lint rules for TypeScript codebases. 👉 See **https://typescript-eslint.io/getting-started** for our Getting Started docs. > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/eslint-plugin/docs/rules/README.md b/packages/eslint-plugin/docs/rules/README.md index 04e2d987056..71da9b1fd15 100644 --- a/packages/eslint-plugin/docs/rules/README.md +++ b/packages/eslint-plugin/docs/rules/README.md @@ -13,11 +13,11 @@ See [Configs](/linting/configs) for how to enable recommended rules using config import RulesTable from "@site/src/components/RulesTable"; - + ## Extension Rules In some cases, ESLint provides a rule itself, but it doesn't support TypeScript syntax; either it crashes, or it ignores the syntax, or it falsely reports against it. In these cases, we create what we call an extension rule; a rule within our plugin that has the same functionality, but also supports TypeScript. - + diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index 3f2e663669a..7109e24e845 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -111,7 +111,9 @@ const defaultTypes = { 'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.', '- If you want a type meaning "any object", you probably want `object` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', + '- If you really want a type meaning "any non-nullish value", you probably want `NonNullable` instead.', ].join('\n'), + suggest: ['object', 'unknown', 'NonNullable'], }, '{}': { message: [ @@ -119,7 +121,14 @@ const defaultTypes = { '- If you want a type meaning "any object", you probably want `object` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', '- If you want a type meaning "empty object", you probably want `Record` instead.', + '- If you really want a type meaning "any non-nullish value", you probably want `NonNullable` instead.', ].join('\n'), + suggest: [ + 'object', + 'unknown', + 'Record', + 'NonNullable', + ], }, }; ``` @@ -139,6 +148,7 @@ The values 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. + - `suggest?: string[]` - a list of suggested replacements for the banned type. ### `extendDefaults` diff --git a/packages/eslint-plugin/docs/rules/camelcase.md b/packages/eslint-plugin/docs/rules/camelcase.md index 1b3c0e89318..aae38de928b 100644 --- a/packages/eslint-plugin/docs/rules/camelcase.md +++ b/packages/eslint-plugin/docs/rules/camelcase.md @@ -5,6 +5,6 @@ This rule has been deprecated in favour of the [`naming-convention`](./naming-co ::: diff --git a/packages/eslint-plugin/docs/rules/comma-dangle.md b/packages/eslint-plugin/docs/rules/comma-dangle.md index 1f11f9cf3ac..d25ec9e0ccb 100644 --- a/packages/eslint-plugin/docs/rules/comma-dangle.md +++ b/packages/eslint-plugin/docs/rules/comma-dangle.md @@ -13,7 +13,7 @@ It adds support for TypeScript syntax. See the [ESLint documentation](https://eslint.org/docs/rules/comma-dangle) for more details on the `comma-dangle` rule. -## How to Use +## Options In addition to the options supported by the `comma-dangle` rule in ESLint core, the rule adds the following options: diff --git a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md index 87d7d23b038..51fa8523582 100644 --- a/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md +++ b/packages/eslint-plugin/docs/rules/explicit-member-accessibility.md @@ -7,7 +7,7 @@ description: 'Require explicit accessibility modifiers on class properties and m > See **https://typescript-eslint.io/rules/explicit-member-accessibility** for documentation. TypeScript allows placing explicit `public`, `protected`, and `private` accessibility modifiers in front of class members. -The modifiers exist solely in the type system and just server to describe who is allowed to access those members. +The modifiers exist solely in the type system and just serve to describe who is allowed to access those members. Leaving off accessibility modifiers makes for less code to read and write. Members are `public` by default. diff --git a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md index 2995d3b2c7e..e48af85195d 100644 --- a/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md +++ b/packages/eslint-plugin/docs/rules/explicit-module-boundary-types.md @@ -56,7 +56,7 @@ export var fn = function (): number { }; // A return value of type string -export var arrowFn = (arg: string): string => `test ${arg}`; +export var arrowFn = (): string => 'test'; // All arguments should be typed export var arrowFn = (arg: string): string => `test ${arg}`; diff --git a/packages/eslint-plugin/docs/rules/lines-around-comment.md b/packages/eslint-plugin/docs/rules/lines-around-comment.md index 4ed071a2298..a3fbb5579d0 100644 --- a/packages/eslint-plugin/docs/rules/lines-around-comment.md +++ b/packages/eslint-plugin/docs/rules/lines-around-comment.md @@ -11,24 +11,14 @@ description: 'Require empty lines around comments.' This rule extends the base [`eslint/lines-around-comment`](https://eslint.org/docs/rules/lines-around-comment) rule. It adds support for TypeScript syntax. -See the [ESLint documentation](https://eslint.org/docs/rules/lines-around-comment) for more details on the `comma-dangle` rule. - -## Rule Changes - -```jsonc -{ - // note you must disable the base rule as it can report incorrect errors - "lines-around-comment": "off", - "@typescript-eslint/lines-around-comment": ["error"] -} -``` +See the [ESLint documentation](https://eslint.org/docs/rules/lines-around-comment) for more details on the `lines-around-comment` rule. ## Options In addition to the options supported by the `lines-around-comment` rule in ESLint core, the rule adds the following options: -- `allowEnumEnd: true` doesn't require a blank line after an interface body block end -- `allowEnumStart: true` doesn't require a blank line before an interface body block start +- `allowEnumEnd: true` doesn't require a blank line after an enum body block end +- `allowEnumStart: true` doesn't require a blank line before an enum body block start - `allowInterfaceEnd: true` doesn't require a blank line before an interface body block end - `allowInterfaceStart: true` doesn't require a blank line after an interface body block start - `allowModuleEnd: true` doesn't require a blank line before a module body block end diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index ab0405592c4..53c381c9e74 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -104,10 +104,10 @@ For information about how each selector is applied, see ["How does the rule eval The `format` option defines the allowed formats for the identifier. This option accepts an array of the following values, and the identifier can match any of them: - `camelCase` - standard camelCase format - no underscores are allowed between characters, and consecutive capitals are allowed (i.e. both `myID` and `myId` are valid). -- `strictCamelCase` - same as `camelCase`, but consecutive capitals are not allowed (i.e. `myId` is valid, but `myID` is not). - `PascalCase` - same as `camelCase`, except the first character must be upper-case. -- `StrictPascalCase` - same as `strictCamelCase`, except the first character must be upper-case. - `snake_case` - standard snake_case format - all characters must be lower-case, and underscores are allowed. +- `strictCamelCase` - same as `camelCase`, but consecutive capitals are not allowed (i.e. `myId` is valid, but `myID` is not). +- `StrictPascalCase` - same as `strictCamelCase`, except the first character must be upper-case. - `UPPER_CASE` - same as `snake_case`, except all characters must be upper-case. Instead of an array, you may also pass `null`. This signifies "this selector shall not have its format checked". @@ -118,8 +118,8 @@ This can be useful if you want to enforce no particular format for a specific se The `custom` option defines a custom regex that the identifier must (or must not) match. This option allows you to have a bit more finer-grained control over identifiers, letting you ban (or force) certain patterns and substrings. Accepts an object with the following properties: -- `regex` - a string that is then passed into RegExp to create a new regular expression: `new RegExp(regex)` - `match` - true if the identifier _must_ match the `regex`, false if the identifier _must not_ match the `regex`. +- `regex` - a string that is then passed into RegExp to create a new regular expression: `new RegExp(regex)` #### `filter` @@ -129,8 +129,8 @@ You can use this to include or exclude specific identifiers from specific config Accepts an object with the following properties: -- `regex` - a string that is then passed into RegExp to create a new regular expression: `new RegExp(regex)` - `match` - true if the identifier _must_ match the `regex`, false if the identifier _must not_ match the `regex`. +- `regex` - a string that is then passed into RegExp to create a new regular expression: `new RegExp(regex)` Alternatively, `filter` accepts a regular expression (anything accepted into `new RegExp(filter)`). In this case, it's treated as if you had passed an object with the regex and `match: true`. @@ -138,12 +138,12 @@ Alternatively, `filter` accepts a regular expression (anything accepted into `ne The `leadingUnderscore` / `trailingUnderscore` options control whether leading/trailing underscores are considered valid. Accepts one of the following values: -- `forbid` - a leading/trailing underscore is not allowed at all. -- `require` - a single leading/trailing underscore must be included. -- `requireDouble` - two leading/trailing underscores must be included. - `allow` - existence of a single leading/trailing underscore is not explicitly enforced. - `allowDouble` - existence of a double leading/trailing underscore is not explicitly enforced. - `allowSingleOrDouble` - existence of a single or a double leading/trailing underscore is not explicitly enforced. +- `forbid` - a leading/trailing underscore is not allowed at all. +- `require` - a single leading/trailing underscore must be included. +- `requireDouble` - two leading/trailing underscores must be included. #### `prefix` / `suffix` @@ -163,27 +163,27 @@ If these are provided, the identifier must start with one of the provided values - The name must match _all_ of the modifiers. - For example, if you provide `{ modifiers: ['private','readonly','static'] }`, then it will only match something that is `private static readonly`, and something that is just `private` will not match. - The following `modifiers` are allowed: + - `abstract`,`override`,`private`,`protected`,`readonly`,`static` - matches any member explicitly declared with the given modifier. + - `async` - matches any method, function, or function variable which is async via the `async` keyword (e.g. does not match functions that return promises without using `async` keyword) - `const` - matches a variable declared as being `const` (`const x = 1`). - `destructured` - matches a variable declared via an object destructuring pattern (`const {x, z = 2}`). - Note that this does not match renamed destructured properties (`const {x: y, a: b = 2}`). - - `global` - matches a variable/function declared in the top-level scope. - `exported` - matches anything that is exported from the module. - - `unused` - matches anything that is not used. - - `requiresQuotes` - matches any name that requires quotes as it is not a valid identifier (i.e. has a space, a dash, etc in it). - - `public` - matches any member that is either explicitly declared as `public`, or has no visibility modifier (i.e. implicitly public). - - `abstract`,`override`,`private`,`protected`,`readonly`,`static` - matches any member explicitly declared with the given modifier. + - `global` - matches a variable/function declared in the top-level scope. - `#private` - matches any member with a private identifier (an identifier that starts with `#`) - - `async` - matches any method, function, or function variable which is async via the `async` keyword (e.g. does not match functions that return promises without using `async` keyword) + - `public` - matches any member that is either explicitly declared as `public`, or has no visibility modifier (i.e. implicitly public). + - `requiresQuotes` - matches any name that requires quotes as it is not a valid identifier (i.e. has a space, a dash, etc in it). + - `unused` - matches anything that is not used. - `types` allows you to specify which types to match. This option supports simple, primitive types only (`array`,`boolean`,`function`,`number`,`string`). - The name must match _one_ of the types. - **_NOTE - Using this option will require that you lint with type information._** - For example, this lets you do things like enforce that `boolean` variables are prefixed with a verb. - The following `types` are allowed: - - `boolean` matches any type assignable to `boolean | null | undefined` - - `string` matches any type assignable to `string | null | undefined` - - `number` matches any type assignable to `number | null | undefined` - `array` matches any type assignable to `Array | null | undefined` + - `boolean` matches any type assignable to `boolean | null | undefined` - `function` matches any type assignable to `Function | null | undefined` + - `number` matches any type assignable to `number | null | undefined` + - `string` matches any type assignable to `string | null | undefined` The ordering of selectors does not matter. The implementation will automatically sort the selectors to ensure they match from most-specific to least specific. It will keep checking selectors in that order until it finds one that matches the name. See ["How does the rule automatically order selectors?"](#how-does-the-rule-automatically-order-selectors) @@ -195,57 +195,57 @@ There are two types of selectors, individual selectors, and grouped selectors. Individual Selectors match specific, well-defined sets. There is no overlap between each of the individual selectors. -- `variable` - matches any `let` / `const` / `var` variable name. - - Allowed `modifiers`: `async`, `const`, `destructured`, `exported`, `global`, `unused`. +- `accessor` - matches any accessor. + - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. -- `function` - matches any named function declaration or named function expression. - - Allowed `modifiers`: `async`, `exported`, `global`, `unused`. +- `class` - matches any class declaration. + - Allowed `modifiers`: `abstract`, `exported`, `unused`. - Allowed `types`: none. -- `parameter` - matches any function parameter. Does not match parameter properties. - - Allowed `modifiers`: `destructured`, `unused`. - - Allowed `types`: `boolean`, `string`, `number`, `function`, `array`. -- `classProperty` - matches any class property. Does not match properties that have direct function expression or arrow function expression values. - - Allowed `modifiers`: `abstract`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. -- `objectLiteralProperty` - matches any object literal property. Does not match properties that have direct function expression or arrow function expression values. - - Allowed `modifiers`: `public`, `requiresQuotes`. - - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. -- `typeProperty` - matches any object type property. Does not match properties that have direct function expression or arrow function expression values. - - Allowed `modifiers`: `public`, `readonly`, `requiresQuotes`. - - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. -- `parameterProperty` - matches any parameter property. - - Allowed `modifiers`: `private`, `protected`, `public`, `readonly`. - - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `classMethod` - matches any class method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `requiresQuotes`, `static`. - Allowed `types`: none. -- `objectLiteralMethod` - matches any object literal method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - - Allowed `modifiers`: `async`, `public`, `requiresQuotes`. - - Allowed `types`: none. -- `typeMethod` - matches any object type method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. - - Allowed `modifiers`: `public`, `requiresQuotes`. - - Allowed `types`: none. -- `accessor` - matches any accessor. - - Allowed `modifiers`: `abstract`, `override`, `private`, `protected`, `public`, `requiresQuotes`, `static`. +- `classProperty` - matches any class property. Does not match properties that have direct function expression or arrow function expression values. + - Allowed `modifiers`: `abstract`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. +- `enum` - matches any enum declaration. + - Allowed `modifiers`: `exported`, `unused`. + - Allowed `types`: none. - `enumMember` - matches any enum member. - Allowed `modifiers`: `requiresQuotes`. - Allowed `types`: none. -- `class` - matches any class declaration. - - Allowed `modifiers`: `abstract`, `exported`, `unused`. +- `function` - matches any named function declaration or named function expression. + - Allowed `modifiers`: `async`, `exported`, `global`, `unused`. - Allowed `types`: none. - `interface` - matches any interface declaration. - Allowed `modifiers`: `exported`, `unused`. - Allowed `types`: none. +- `objectLiteralMethod` - matches any object literal method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. + - Allowed `modifiers`: `async`, `public`, `requiresQuotes`. + - Allowed `types`: none. +- `objectLiteralProperty` - matches any object literal property. Does not match properties that have direct function expression or arrow function expression values. + - Allowed `modifiers`: `public`, `requiresQuotes`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. +- `parameter` - matches any function parameter. Does not match parameter properties. + - Allowed `modifiers`: `destructured`, `unused`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. +- `parameterProperty` - matches any parameter property. + - Allowed `modifiers`: `private`, `protected`, `public`, `readonly`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. - `typeAlias` - matches any type alias declaration. - Allowed `modifiers`: `exported`, `unused`. - Allowed `types`: none. -- `enum` - matches any enum declaration. - - Allowed `modifiers`: `exported`, `unused`. +- `typeMethod` - matches any object type method. Also matches properties that have direct function expression or arrow function expression values. Does not match accessors. + - Allowed `modifiers`: `public`, `requiresQuotes`. - Allowed `types`: none. - `typeParameter` - matches any generic type parameter declaration. - Allowed `modifiers`: `unused`. - Allowed `types`: none. +- `typeProperty` - matches any object type property. Does not match properties that have direct function expression or arrow function expression values. + - Allowed `modifiers`: `public`, `readonly`, `requiresQuotes`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. +- `variable` - matches any `const` / `let` / `var` variable name. + - Allowed `modifiers`: `async`, `const`, `destructured`, `exported`, `global`, `unused`. + - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. ##### Group Selectors @@ -254,20 +254,20 @@ Group Selectors are provided for convenience, and essentially bundle up sets of - `default` - matches everything. - Allowed `modifiers`: all modifiers. - Allowed `types`: none. -- `variableLike` - matches the same as `function`, `parameter` and `variable`. - - Allowed `modifiers`: `async`, `unused`. - - Allowed `types`: none. - `memberLike` - matches the same as `accessor`, `enumMember`, `method`, `parameterProperty`, `property`. - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. -- `typeLike` - matches the same as `class`, `enum`, `interface`, `typeAlias`, `typeParameter`. - - Allowed `modifiers`: `abstract`, `unused`. +- `method` - matches the same as `classMethod`, `objectLiteralMethod`, `typeMethod`. + - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: none. - `property` - matches the same as `classProperty`, `objectLiteralProperty`, `typeProperty`. - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. - Allowed `types`: `array`, `boolean`, `function`, `number`, `string`. -- `method` - matches the same as `classMethod`, `objectLiteralMethod`, `typeMethod`. - - Allowed `modifiers`: `abstract`, `async`, `override`, `#private`, `private`, `protected`, `public`, `readonly`, `requiresQuotes`, `static`. +- `typeLike` - matches the same as `class`, `enum`, `interface`, `typeAlias`, `typeParameter`. + - Allowed `modifiers`: `abstract`, `unused`. + - Allowed `types`: none. +- `variableLike` - matches the same as `function`, `parameter` and `variable`. + - Allowed `modifiers`: `async`, `unused`. - Allowed `types`: none. ## FAQ @@ -278,18 +278,18 @@ This is a big rule, and there's a lot of docs. Here are a few clarifications tha Each selector is checked in the following way: -1. check the `selector` - 1. if `selector` is one individual selector → the name's type must be of that type. - 1. if `selector` is a group selector → the name's type must be one of the grouped types. - 1. if `selector` is an array of selectors → apply the above for each selector in the array. 1. check the `filter` 1. if `filter` is omitted → skip this step. - 1. if the name matches the `filter` → continue evaluating this selector. - 1. if the name does not match the `filter` → skip this selector and continue to the next selector. -1. check the `types` + 2. if the name matches the `filter` → continue evaluating this selector. + 3. if the name does not match the `filter` → skip this selector and continue to the next selector. +2. check the `selector` + 1. if `selector` is one individual selector → the name's type must be of that type. + 2. if `selector` is a group selector → the name's type must be one of the grouped types. + 3. if `selector` is an array of selectors → apply the above for each selector in the array. +3. check the `types` 1. if `types` is omitted → skip this step. - 1. if the name has a type in `types` → continue evaluating this selector. - 1. if the name does not have a type in `types` → skip this selector and continue to the next selector. + 2. if the name has a type in `types` → continue evaluating this selector. + 3. if the name does not have a type in `types` → skip this selector and continue to the next selector. A name is considered to pass the config if it: diff --git a/packages/eslint-plugin/docs/rules/no-base-to-string.md b/packages/eslint-plugin/docs/rules/no-base-to-string.md index 7409f5e134e..a5493c7e50f 100644 --- a/packages/eslint-plugin/docs/rules/no-base-to-string.md +++ b/packages/eslint-plugin/docs/rules/no-base-to-string.md @@ -29,7 +29,7 @@ value + ''; // Interpolation and manual .toString() calls too: `Value: ${value}`; -({}.toString()); +({}).toString(); ``` ### ✅ Correct diff --git a/packages/eslint-plugin/docs/rules/no-duplicate-imports.md b/packages/eslint-plugin/docs/rules/no-duplicate-imports.md index 5f523a7b0f4..9bf40498092 100644 --- a/packages/eslint-plugin/docs/rules/no-duplicate-imports.md +++ b/packages/eslint-plugin/docs/rules/no-duplicate-imports.md @@ -1,12 +1,10 @@ ---- -description: 'Disallow duplicate imports.' ---- - -> 🛑 This file is source code, not the primary documentation location! 🛑 -> -> See **https://typescript-eslint.io/rules/no-duplicate-imports** for documentation. - :::danger Deprecated This rule has been deprecated in favour of the [`import/no-duplicates`](https://github.com/import-js/eslint-plugin-import/blob/HEAD/docs/rules/no-duplicates.md) rule. + ::: + + diff --git a/packages/eslint-plugin/docs/rules/no-duplicate-type-constituents.md b/packages/eslint-plugin/docs/rules/no-duplicate-type-constituents.md new file mode 100644 index 00000000000..879d0c6ca74 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-duplicate-type-constituents.md @@ -0,0 +1,61 @@ +--- +description: 'Disallow duplicate constituents of union or intersection types.' +--- + +> 🛑 This file is source code, not the primary documentation location! 🛑 +> +> See **https://typescript-eslint.io/rules/no-duplicate-type-constituents** for documentation. + +TypeScript supports types ("constituents") within union and intersection types being duplicates of each other. +However, developers typically expect each constituent to be unique within its intersection or union. +Duplicate values make the code overly verbose and generally reduce readability. + +## Rule Details + +This rule disallows duplicate union or intersection constituents. +We consider types to be duplicate if they evaluate to the same result in the type system. +For example, given `type A = string` and `type T = string | A`, this rule would flag that `A` is the same type as `string`. + + + +### ❌ Incorrect + +```ts +type T1 = 'A' | 'A'; + +type T2 = A | A | B; + +type T3 = { a: string } & { a: string }; + +type T4 = [1, 2, 3] | [1, 2, 3]; + +type StringA = string; +type StringB = string; +type T5 = StringA | StringB; +``` + +### ✅ Correct + +```ts +type T1 = 'A' | 'B'; + +type T2 = A | B | C; + +type T3 = { a: string } & { b: string }; + +type T4 = [1, 2, 3] | [1, 2, 3, 4]; + +type StringA = string; +type NumberB = number; +type T5 = StringA | NumberB; +``` + +## Options + +### `ignoreIntersections` + +When set to true, duplicate checks on intersection type constituents are ignored. + +### `ignoreUnions` + +When set to true, duplicate checks on union type constituents are ignored. diff --git a/packages/eslint-plugin/docs/rules/no-floating-promises.md b/packages/eslint-plugin/docs/rules/no-floating-promises.md index 289e42f903c..246a50be096 100644 --- a/packages/eslint-plugin/docs/rules/no-floating-promises.md +++ b/packages/eslint-plugin/docs/rules/no-floating-promises.md @@ -83,7 +83,7 @@ With this option set to `true`, and if you are using `no-void`, you should turn ### `ignoreIIFE` -This allows you to skip checking of async IIFEs (Immediately Invocated function Expressions). +This allows you to skip checking of async IIFEs (Immediately Invoked function Expressions). Examples of **correct** code for this rule with `{ ignoreIIFE: true }`: diff --git a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md b/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md deleted file mode 100644 index ea75c981890..00000000000 --- a/packages/eslint-plugin/docs/rules/no-implicit-any-catch.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -description: 'Disallow usage of the implicit `any` type in catch clauses.' ---- - -> 🛑 This file is source code, not the primary documentation location! 🛑 -> -> See **https://typescript-eslint.io/rules/no-implicit-any-catch** for documentation. - -:::danger Deprecated - -This rule has been deprecated as TypeScript versions >=4 includes a `useUnknownInCatchVariables` compiler option with the same check. -::: - -TypeScript 4.0 added support for adding an explicit `any` or `unknown` type annotation on a catch clause variable. - -By default, TypeScript will type a catch clause variable as `any`, so explicitly annotating it as `unknown` can add a lot of safety to your codebase. - -The `noImplicitAny` flag in TypeScript does not cover this for backwards compatibility reasons, however you can use `useUnknownInCatchVariables` (part of `strict`) instead of this rule. - -## DEPRECATED - -## Examples - -This rule requires an explicit type to be declared on a catch clause variable. - - - -### ❌ Incorrect - -```ts -try { - // ... -} catch (e) { - // ... -} -``` - -### ✅ Correct - - - - -```ts -try { - // ... -} catch (e: unknown) { - // ... -} -``` - - - -## Options - -### `allowExplicitAny` - -The follow is is **_not_** considered a warning with `{ allowExplicitAny: true }` - -```ts -try { - // ... -} catch (e: any) { - // ... -} -``` - -## When Not To Use It - -If you are not using TypeScript 4.0 (or greater), then you will not be able to use this rule, annotations on catch clauses is not supported. - -## Further Reading - -- [TypeScript 4.0 Release Notes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#unknown-on-catch) diff --git a/packages/eslint-plugin/docs/rules/no-parameter-properties.md b/packages/eslint-plugin/docs/rules/no-parameter-properties.md deleted file mode 100644 index 16a91864d59..00000000000 --- a/packages/eslint-plugin/docs/rules/no-parameter-properties.md +++ /dev/null @@ -1,406 +0,0 @@ ---- -description: 'Disallow the use of parameter properties in class constructors.' ---- - -> 🛑 This file is source code, not the primary documentation location! 🛑 -> -> See **https://typescript-eslint.io/rules/no-parameter-properties** for documentation. - -:::danger Deprecated - -This rule has been deprecated in favour of the equivalent, better named [`parameter-properties`](./parameter-properties.md) rule. -::: - -Parameter properties can be confusing to those new to TypeScript as they are less explicit than other ways -of declaring and initializing class members. - -## Examples - -This rule disallows the use of parameter properties in constructors, forcing the user to explicitly -declare all properties in the class. - -## Options - -This rule, in its default state, does not require any argument and would completely disallow the use of parameter properties. -If you would like to allow certain types of parameter properties then you may pass an object with the following options: - -- `allows`, an array containing one or more of the allowed modifiers. Valid values are: - - `readonly`, allows **readonly** parameter properties. - - `private`, allows **private** parameter properties. - - `protected`, allows **protected** parameter properties. - - `public`, allows **public** parameter properties. - - `private readonly`, allows **private readonly** parameter properties. - - `protected readonly`, allows **protected readonly** parameter properties. - - `public readonly`, allows **public readonly** parameter properties. - -### default - -Examples of code for this rule with no options at all: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} -``` - -### readonly - -Examples of code for the `{ "allows": ["readonly"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(readonly name: string) {} -} -``` - -### private - -Examples of code for the `{ "allows": ["private"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(private name: string) {} -} -``` - -### protected - -Examples of code for the `{ "allows": ["protected"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} -``` - -### public - -Examples of code for the `{ "allows": ["public"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(public name: string) {} -} -``` - -### private readonly - -Examples of code for the `{ "allows": ["private readonly"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} -``` - -### protected readonly - -Examples of code for the `{ "allows": ["protected readonly"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} -``` - -### public readonly - -Examples of code for the `{ "allows": ["public readonly"] }` options: - - - -#### ❌ Incorrect - -```ts -class Foo { - constructor(readonly name: string) {} -} - -class Foo { - constructor(private name: string) {} -} - -class Foo { - constructor(protected name: string) {} -} - -class Foo { - constructor(public name: string) {} -} - -class Foo { - constructor(private readonly name: string) {} -} - -class Foo { - constructor(protected readonly name: string) {} -} -``` - -#### ✅ Correct - -```ts -class Foo { - constructor(name: string) {} -} - -class Foo { - constructor(public readonly name: string) {} -} -``` - -## When Not To Use It - -If you don't care about the using parameter properties in constructors, then you will not need this rule. diff --git a/packages/eslint-plugin/docs/rules/no-type-alias.md b/packages/eslint-plugin/docs/rules/no-type-alias.md index a9774ebdde1..78bdf64c009 100644 --- a/packages/eslint-plugin/docs/rules/no-type-alias.md +++ b/packages/eslint-plugin/docs/rules/no-type-alias.md @@ -6,6 +6,20 @@ description: 'Disallow type aliases.' > > See **https://typescript-eslint.io/rules/no-type-alias** for documentation. +:::danger Deprecated + +This rule has been deprecated in favour of the [`@typescript-eslint/consistent-type-definitions`](./consistent-type-definitions.md) rule. +TypeScript type aliases are a commonly necessary language feature; banning it altogether is oftentimes counterproductive. + +::: + +:::note + +If you want to ban certain classifications of type aliases, consider using [`no-restricted-syntax`](https://eslint.org/docs/latest/rules/no-restricted-syntax). +See [Troubleshooting & FAQs](/linting/troubleshooting#how-can-i-ban-specific-language-feature). + +::: + In TypeScript, type aliases serve three purposes: - Aliasing other types so that we can refer to them using a simpler name. diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md b/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md index 69c9a33441b..d41eee1a090 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md @@ -115,16 +115,16 @@ if (!(someNullCondition ?? true)) { ## Fixer -| Comparison | Fixer Output | Notes | -| :----------------------------: | ------------------------------- | ----------------------------------------------------------------------------------- | -| `booleanVar === true` | `booleanVar` | | -| `booleanVar !== true` | `!booleanVar` | | -| `booleanVar === false` | `!booleanVar` | | -| `booleanVar !== false` | `booleanVar` | | -| `nullableBooleanVar === true` | `nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` | -| `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` | -| `nullableBooleanVar === false` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` | -| `nullableBooleanVar !== false` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` | +| Comparison | Fixer Output | Notes | +| :-------------------------------: | ------------------------------- | ----------------------------------------------------------------------------------- | +| `booleanVar === true` | `booleanVar` | | +| `booleanVar !== true` | `!booleanVar` | | +| `booleanVar === false` | `!booleanVar` | | +| `booleanVar !== false` | `booleanVar` | | +| `nullableBooleanVar === true` | `nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` | +| `nullableBooleanVar !== true` | `!nullableBooleanVar` | Only checked/fixed if the `allowComparingNullableBooleansToTrue` option is `false` | +| `!(nullableBooleanVar === false)` | `nullableBooleanVar ?? true` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` | +| `!(nullableBooleanVar !== false)` | `!(nullableBooleanVar ?? true)` | Only checked/fixed if the `allowComparingNullableBooleansToFalse` option is `false` | ## Not To Use It diff --git a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md index b8672d945d5..5fd0e70d653 100644 --- a/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +++ b/packages/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md @@ -7,8 +7,8 @@ description: 'Disallow unnecessary constraints on generic types.' > See **https://typescript-eslint.io/rules/no-unnecessary-type-constraint** for documentation. Generic type parameters (``) in TypeScript may be "constrained" with an [`extends` keyword](https://www.typescriptlang.org/docs/handbook/generics.html#generic-constraints). -When no `extends` is provided, type parameters default a constraint to `any`. -It is therefore redundant to `extend` from `any`. +When no `extends` is provided, type parameters default a constraint to `unknown`. +It is therefore redundant to `extend` from `any` or `unknown`. ## Examples @@ -19,8 +19,12 @@ It is therefore redundant to `extend` from `any`. ```ts interface FooAny {} +interface FooUnknown {} + type BarAny = {}; +type BarUnknown = {}; + class BazAny { quxAny() {} } diff --git a/packages/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md b/packages/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md new file mode 100644 index 00000000000..f5705826073 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-unsafe-enum-comparison.md @@ -0,0 +1,77 @@ +--- +description: 'Disallow comparing an enum value with a non-enum value.' +--- + +> 🛑 This file is source code, not the primary documentation location! 🛑 +> +> See **https://typescript-eslint.io/rules/no-unsafe-enum-comparison** for documentation. + +The TypeScript compiler can be surprisingly lenient when working with enums. +For example, it will allow you to compare enum values against numbers even though they might not have any type overlap: + +```ts +enum Fruit { + Apple, + Banana, +} + +declare let fruit: Fruit; + +fruit === 999; // No error +``` + +This rule flags when an enum typed value is compared to a non-enum `number`. + +## Examples + + + +### ❌ Incorrect + +```ts +enum Fruit { + Apple, +} + +declare let fruit: Fruit; + +fruit === 999; +``` + +```ts +enum Vegetable { + Asparagus = 'asparagus', +} + +declare let vegetable: Vegetable; + +vegetable === 'asparagus'; +``` + +### ✅ Correct + +```ts +enum Fruit { + Apple, +} + +declare let fruit: Fruit; + +fruit === Fruit.Banana; +``` + +```ts +enum Vegetable { + Asparagus = 'asparagus', +} + +declare let vegetable: Vegetable; + +vegetable === Vegetable.Asparagus; +``` + + + +## When Not To Use It + +If you don't mind number and/or literal string constants being compared against enums, you likely don't need this rule. diff --git a/packages/eslint-plugin/docs/rules/prefer-includes.md b/packages/eslint-plugin/docs/rules/prefer-includes.md index 8c1a709c2de..793014008be 100644 --- a/packages/eslint-plugin/docs/rules/prefer-includes.md +++ b/packages/eslint-plugin/docs/rules/prefer-includes.md @@ -57,7 +57,7 @@ const userDefined: { str.includes(value); array.includes(value); -readonlyArray.includes(value); +!readonlyArray.includes(value); typedArray.includes(value); maybe?.includes(''); userDefined.includes(value); diff --git a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md index d2fc95f4066..451f7dff1d4 100644 --- a/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +++ b/packages/eslint-plugin/docs/rules/prefer-nullish-coalescing.md @@ -1,5 +1,5 @@ --- -description: 'Enforce using the nullish coalescing operator instead of logical chaining.' +description: 'Enforce using the nullish coalescing operator instead of logical assignments or chaining.' --- > 🛑 This file is source code, not the primary documentation location! 🛑 @@ -9,7 +9,10 @@ description: 'Enforce using the nullish coalescing operator instead of logical c The `??` nullish coalescing runtime operator allows providing a default value when dealing with `null` or `undefined`. Because the nullish coalescing operator _only_ coalesces when the original value is `null` or `undefined`, it is much safer than relying upon logical OR operator chaining `||`, which coalesces on any _falsy_ value. -This rule reports when an `||` operator can be safely replaced with a `??`. +This rule reports when you can safely replace: + +- An `||` operator with `??` +- An `||=` operator with `??=` :::caution This rule will not work as expected if [`strictNullChecks`](https://www.typescriptlang.org/tsconfig#strictNullChecks) is not enabled. @@ -73,7 +76,10 @@ declare const b: string | null; if (a || b) { } +if ((a ||= b)) { +} while (a || b) {} +while ((a ||= b)) {} do {} while (a || b); for (let i = 0; a || b; i += 1) {} a || b ? true : false; @@ -87,7 +93,10 @@ declare const b: string | null; if (a ?? b) { } +if ((a ??= b)) { +} while (a ?? b) {} +while ((a ??= b)) {} do {} while (a ?? b); for (let i = 0; a ?? b; i += 1) {} a ?? b ? true : false; @@ -110,6 +119,7 @@ declare const c: string | null; declare const d: string | null; a || (b && c); +a ||= b && c; (a && b) || c || d; a || (b && c) || d; a || (b && c && d); @@ -124,6 +134,7 @@ declare const c: string | null; declare const d: string | null; a ?? (b && c); +a ??= b && c; (a && b) ?? c ?? d; a ?? (b && c) ?? d; a ?? (b && c && d); @@ -131,6 +142,29 @@ a ?? (b && c && d); **_NOTE:_** Errors for this specific case will be presented as suggestions (see below), instead of fixes. This is because it is not always safe to automatically convert `||` to `??` within a mixed logical expression, as we cannot tell the intended precedence of the operator. Note that by design, `??` requires parentheses when used with `&&` or `||` in the same expression. +### `ignorePrimitives` + +If you would like to ignore certain primitive types that can be falsy then you may pass an object containing a boolean value for each primitive: + +- `string: true`, ignores `null` or `undefined` unions with `string` (default: false). +- `number: true`, ignores `null` or `undefined` unions with `number` (default: false). +- `bigint: true`, ignores `null` or `undefined` unions with `bigint` (default: false). +- `boolean: true`, ignores `null` or `undefined` unions with `boolean` (default: false). + +Incorrect code for `ignorePrimitives: { string: true }`, and correct code for `ignorePrimitives: { string: false }`: + +```ts +const foo: string | undefined = 'bar'; +foo || 'a string'; +``` + +Correct code for `ignorePrimitives: { string: true }`: + +```ts +const foo: string | undefined = 'bar'; +foo ?? 'a string'; +``` + ## When Not To Use It If you are not using TypeScript 3.7 (or greater), then you will not be able to use this rule, as the operator is not supported. diff --git a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md index 4a9ada8b08f..6efb88b17ae 100644 --- a/packages/eslint-plugin/docs/rules/prefer-optional-chain.md +++ b/packages/eslint-plugin/docs/rules/prefer-optional-chain.md @@ -57,13 +57,204 @@ foo?.a?.b?.c?.d?.e; -:::note -There are a few edge cases where this rule will false positive. Use your best judgement when evaluating reported errors. -::: +## Options + +In the context of the descriptions below a "loose boolean" operand is any operand that implicitly coerces the value to a boolean. +Specifically the argument of the not operator (`!loose`) or a bare value in a logical expression (`loose && looser`). + +### `allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing` + +When this option is `true`, the rule will not provide an auto-fixer for cases where the return type of the expression would change. For example for the expression `!foo || foo.bar` the return type of the expression is `true | T`, however for the equivalent optional chain `foo?.bar` the return type of the expression is `undefined | T`. Thus changing the code from a logical expression to an optional chain expression has altered the type of the expression. + +In some cases this distinction _may_ matter - which is why these fixers are considered unsafe - they may break the build! For example in the following code: + +```ts +declare const foo: { bar: boolean } | null | undefined; +declare function acceptsBoolean(arg: boolean): void; + +// ✅ typechecks succesfully as the expression only returns `boolean` +acceptsBoolean(foo != null && foo.bar); + +// ❌ typechecks UNSUCCESSFULLY as the expression returns `boolean | undefined` +acceptsBoolean(foo != null && foo.bar); +``` + +This style of code isn't super common - which means having this option set to `true` _should_ be safe in most codebases. However we default it to `false` due to its unsafe nature. We have provided this option for convenience because it increases the autofix cases covered by the rule. If you set option to `true` the onus is entirely on you and your team to ensure that each fix is correct and safe and that it does not break the build. + +When this option is `false` unsafe cases will have suggestion fixers provided instead of auto-fixers - meaning you can manually apply the fix using your IDE tooling. + +### `checkAny` + +When this option is `true` the rule will check operands that are typed as `any` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `checkAny: true` + +```ts +declare const thing: any; + +thing && thing.toString(); +``` + +#### ✅ Correct for `checkAny: false` + +```ts +declare const thing: any; + +thing && thing.toString(); +``` + + + +### `checkUnknown` + +When this option is `true` the rule will check operands that are typed as `unknown` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `checkUnknown: true` + +```ts +declare const thing: unknown; + +thing && thing.toString(); +``` + +#### ✅ Correct for `checkUnknown: false` + +```ts +declare const thing: unknown; + +thing && thing.toString(); +``` + + + +### `checkString` + +When this option is `true` the rule will check operands that are typed as `string` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `checkString: true` + +```ts +declare const thing: string; + +thing && thing.toString(); +``` + +#### ✅ Correct for `checkString: false` + +```ts +declare const thing: string; + +thing && thing.toString(); +``` + + + +### `checkNumber` + +When this option is `true` the rule will check operands that are typed as `number` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `checkNumber: true` + +```ts +declare const thing: number; + +thing && thing.toString(); +``` + +#### ✅ Correct for `checkNumber: false` + +```ts +declare const thing: number; + +thing && thing.toString(); +``` + + + +### `checkBoolean` + +When this option is `true` the rule will check operands that are typed as `boolean` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `checkBoolean: true` + +```ts +declare const thing: boolean; + +thing && thing.toString(); +``` + +#### ✅ Correct for `checkBoolean: false` + +```ts +declare const thing: boolean; + +thing && thing.toString(); +``` + + + +### `checkBigInt` + +When this option is `true` the rule will check operands that are typed as `bigint` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `checkBigInt: true` + +```ts +declare const thing: bigint; + +thing && thing.toString(); +``` + +#### ✅ Correct for `checkBigInt: false` + +```ts +declare const thing: bigint; + +thing && thing.toString(); +``` + + + +### `requireNullish` + +When this option is `true` the rule will skip operands that are not typed with `null` and/or `undefined` when inspecting "loose boolean" operands. + + + +#### ❌ Incorrect for `requireNullish: true` + +```ts +declare const thing1: string | null; +thing1 && thing1.toString(); +``` + +#### ✅ Correct for `requireNullish: true` + +```ts +declare const thing1: string | null; +thing1?.toString(); + +declare const thing2: string; +thing2 && thing2.toString(); +``` + + ## When Not To Use It -If you don't mind using more explicit `&&`s, you don't need this rule. +If you don't mind using more explicit `&&`s/`||`s, you don't need this rule. ## Further Reading diff --git a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md index b1e912abe37..703b16fa3f0 100644 --- a/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +++ b/packages/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md @@ -129,6 +129,101 @@ interface Foo { ## Options +### `allow` + +Some complex types cannot easily be made readonly, for example the `HTMLElement` type or the `JQueryStatic` type from `@types/jquery`. This option allows you to globally disable reporting of such types. + +Each item must be one of: + +- A type defined in a file (`{from: "file", name: "Foo", path: "src/foo-file.ts"}` with `path` being an optional path relative to the project root directory) +- A type from the default library (`{from: "lib", name: "Foo"}`) +- A type from a package (`{from: "package", name: "Foo", package: "foo-lib"}`, this also works for types defined in a typings package). + +Additionally, a type may be defined just as a simple string, which then matches the type independently of its origin. + +Examples of code for this rule with: + +```json +{ + "allow": [ + "$", + { "source": "file", "name": "Foo" }, + { "source": "lib", "name": "HTMLElement" }, + { "from": "package", "name": "Bar", "package": "bar-lib" } + ] +} +``` + + + +#### ❌ Incorrect + +```ts +interface ThisIsMutable { + prop: string; +} + +interface Wrapper { + sub: ThisIsMutable; +} + +interface WrapperWithOther { + readonly sub: Foo; + otherProp: string; +} + +function fn1(arg: ThisIsMutable) {} // Incorrect because ThisIsMutable is not readonly +function fn2(arg: Wrapper) {} // Incorrect because Wrapper.sub is not readonly +function fn3(arg: WrapperWithOther) {} // Incorrect because WrapperWithOther.otherProp is not readonly and not in the allowlist +``` + +```ts +import { Foo } from 'some-lib'; +import { Bar } from 'incorrect-lib'; + +interface HTMLElement { + prop: string; +} + +function fn1(arg: Foo) {} // Incorrect because Foo is not a local type +function fn2(arg: HTMLElement) {} // Incorrect because HTMLElement is not from the default library +function fn3(arg: Bar) {} // Incorrect because Bar is not from "bar-lib" +``` + +#### ✅ Correct + +```ts +interface Foo { + prop: string; +} + +interface Wrapper { + readonly sub: Foo; + readonly otherProp: string; +} + +function fn1(arg: Foo) {} // Works because Foo is allowed +function fn2(arg: Wrapper) {} // Works even when Foo is nested somewhere in the type, with other properties still being checked +``` + +```ts +import { Bar } from 'bar-lib'; + +interface Foo { + prop: string; +} + +function fn1(arg: Foo) {} // Works because Foo is a local type +function fn2(arg: HTMLElement) {} // Works because HTMLElement is from the default library +function fn3(arg: Bar) {} // Works because Bar is from "bar-lib" +``` + +```ts +import { Foo } from './foo'; + +function fn(arg: Foo) {} // Works because Foo is still a local type - it has to be in the same package +``` + ### `checkParameterProperties` This option allows you to enable or disable the checking of parameter properties. diff --git a/packages/eslint-plugin/docs/rules/require-await.md b/packages/eslint-plugin/docs/rules/require-await.md index f4ccd6fc21a..dcc86305d25 100644 --- a/packages/eslint-plugin/docs/rules/require-await.md +++ b/packages/eslint-plugin/docs/rules/require-await.md @@ -20,5 +20,3 @@ async function returnsPromise1() { const returnsPromise2 = () => returnsPromise1(); ``` - -## How to Use diff --git a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md index fc823f6da9f..9428ea11524 100644 --- a/packages/eslint-plugin/docs/rules/restrict-plus-operands.md +++ b/packages/eslint-plugin/docs/rules/restrict-plus-operands.md @@ -18,70 +18,180 @@ This rule reports when a `+` operation combines two values of different types, o ### ❌ Incorrect ```ts -var foo = '5.5' + 5; -var foo = 1n + 1; +let foo = '5.5' + 5; +let foo = 1n + 1; ``` ### ✅ Correct ```ts -var foo = parseInt('5.5', 10) + 10; -var foo = 1n + 1n; +let foo = parseInt('5.5', 10) + 10; +let foo = 1n + 1n; ``` ## Options -### `checkCompoundAssignments` +:::caution +We generally recommend against using these options, as they limit which varieties of incorrect `+` usage can be checked. +This in turn severely limits the validation that the rule can do to ensure that resulting strings and numbers are correct. + +Safer alternatives to using the `allow*` options include: + +- Using variadic forms of logging APIs to avoid needing to `+` values. + ```ts + // Remove this line + console.log('The result is ' + true); + // Add this line + console.log('The result is', true); + ``` +- Using `.toFixed()` to coerce numbers to well-formed string representations: + ```ts + const number = 1.123456789; + const result = 'The number is ' + number.toFixed(2); + // result === 'The number is 1.12' + ``` +- Calling `.toString()` on other types to mark explicit and intentional string coercion: + ```ts + const arg = '11'; + const regex = /[0-9]/; + const result = + 'The result of ' + + regex.toString() + + '.test("' + + arg + + '") is ' + + regex.test(arg).toString(); + // result === 'The result of /[0-9]/.test("11") is true' + ``` + +::: -Examples of code for this rule with `{ checkCompoundAssignments: true }`: +### `allowAny` + +Examples of code for this rule with `{ allowAny: true }`: #### ❌ Incorrect ```ts -/*eslint @typescript-eslint/restrict-plus-operands: ["error", { "checkCompoundAssignments": true }]*/ +let fn = (a: number, b: []) => a + b; +let fn = (a: string, b: []) => a + b; +``` -let foo: string | undefined; -foo += 'some data'; +#### ✅ Correct -let bar: string = ''; -bar += 0; +```ts +let fn = (a: number, b: any) => a + b; +let fn = (a: string, b: any) => a + b; +``` + +### `allowBoolean` + +Examples of code for this rule with `{ allowBoolean: true }`: + + + +#### ❌ Incorrect + +```ts +let fn = (a: number, b: unknown) => a + b; +let fn = (a: string, b: unknown) => a + b; ``` #### ✅ Correct ```ts -/*eslint @typescript-eslint/restrict-plus-operands: ["error", { "checkCompoundAssignments": true }]*/ +let fn = (a: number, b: boolean) => a + b; +let fn = (a: string, b: boolean) => a + b; +``` -let foo: number = 0; -foo += 1; +### `allowNullish` -let bar = ''; -bar += 'test'; +Examples of code for this rule with `{ allowNullish: true }`: + + + +#### ❌ Incorrect + +```ts +let fn = (a: number, b: unknown) => a + b; +let fn = (a: number, b: never) => a + b; +let fn = (a: string, b: unknown) => a + b; +let fn = (a: string, b: never) => a + b; ``` -### `allowAny` +#### ✅ Correct -Examples of code for this rule with `{ allowAny: true }`: +```ts +let fn = (a: number, b: undefined) => a + b; +let fn = (a: number, b: null) => a + b; +let fn = (a: string, b: undefined) => a + b; +let fn = (a: string, b: null) => a + b; +``` + +### `allowNumberAndString` + +Examples of code for this rule with `{ allowNumberAndString: true }`: #### ❌ Incorrect ```ts -var fn = (a: any, b: boolean) => a + b; -var fn = (a: any, b: []) => a + b; -var fn = (a: any, b: {}) => a + b; +let fn = (a: number, b: unknown) => a + b; +let fn = (a: number, b: never) => a + b; ``` #### ✅ Correct ```ts -var fn = (a: any, b: any) => a + b; -var fn = (a: any, b: string) => a + b; -var fn = (a: any, b: bigint) => a + b; -var fn = (a: any, b: number) => a + b; +let fn = (a: number, b: string) => a + b; +let fn = (a: number, b: number | string) => a + b; +``` + +### `allowRegExp` + +Examples of code for this rule with `{ allowRegExp: true }`: + + + +#### ❌ Incorrect + +```ts +let fn = (a: number, b: RegExp) => a + b; +``` + +#### ✅ Correct + +```ts +let fn = (a: string, b: RegExp) => a + b; +``` + +### `skipCompoundAssignments` + +Examples of code for this rule with `{ skipCompoundAssignments: true }`: + + + +#### ❌ Incorrect + +```ts +let foo: string | undefined; +foo += 'some data'; + +let bar: string = ''; +bar += 0; +``` + +#### ✅ Correct + +```ts +let foo: number = 0; +foo += 1; + +let bar = ''; +bar += 'test'; ``` ## When Not To Use It diff --git a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md index d7afae0ee26..eeb7c488160 100644 --- a/packages/eslint-plugin/docs/rules/restrict-template-expressions.md +++ b/packages/eslint-plugin/docs/rules/restrict-template-expressions.md @@ -6,9 +6,19 @@ description: 'Enforce template literal expressions to be of `string` type.' > > See **https://typescript-eslint.io/rules/restrict-template-expressions** for documentation. -JavaScript will call `toString()` on an object when it is converted to a string, such as when `+` adding to a string or in `${}` template literals. -The default Object `.toString()` returns `"[object Object]"`, which is often not what was intended. -This rule reports on values used in a template literal string that aren't primitives and don't define a more useful `.toString()` method. +JavaScript automatically [converts an object to a string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion) in a string context, such as when concatenating it with a string using `+` or embedding it in a template literal using `${}`. +The default `toString()` method of objects returns `"[object Object]"`, which is often not what was intended. +This rule reports on values used in a template literal string that aren't strings, numbers, or BigInts, optionally allowing other data types that provide useful stringification results. + +:::note + +This rule intentionally does not allow objects with a custom `toString()` method to be used in template literals, because the stringification result may not be user-friendly. + +For example, arrays have a custom [`toString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString) method, which only calls `join()` internally, which joins the array elements with commas. This means that (1) array elements are not necessarily stringified to useful results (2) the commas don't have spaces after them, making the result not user-friendly. The best way to format arrays is to use [`Intl.ListFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/ListFormat), which even supports adding the "and" conjunction where necessary. +You must explicitly call `object.toString()` if you want to use this object in a template literal. +The [`no-base-to-string`](./no-base-to-string.md) rule can be used to guard this case against producing `"[object Object]"` by accident. + +::: ## Examples @@ -47,6 +57,8 @@ const msg1 = `arg = ${arg}`; const msg2 = `arg = ${arg || 'zero'}`; ``` +This option controls both numbers and BigInts. + ### `allowBoolean` Examples of additional **correct** code for this rule with `{ allowBoolean: true }`: diff --git a/packages/eslint-plugin/docs/rules/sort-type-constituents.md b/packages/eslint-plugin/docs/rules/sort-type-constituents.md index 264ef2b52df..025e31ccad4 100644 --- a/packages/eslint-plugin/docs/rules/sort-type-constituents.md +++ b/packages/eslint-plugin/docs/rules/sort-type-constituents.md @@ -60,18 +60,18 @@ type T2 = { a: string } & { b: string }; type T3 = [1, 2, 3] & [1, 2, 4]; type T4 = - | any - | string | A | B | number[] | string[] + | any + | string | readonly number[] | readonly string[] | 'a' - | 'b' | 'a' | 'b' + | 'b' | (() => string) | (() => void) | { a: string } diff --git a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md b/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md deleted file mode 100644 index edaa195df6b..00000000000 --- a/packages/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -description: 'Enforce members of a type union/intersection to be sorted alphabetically.' ---- - -> 🛑 This file is source code, not the primary documentation location! 🛑 -> -> See **https://typescript-eslint.io/rules/sort-type-union-intersection-members** for documentation. - -:::danger Deprecated - -This rule has been renamed to [`sort-type-constituents`](./sort-type-constituents.md). -::: - -Sorting union (`|`) and intersection (`&`) types can help: - -- keep your codebase standardized -- find repeated types -- reduce diff churn - -This rule reports on any types that aren't sorted alphabetically. - -> Types are sorted case-insensitively and treating numbers like a human would, falling back to character code sorting in case of ties. - -## Examples - - - -### ❌ Incorrect - -```ts -type T1 = B | A; - -type T2 = { b: string } & { a: string }; - -type T3 = [1, 2, 4] & [1, 2, 3]; - -type T4 = - | [1, 2, 4] - | [1, 2, 3] - | { b: string } - | { a: string } - | (() => void) - | (() => string) - | 'b' - | 'a' - | 'b' - | 'a' - | readonly string[] - | readonly number[] - | string[] - | number[] - | B - | A - | string - | any; -``` - -### ✅ Correct - -```ts -type T1 = A | B; - -type T2 = { a: string } & { b: string }; - -type T3 = [1, 2, 3] & [1, 2, 4]; - -type T4 = - | any - | string - | A - | B - | number[] - | string[] - | readonly number[] - | readonly string[] - | 'a' - | 'b' - | 'a' - | 'b' - | (() => string) - | (() => void) - | { a: string } - | { b: string } - | [1, 2, 3] - | [1, 2, 4]; -``` - -## Options - -### `groupOrder` - -Each member of the type is placed into a group, and then the rule sorts alphabetically within each group. -The ordering of groups is determined by this option. - -- `conditional` - Conditional types (`A extends B ? C : D`) -- `function` - Function and constructor types (`() => void`, `new () => type`) -- `import` - Import types (`import('path')`) -- `intersection` - Intersection types (`A & B`) -- `keyword` - Keyword types (`any`, `string`, etc) -- `literal` - Literal types (`1`, `'b'`, `true`, etc) -- `named` - Named types (`A`, `A['prop']`, `B[]`, `Array`) -- `object` - Object types (`{ a: string }`, `{ [key: string]: number }`) -- `operator` - Operator types (`keyof A`, `typeof B`, `readonly C[]`) -- `tuple` - Tuple types (`[A, B, C]`) -- `union` - Union types (`A | B`) -- `nullish` - `null` and `undefined` diff --git a/packages/eslint-plugin/docs/rules/triple-slash-reference.md b/packages/eslint-plugin/docs/rules/triple-slash-reference.md index f48f7c98497..af8fa6da529 100644 --- a/packages/eslint-plugin/docs/rules/triple-slash-reference.md +++ b/packages/eslint-plugin/docs/rules/triple-slash-reference.md @@ -10,8 +10,6 @@ TypeScript's `///` triple-slash references are a way to indicate that types from Use of triple-slash reference type directives is generally discouraged in favor of ECMAScript Module `import`s. This rule reports on the use of `/// `, `/// `, or `/// ` directives. -## Examples - ## Options With `{ "path": "never", "types": "never", "lib": "never" }` options set, the following will all be **incorrect** usage: diff --git a/packages/eslint-plugin/docs/rules/type-annotation-spacing.md b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md index 36cfab06592..090ddf5f9b9 100644 --- a/packages/eslint-plugin/docs/rules/type-annotation-spacing.md +++ b/packages/eslint-plugin/docs/rules/type-annotation-spacing.md @@ -39,10 +39,6 @@ type Foo = (string: name) =>string; This rule aims to enforce specific spacing patterns around type annotations and function types in type literals. -## Options - -Examples of code for this rule with no options at all: - ### ❌ Incorrect @@ -89,9 +85,13 @@ class Foo { type Foo = () => {}; ``` +## Options + ### after -Examples of code for this rule with `{ "before": false, "after": true }`: +```json +{ "before": false, "after": true } +``` @@ -141,7 +141,9 @@ type Foo = ()=> {}; ### before -Examples of code for this rule with `{ "before": true, "after": true }` options: +```json +{ "before": true, "after": true } +``` @@ -191,7 +193,13 @@ type Foo = () => {}; ### overrides - colon -Examples of code for this rule with `{ "before": false, "after": false, overrides: { colon: { before: true, after: true }} }` options: +```json +{ + "before": false, + "after": false, + "overrides": { "colon": { "before": true, "after": true } } +} +``` @@ -245,7 +253,13 @@ type Foo = ()=>{}; ### overrides - arrow -Examples of code for this rule with `{ "before": false, "after": false, overrides: { arrow: { before: true, after: true }} }` options: +```json +{ + "before": false, + "after": false, + "overrides": { "arrow": { "before": true, "after": true } } +} +``` diff --git a/packages/eslint-plugin/docs/rules/unified-signatures.md b/packages/eslint-plugin/docs/rules/unified-signatures.md index 609eb3a7bb5..3ef37a6391a 100644 --- a/packages/eslint-plugin/docs/rules/unified-signatures.md +++ b/packages/eslint-plugin/docs/rules/unified-signatures.md @@ -66,5 +66,3 @@ function f(a: string): void; function f(a: number): void; function f(b: string): void; ``` - -## Options diff --git a/packages/eslint-plugin/index.d.ts b/packages/eslint-plugin/index.d.ts index 53a17f6fc33..7b4715f81f7 100644 --- a/packages/eslint-plugin/index.d.ts +++ b/packages/eslint-plugin/index.d.ts @@ -1,4 +1,9 @@ import type { TSESLint } from '@typescript-eslint/utils'; -export const rules: Record>; -export const configs: Record; +import type rules from './rules'; + +declare const cjsExport: { + configs: Record; + rules: typeof rules; +}; +export = cjsExport; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index fdeb10bd84a..5b2bcd96605 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,24 +1,31 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "5.56.0", + "version": "6.0.0", "description": "TypeScript plugin for ESLint", - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin", - "typescript" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", "docs", "index.d.ts", + "rules.d.ts", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json", + "./use-at-your-own-risk/rules": { + "types": "./rules.d.ts", + "default": "./dist/rules/index.js" + } + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -28,8 +35,12 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "index.d.ts", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "typescript" + ], "scripts": { "build": "tsc -b tsconfig.build.json", "check-docs": "jest tests/docs.test.ts --runTestsByPath --silent --runInBand", @@ -37,43 +48,48 @@ "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:breaking-changes": "yarn tsx tools/generate-breaking-changes.ts", + "generate:breaking-changes": "yarn tsx tools/generate-breaking-changes.mts", "generate:configs": "yarn tsx tools/generate-configs.ts", "lint": "nx lint", "test": "jest --coverage", + "test-single": "jest --no-coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/type-utils": "5.56.0", - "@typescript-eslint/utils": "5.56.0", + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/type-utils": "6.0.0", + "@typescript-eslint/utils": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "devDependencies": { "@types/debug": "*", - "@types/json-schema": "*", "@types/marked": "*", - "@types/natural-compare-lite": "^1.4.0", + "@types/natural-compare": "*", "@types/prettier": "*", - "chalk": "^5.0.1", - "cross-fetch": "^3.1.5", - "grapheme-splitter": "^1.0.4", + "@typescript-eslint/rule-schema-to-typescript-types": "6.0.0", + "@typescript-eslint/rule-tester": "6.0.0", + "ajv": "^6.12.6", + "chalk": "^5.3.0", + "cross-fetch": "*", + "jest-specific-snapshot": "*", "json-schema": "*", - "markdown-table": "^3.0.2", - "marked": "^4.0.15", + "markdown-table": "^3.0.3", + "marked": "^5.1.1", "prettier": "*", "title-case": "^3.0.3", "typescript": "*" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index 72ca4c7a9d0..2b5c17d2ff5 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -5,10 +5,11 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/eslint-plugin/**/*.ts"] + "lintFilePatterns": ["packages/eslint-plugin/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/eslint-plugin/rules.d.ts b/packages/eslint-plugin/rules.d.ts new file mode 100644 index 00000000000..9a5272d205c --- /dev/null +++ b/packages/eslint-plugin/rules.d.ts @@ -0,0 +1,44 @@ +/* +We purposely don't generate types for our plugin because TL;DR: +1) there's no real reason that anyone should do a typed import of our rules, +2) it would require us to change our code so there aren't as many inferred types + +This type declaration exists as a hacky way to add a type to the export for our +internal packages that require it. + +*** Long reason *** + +When you turn on declaration files, TS requires all types to be "fully resolvable" +without changes to the code. +All of our lint rules `export default createRule(...)`, which means they all +implicitly reference the `TSESLint.Rule` type for the export. + +TS wants to transpile each rule file to this `.d.ts` file: + +```ts +import type { TSESLint } from '@typescript-eslint/utils'; +declare const _default: TSESLint.RuleModule; +export default _default; +``` + +Because we don't import `TSESLint` in most files, it means that TS would have to +insert a new import during the declaration emit to make this work. +However TS wants to avoid adding new imports to the file because a new module +could have type side-effects (like global augmentation) which could cause weird +type side-effects in the decl file that wouldn't exist in source TS file. + +So TS errors on most of our rules with the following error: +``` +The inferred type of 'default' cannot be named without a reference to +'../../../../node_modules/@typescript-eslint/utils/src/ts-eslint/Rule'. +This is likely not portable. A type annotation is necessary. ts(2742) +``` +*/ + +import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'; + +export interface TypeScriptESLintRules { + [ruleName: string]: RuleModule; +} +declare const rules: TypeScriptESLintRules; +export = rules; diff --git a/packages/eslint-plugin/src/configs/all.ts b/packages/eslint-plugin/src/configs/all.ts index 63ce9b1305a..184a241a66f 100644 --- a/packages/eslint-plugin/src/configs/all.ts +++ b/packages/eslint-plugin/src/configs/all.ts @@ -1,6 +1,9 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// YOU CAN REGENERATE IT USING yarn generate:configs +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` export = { extends: ['./configs/base', './configs/eslint-recommended'], @@ -59,6 +62,7 @@ export = { 'no-dupe-class-members': 'off', '@typescript-eslint/no-dupe-class-members': 'error', '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', '@typescript-eslint/no-dynamic-delete': 'error', 'no-empty-function': 'off', '@typescript-eslint/no-empty-function': 'error', @@ -104,7 +108,6 @@ export = { '@typescript-eslint/no-this-alias': 'error', 'no-throw-literal': 'off', '@typescript-eslint/no-throw-literal': 'error', - '@typescript-eslint/no-type-alias': 'error', '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', '@typescript-eslint/no-unnecessary-condition': 'error', '@typescript-eslint/no-unnecessary-qualifier': 'error', @@ -115,6 +118,7 @@ export = { '@typescript-eslint/no-unsafe-assignment': 'error', '@typescript-eslint/no-unsafe-call': 'error', '@typescript-eslint/no-unsafe-declaration-merging': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', '@typescript-eslint/no-unsafe-member-access': 'error', '@typescript-eslint/no-unsafe-return': 'error', 'no-unused-expressions': 'off', diff --git a/packages/eslint-plugin/src/configs/base.ts b/packages/eslint-plugin/src/configs/base.ts index 528e00c7778..628ed42b760 100644 --- a/packages/eslint-plugin/src/configs/base.ts +++ b/packages/eslint-plugin/src/configs/base.ts @@ -1,6 +1,9 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// YOU CAN REGENERATE IT USING yarn generate:configs +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` export = { parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/src/configs/disable-type-checked.ts b/packages/eslint-plugin/src/configs/disable-type-checked.ts new file mode 100644 index 00000000000..38a7ffd079d --- /dev/null +++ b/packages/eslint-plugin/src/configs/disable-type-checked.ts @@ -0,0 +1,57 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +export = { + parserOptions: { project: null, program: null }, + rules: { + '@typescript-eslint/await-thenable': 'off', + '@typescript-eslint/consistent-type-exports': 'off', + '@typescript-eslint/dot-notation': 'off', + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/no-base-to-string': 'off', + '@typescript-eslint/no-confusing-void-expression': 'off', + '@typescript-eslint/no-duplicate-type-constituents': 'off', + '@typescript-eslint/no-floating-promises': 'off', + '@typescript-eslint/no-for-in-array': 'off', + '@typescript-eslint/no-implied-eval': 'off', + '@typescript-eslint/no-meaningless-void-operator': 'off', + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/no-mixed-enums': 'off', + '@typescript-eslint/no-redundant-type-constituents': 'off', + '@typescript-eslint/no-throw-literal': 'off', + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off', + '@typescript-eslint/no-unnecessary-condition': 'off', + '@typescript-eslint/no-unnecessary-qualifier': 'off', + '@typescript-eslint/no-unnecessary-type-arguments': 'off', + '@typescript-eslint/no-unnecessary-type-assertion': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-enum-comparison': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/non-nullable-type-assertion-style': 'off', + '@typescript-eslint/prefer-includes': 'off', + '@typescript-eslint/prefer-nullish-coalescing': 'off', + '@typescript-eslint/prefer-optional-chain': 'off', + '@typescript-eslint/prefer-readonly': 'off', + '@typescript-eslint/prefer-readonly-parameter-types': 'off', + '@typescript-eslint/prefer-reduce-type-parameter': 'off', + '@typescript-eslint/prefer-regexp-exec': 'off', + '@typescript-eslint/prefer-return-this-type': 'off', + '@typescript-eslint/prefer-string-starts-ends-with': 'off', + '@typescript-eslint/promise-function-async': 'off', + '@typescript-eslint/require-array-sort-compare': 'off', + '@typescript-eslint/require-await': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/return-await': 'off', + '@typescript-eslint/strict-boolean-expressions': 'off', + '@typescript-eslint/switch-exhaustiveness-check': 'off', + '@typescript-eslint/unbound-method': 'off', + }, +}; diff --git a/packages/eslint-plugin/src/configs/eslint-recommended.ts b/packages/eslint-plugin/src/configs/eslint-recommended.ts index af3c0050c01..d6e13341060 100644 --- a/packages/eslint-plugin/src/configs/eslint-recommended.ts +++ b/packages/eslint-plugin/src/configs/eslint-recommended.ts @@ -28,7 +28,6 @@ export = { 'prefer-const': 'error', // ts provides better types with const 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply - 'valid-typeof': 'off', // ts(2367) }, }, ], diff --git a/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts b/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts deleted file mode 100644 index 369d33d6687..00000000000 --- a/packages/eslint-plugin/src/configs/recommended-requiring-type-checking.ts +++ /dev/null @@ -1,26 +0,0 @@ -// THIS CODE WAS AUTOMATICALLY GENERATED -// DO NOT EDIT THIS CODE BY HAND -// YOU CAN REGENERATE IT USING yarn generate:configs - -export = { - extends: ['./configs/base', './configs/eslint-recommended'], - rules: { - '@typescript-eslint/await-thenable': 'error', - '@typescript-eslint/no-floating-promises': 'error', - '@typescript-eslint/no-for-in-array': 'error', - 'no-implied-eval': 'off', - '@typescript-eslint/no-implied-eval': 'error', - '@typescript-eslint/no-misused-promises': 'error', - '@typescript-eslint/no-unnecessary-type-assertion': 'error', - '@typescript-eslint/no-unsafe-argument': 'error', - '@typescript-eslint/no-unsafe-assignment': 'error', - '@typescript-eslint/no-unsafe-call': 'error', - '@typescript-eslint/no-unsafe-member-access': 'error', - '@typescript-eslint/no-unsafe-return': 'error', - 'require-await': 'off', - '@typescript-eslint/require-await': 'error', - '@typescript-eslint/restrict-plus-operands': 'error', - '@typescript-eslint/restrict-template-expressions': 'error', - '@typescript-eslint/unbound-method': 'error', - }, -}; diff --git a/packages/eslint-plugin/src/configs/recommended-type-checked.ts b/packages/eslint-plugin/src/configs/recommended-type-checked.ts new file mode 100644 index 00000000000..ab0f5039461 --- /dev/null +++ b/packages/eslint-plugin/src/configs/recommended-type-checked.ts @@ -0,0 +1,53 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/ban-types': 'error', + 'no-array-constructor': 'off', + '@typescript-eslint/no-array-constructor': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-extra-non-null-assertion': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + 'no-loss-of-precision': 'off', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/no-var-requires': 'error', + '@typescript-eslint/prefer-as-const': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/triple-slash-reference': 'error', + '@typescript-eslint/unbound-method': 'error', + }, +}; diff --git a/packages/eslint-plugin/src/configs/recommended.ts b/packages/eslint-plugin/src/configs/recommended.ts index 10b1d04581f..d8654cd45e0 100644 --- a/packages/eslint-plugin/src/configs/recommended.ts +++ b/packages/eslint-plugin/src/configs/recommended.ts @@ -1,36 +1,32 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// YOU CAN REGENERATE IT USING yarn generate:configs +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` export = { extends: ['./configs/base', './configs/eslint-recommended'], rules: { - '@typescript-eslint/adjacent-overload-signatures': 'error', '@typescript-eslint/ban-ts-comment': 'error', '@typescript-eslint/ban-types': 'error', 'no-array-constructor': 'off', '@typescript-eslint/no-array-constructor': 'error', - 'no-empty-function': 'off', - '@typescript-eslint/no-empty-function': 'error', - '@typescript-eslint/no-empty-interface': 'error', - '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-extra-non-null-assertion': 'error', - 'no-extra-semi': 'off', - '@typescript-eslint/no-extra-semi': 'error', - '@typescript-eslint/no-inferrable-types': 'error', 'no-loss-of-precision': 'off', '@typescript-eslint/no-loss-of-precision': 'error', '@typescript-eslint/no-misused-new': 'error', '@typescript-eslint/no-namespace': 'error', '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', - '@typescript-eslint/no-non-null-assertion': 'warn', '@typescript-eslint/no-this-alias': 'error', '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', 'no-unused-vars': 'off', - '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/no-unused-vars': 'error', '@typescript-eslint/no-var-requires': 'error', '@typescript-eslint/prefer-as-const': 'error', - '@typescript-eslint/prefer-namespace-keyword': 'error', '@typescript-eslint/triple-slash-reference': 'error', }, }; diff --git a/packages/eslint-plugin/src/configs/strict-type-checked.ts b/packages/eslint-plugin/src/configs/strict-type-checked.ts new file mode 100644 index 00000000000..dfba0b81c7f --- /dev/null +++ b/packages/eslint-plugin/src/configs/strict-type-checked.ts @@ -0,0 +1,74 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/ban-types': 'error', + 'no-array-constructor': 'off', + '@typescript-eslint/no-array-constructor': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-confusing-void-expression': 'error', + '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-dynamic-delete': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-extra-non-null-assertion': 'error', + '@typescript-eslint/no-extraneous-class': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + '@typescript-eslint/no-invalid-void-type': 'error', + 'no-loss-of-precision': 'off', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-meaningless-void-operator': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-mixed-enums': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + '@typescript-eslint/no-non-null-assertion': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + '@typescript-eslint/no-this-alias': 'error', + 'no-throw-literal': 'off', + '@typescript-eslint/no-throw-literal': 'error', + '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error', + '@typescript-eslint/no-unnecessary-condition': 'error', + '@typescript-eslint/no-unnecessary-type-arguments': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'error', + 'no-useless-constructor': 'off', + '@typescript-eslint/no-useless-constructor': 'error', + '@typescript-eslint/no-var-requires': 'error', + '@typescript-eslint/prefer-as-const': 'error', + '@typescript-eslint/prefer-includes': 'error', + '@typescript-eslint/prefer-literal-enum-member': 'error', + '@typescript-eslint/prefer-reduce-type-parameter': 'error', + '@typescript-eslint/prefer-return-this-type': 'error', + '@typescript-eslint/prefer-ts-expect-error': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/triple-slash-reference': 'error', + '@typescript-eslint/unbound-method': 'error', + '@typescript-eslint/unified-signatures': 'error', + }, +}; diff --git a/packages/eslint-plugin/src/configs/strict.ts b/packages/eslint-plugin/src/configs/strict.ts index c63b4173452..98553e52bf7 100644 --- a/packages/eslint-plugin/src/configs/strict.ts +++ b/packages/eslint-plugin/src/configs/strict.ts @@ -1,47 +1,42 @@ // THIS CODE WAS AUTOMATICALLY GENERATED // DO NOT EDIT THIS CODE BY HAND -// YOU CAN REGENERATE IT USING yarn generate:configs +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` export = { extends: ['./configs/base', './configs/eslint-recommended'], rules: { - '@typescript-eslint/array-type': 'warn', - '@typescript-eslint/ban-tslint-comment': 'warn', - '@typescript-eslint/class-literal-property-style': 'warn', - '@typescript-eslint/consistent-generic-constructors': 'warn', - '@typescript-eslint/consistent-indexed-object-style': 'warn', - '@typescript-eslint/consistent-type-assertions': 'warn', - '@typescript-eslint/consistent-type-definitions': 'warn', - 'dot-notation': 'off', - '@typescript-eslint/dot-notation': 'warn', - '@typescript-eslint/no-base-to-string': 'warn', - '@typescript-eslint/no-confusing-non-null-assertion': 'warn', - '@typescript-eslint/no-duplicate-enum-values': 'warn', - '@typescript-eslint/no-dynamic-delete': 'warn', - '@typescript-eslint/no-extraneous-class': 'warn', - '@typescript-eslint/no-invalid-void-type': 'warn', - '@typescript-eslint/no-meaningless-void-operator': 'warn', - '@typescript-eslint/no-mixed-enums': 'warn', - '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'warn', - 'no-throw-literal': 'off', - '@typescript-eslint/no-throw-literal': 'warn', - '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn', - '@typescript-eslint/no-unnecessary-condition': 'warn', - '@typescript-eslint/no-unnecessary-type-arguments': 'warn', - '@typescript-eslint/no-unsafe-declaration-merging': 'warn', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/ban-types': 'error', + 'no-array-constructor': 'off', + '@typescript-eslint/no-array-constructor': 'error', + '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-dynamic-delete': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-extra-non-null-assertion': 'error', + '@typescript-eslint/no-extraneous-class': 'error', + '@typescript-eslint/no-invalid-void-type': 'error', + 'no-loss-of-precision': 'off', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + '@typescript-eslint/no-non-null-assertion': 'error', + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'error', 'no-useless-constructor': 'off', - '@typescript-eslint/no-useless-constructor': 'warn', - '@typescript-eslint/non-nullable-type-assertion-style': 'warn', - '@typescript-eslint/prefer-for-of': 'warn', - '@typescript-eslint/prefer-function-type': 'warn', - '@typescript-eslint/prefer-includes': 'warn', - '@typescript-eslint/prefer-literal-enum-member': 'warn', - '@typescript-eslint/prefer-nullish-coalescing': 'warn', - '@typescript-eslint/prefer-optional-chain': 'warn', - '@typescript-eslint/prefer-reduce-type-parameter': 'warn', - '@typescript-eslint/prefer-return-this-type': 'warn', - '@typescript-eslint/prefer-string-starts-ends-with': 'warn', - '@typescript-eslint/prefer-ts-expect-error': 'warn', - '@typescript-eslint/unified-signatures': 'warn', + '@typescript-eslint/no-useless-constructor': 'error', + '@typescript-eslint/no-var-requires': 'error', + '@typescript-eslint/prefer-as-const': 'error', + '@typescript-eslint/prefer-literal-enum-member': 'error', + '@typescript-eslint/prefer-ts-expect-error': 'error', + '@typescript-eslint/triple-slash-reference': 'error', + '@typescript-eslint/unified-signatures': 'error', }, }; diff --git a/packages/eslint-plugin/src/configs/stylistic-type-checked.ts b/packages/eslint-plugin/src/configs/stylistic-type-checked.ts new file mode 100644 index 00000000000..5c73ae3845b --- /dev/null +++ b/packages/eslint-plugin/src/configs/stylistic-type-checked.ts @@ -0,0 +1,34 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/array-type': 'error', + '@typescript-eslint/ban-tslint-comment': 'error', + '@typescript-eslint/class-literal-property-style': 'error', + '@typescript-eslint/consistent-generic-constructors': 'error', + '@typescript-eslint/consistent-indexed-object-style': 'error', + '@typescript-eslint/consistent-type-assertions': 'error', + '@typescript-eslint/consistent-type-definitions': 'error', + 'dot-notation': 'off', + '@typescript-eslint/dot-notation': 'error', + '@typescript-eslint/no-confusing-non-null-assertion': 'error', + 'no-empty-function': 'off', + '@typescript-eslint/no-empty-function': 'error', + '@typescript-eslint/no-empty-interface': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + '@typescript-eslint/non-nullable-type-assertion-style': 'error', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-function-type': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/prefer-string-starts-ends-with': 'error', + }, +}; diff --git a/packages/eslint-plugin/src/configs/stylistic.ts b/packages/eslint-plugin/src/configs/stylistic.ts new file mode 100644 index 00000000000..863a50eecda --- /dev/null +++ b/packages/eslint-plugin/src/configs/stylistic.ts @@ -0,0 +1,28 @@ +// THIS CODE WAS AUTOMATICALLY GENERATED +// DO NOT EDIT THIS CODE BY HAND +// SEE https://typescript-eslint.io/linting/configs +// +// For developers working in the typescript-eslint monorepo: +// You can regenerate it using `yarn generate:configs` + +export = { + extends: ['./configs/base', './configs/eslint-recommended'], + rules: { + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/array-type': 'error', + '@typescript-eslint/ban-tslint-comment': 'error', + '@typescript-eslint/class-literal-property-style': 'error', + '@typescript-eslint/consistent-generic-constructors': 'error', + '@typescript-eslint/consistent-indexed-object-style': 'error', + '@typescript-eslint/consistent-type-assertions': 'error', + '@typescript-eslint/consistent-type-definitions': 'error', + '@typescript-eslint/no-confusing-non-null-assertion': 'error', + 'no-empty-function': 'off', + '@typescript-eslint/no-empty-function': 'error', + '@typescript-eslint/no-empty-interface': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-function-type': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', + }, +}; diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts index 03899ac43cb..ece2bb0a20f 100644 --- a/packages/eslint-plugin/src/index.ts +++ b/packages/eslint-plugin/src/index.ts @@ -1,19 +1,29 @@ import all from './configs/all'; import base from './configs/base'; +import disableTypeChecked from './configs/disable-type-checked'; import eslintRecommended from './configs/eslint-recommended'; import recommended from './configs/recommended'; -import recommendedRequiringTypeChecking from './configs/recommended-requiring-type-checking'; +import recommendedTypeChecked from './configs/recommended-type-checked'; import strict from './configs/strict'; +import strictTypeChecked from './configs/strict-type-checked'; +import stylistic from './configs/stylistic'; +import stylisticTypeChecked from './configs/stylistic-type-checked'; import rules from './rules'; export = { - rules, configs: { all, base, - recommended, + 'disable-type-checked': disableTypeChecked, 'eslint-recommended': eslintRecommended, - 'recommended-requiring-type-checking': recommendedRequiringTypeChecking, + recommended, + /** @deprecated - please use "recommended-type-checked" instead. */ + 'recommended-requiring-type-checking': recommendedTypeChecked, + 'recommended-type-checked': recommendedTypeChecked, strict, + 'strict-type-checked': strictTypeChecked, + stylistic, + 'stylistic-type-checked': stylisticTypeChecked, }, + rules, }; diff --git a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts index 498a9bf5ae1..0534cc8ce0d 100644 --- a/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts +++ b/packages/eslint-plugin/src/rules/adjacent-overload-signatures.ts @@ -4,12 +4,12 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; type RuleNode = + | TSESTree.BlockStatement | TSESTree.ClassBody | TSESTree.Program - | TSESTree.TSModuleBlock - | TSESTree.TSTypeLiteral | TSESTree.TSInterfaceBody - | TSESTree.BlockStatement; + | TSESTree.TSModuleBlock + | TSESTree.TSTypeLiteral; type Member = | TSESTree.ClassElement | TSESTree.ProgramStatement @@ -21,7 +21,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Require that function overload signatures be consecutive', - recommended: 'error', + recommended: 'stylistic', }, schema: [], messages: { diff --git a/packages/eslint-plugin/src/rules/array-type.ts b/packages/eslint-plugin/src/rules/array-type.ts index f353207e7d5..cd4a1f89cb2 100644 --- a/packages/eslint-plugin/src/rules/array-type.ts +++ b/packages/eslint-plugin/src/rules/array-type.ts @@ -32,14 +32,14 @@ function isSimpleType(node: TSESTree.Node): boolean { node.typeName.type === AST_NODE_TYPES.Identifier && node.typeName.name === 'Array' ) { - if (!node.typeParameters) { + if (!node.typeArguments) { return true; } - if (node.typeParameters.params.length === 1) { - return isSimpleType(node.typeParameters.params[0]); + if (node.typeArguments.params.length === 1) { + return isSimpleType(node.typeArguments.params[0]); } } else { - if (node.typeParameters) { + if (node.typeArguments) { return false; } return isSimpleType(node.typeName); @@ -72,7 +72,7 @@ function typeNeedsParentheses(node: TSESTree.Node): boolean { } } -export type OptionString = 'array' | 'generic' | 'array-simple'; +export type OptionString = 'array-simple' | 'array' | 'generic'; type Options = [ { default: OptionString; @@ -80,9 +80,9 @@ type Options = [ }, ]; type MessageIds = - | 'errorStringGeneric' | 'errorStringArray' | 'errorStringArraySimple' + | 'errorStringGeneric' | 'errorStringGenericSimple'; export default util.createRule({ @@ -92,7 +92,7 @@ export default util.createRule({ docs: { description: 'Require consistently using either `T[]` or `Array` for arrays', - recommended: 'strict', + recommended: 'stylistic', }, fixable: 'code', messages: { @@ -105,30 +105,29 @@ export default util.createRule({ errorStringGenericSimple: "Array type using '{{readonlyPrefix}}{{type}}[]' is forbidden for non-simple types. Use '{{className}}<{{type}}>' instead.", }, - schema: { - $defs: { - arrayOption: { - enum: ['array', 'generic', 'array-simple'], + schema: [ + { + $defs: { + arrayOption: { + type: 'string', + enum: ['array', 'generic', 'array-simple'], + }, }, - }, - prefixItems: [ - { - properties: { - default: { - $ref: '#/$defs/arrayOption', - description: 'The array type expected for mutable cases...', - }, - readonly: { - $ref: '#/$defs/arrayOption', - description: - 'The array type expected for readonly cases. If omitted, the value for `default` will be used.', - }, + additionalProperties: false, + properties: { + default: { + $ref: '#/items/0/$defs/arrayOption', + description: 'The array type expected for mutable cases.', + }, + readonly: { + $ref: '#/items/0/$defs/arrayOption', + description: + 'The array type expected for readonly cases. If omitted, the value for `default` will be used.', }, - type: 'object', }, - ], - type: 'array', - }, + type: 'object', + }, + ], }, defaultOptions: [ { @@ -154,7 +153,6 @@ export default util.createRule({ return { TSArrayType(node): void { const isReadonly = - node.parent && node.parent.type === AST_NODE_TYPES.TSTypeOperator && node.parent.operator === 'readonly'; @@ -171,7 +169,7 @@ export default util.createRule({ currentOption === 'generic' ? 'errorStringGeneric' : 'errorStringGenericSimple'; - const errorNode = isReadonly ? node.parent! : node; + const errorNode = isReadonly ? node.parent : node; context.report({ node: errorNode, @@ -220,7 +218,7 @@ export default util.createRule({ } const readonlyPrefix = isReadonlyArrayType ? 'readonly ' : ''; - const typeParams = node.typeParameters?.params; + const typeParams = node.typeArguments?.params; const messageId = currentOption === 'array' ? 'errorStringArray' diff --git a/packages/eslint-plugin/src/rules/await-thenable.ts b/packages/eslint-plugin/src/rules/await-thenable.ts index ab9f97da7c2..fca9fd83de0 100644 --- a/packages/eslint-plugin/src/rules/await-thenable.ts +++ b/packages/eslint-plugin/src/rules/await-thenable.ts @@ -1,4 +1,4 @@ -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as util from '../util'; @@ -7,7 +7,7 @@ export default util.createRule({ meta: { docs: { description: 'Disallow awaiting a value that is not a Thenable', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -19,19 +19,19 @@ export default util.createRule({ defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { AwaitExpression(node): void { - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(originalNode.expression); + const type = services.getTypeAtLocation(node.argument); + if (util.isTypeAnyType(type) || util.isTypeUnknownType(type)) { + return; + } + + const originalNode = services.esTreeNodeToTSNodeMap.get(node); - if ( - !util.isTypeAnyType(type) && - !util.isTypeUnknownType(type) && - !tsutils.isThenableType(checker, originalNode.expression, type) - ) { + if (!tsutils.isThenableType(checker, originalNode.expression, type)) { context.report({ messageId: 'await', node, diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index 511a951280e..7de0718bde6 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -19,8 +19,8 @@ export const defaultMinimumDescriptionLength = 3; type MessageIds = | 'tsDirectiveComment' - | 'tsDirectiveCommentRequiresDescription' - | 'tsDirectiveCommentDescriptionNotMatchPattern'; + | 'tsDirectiveCommentDescriptionNotMatchPattern' + | 'tsDirectiveCommentRequiresDescription'; export default util.createRule<[Options], MessageIds>({ name: 'ban-ts-comment', @@ -29,7 +29,7 @@ export default util.createRule<[Options], MessageIds>({ docs: { description: 'Disallow `@ts-` comments or require descriptions after directives', - recommended: 'error', + recommended: 'recommended', }, messages: { tsDirectiveComment: @@ -39,45 +39,43 @@ export default util.createRule<[Options], MessageIds>({ tsDirectiveCommentDescriptionNotMatchPattern: 'The description for the "@ts-{{directive}}" directive must match the {{format}} format.', }, - schema: { - $defs: { - directiveConfigSchema: { - oneOf: [ - { - type: 'boolean', - default: true, - }, - { - enum: ['allow-with-description'], - }, - { - type: 'object', - properties: { - descriptionFormat: { type: 'string' }, + schema: [ + { + $defs: { + directiveConfigSchema: { + oneOf: [ + { + type: 'boolean', + default: true, }, - }, - ], + { + type: 'string', + enum: ['allow-with-description'], + }, + { + type: 'object', + additionalProperties: false, + properties: { + descriptionFormat: { type: 'string' }, + }, + }, + ], + }, }, - }, - prefixItems: [ - { - properties: { - 'ts-expect-error': { - $ref: '#/$defs/directiveConfigSchema', - }, - 'ts-ignore': { $ref: '#/$defs/directiveConfigSchema' }, - 'ts-nocheck': { $ref: '#/$defs/directiveConfigSchema' }, - 'ts-check': { $ref: '#/$defs/directiveConfigSchema' }, - minimumDescriptionLength: { - type: 'number', - default: defaultMinimumDescriptionLength, - }, + properties: { + 'ts-expect-error': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-ignore': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-nocheck': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + 'ts-check': { $ref: '#/items/0/$defs/directiveConfigSchema' }, + minimumDescriptionLength: { + type: 'number', + default: defaultMinimumDescriptionLength, }, - additionalProperties: false, }, - ], - type: 'array', - }, + type: 'object', + additionalProperties: false, + }, + ], }, defaultOptions: [ { diff --git a/packages/eslint-plugin/src/rules/ban-tslint-comment.ts b/packages/eslint-plugin/src/rules/ban-tslint-comment.ts index 849fbcc911e..4453649b717 100644 --- a/packages/eslint-plugin/src/rules/ban-tslint-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-tslint-comment.ts @@ -9,7 +9,7 @@ const ENABLE_DISABLE_REGEX = const toText = ( text: string, - type: AST_TOKEN_TYPES.Line | AST_TOKEN_TYPES.Block, + type: AST_TOKEN_TYPES.Block | AST_TOKEN_TYPES.Line, ): string => type === AST_TOKEN_TYPES.Line ? ['//', text.trim()].join(' ') @@ -21,7 +21,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow `// tslint:` comments', - recommended: 'strict', + recommended: 'stylistic', }, messages: { commentDetected: 'tslint comment detected: "{{ text }}"', diff --git a/packages/eslint-plugin/src/rules/ban-types.ts b/packages/eslint-plugin/src/rules/ban-types.ts index f21dda8a249..8352eff2f2d 100644 --- a/packages/eslint-plugin/src/rules/ban-types.ts +++ b/packages/eslint-plugin/src/rules/ban-types.ts @@ -5,13 +5,14 @@ import * as util from '../util'; type Types = Record< string, - | null - | false + | boolean | string | { message: string; fixWith?: string; + suggest?: readonly string[]; } + | null >; export type Options = [ @@ -20,7 +21,7 @@ export type Options = [ extendDefaults?: boolean; }, ]; -export type MessageIds = 'bannedTypeMessage'; +export type MessageIds = 'bannedTypeMessage' | 'bannedTypeReplacement'; function removeSpaces(str: string): string { return str.replace(/\s/g, ''); @@ -34,9 +35,9 @@ function stringifyNode( } function getCustomMessage( - bannedType: null | string | { message?: string; fixWith?: string }, + bannedType: string | true | { message?: string; fixWith?: string } | null, ): string { - if (bannedType == null) { + if (bannedType == null || bannedType === true) { return ''; } @@ -88,7 +89,9 @@ const defaultTypes: Types = { 'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.', '- If you want a type meaning "any object", you probably want `object` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', + '- If you really want a type meaning "any non-nullish value", you probably want `NonNullable` instead.', ].join('\n'), + suggest: ['object', 'unknown', 'NonNullable'], }, '{}': { message: [ @@ -96,7 +99,14 @@ const defaultTypes: Types = { '- If you want a type meaning "any object", you probably want `object` instead.', '- If you want a type meaning "any value", you probably want `unknown` instead.', '- If you want a type meaning "empty object", you probably want `Record` instead.', + '- If you really want a type meaning "any non-nullish value", you probably want `NonNullable` instead.', ].join('\n'), + suggest: [ + 'object', + 'unknown', + 'Record', + 'NonNullable', + ], }, }; @@ -120,32 +130,69 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow certain types', - recommended: 'error', + recommended: 'recommended', }, fixable: 'code', + hasSuggestions: true, messages: { bannedTypeMessage: "Don't use `{{name}}` as a type.{{customMessage}}", + bannedTypeReplacement: 'Replace `{{name}}` with `{{replacement}}`.', }, schema: [ { + $defs: { + banConfig: { + oneOf: [ + { + type: 'null', + description: 'Bans the type with the default message', + }, + { + type: 'boolean', + enum: [false], + description: + 'Un-bans the type (useful when paired with `extendDefaults`)', + }, + { + type: 'boolean', + enum: [true], + description: 'Bans the type with the default message', + }, + { + type: 'string', + description: 'Bans the type with a custom message', + }, + { + type: 'object', + description: 'Bans a type', + properties: { + message: { + type: 'string', + description: 'Custom error message', + }, + fixWith: { + type: 'string', + description: + 'Type to autofix replace with. Note that autofixers can be applied automatically - so you need to be careful with this option.', + }, + suggest: { + type: 'array', + items: { type: 'string' }, + description: 'Types to suggest replacing with.', + additionalItems: false, + }, + }, + additionalProperties: false, + }, + ], + }, + }, type: 'object', properties: { types: { type: 'object', additionalProperties: { - oneOf: [ - { type: 'null' }, - { type: 'boolean' }, - { type: 'string' }, - { - type: 'object', - properties: { - message: { type: 'string' }, - fixWith: { type: 'string' }, - }, - additionalProperties: false, - }, - ], + $ref: '#/items/0/$defs/banConfig', }, }, extendDefaults: { @@ -182,6 +229,10 @@ export default util.createRule({ const customMessage = getCustomMessage(bannedType); const fixWith = bannedType && typeof bannedType === 'object' && bannedType.fixWith; + const suggest = + bannedType && typeof bannedType === 'object' + ? bannedType.suggest + : undefined; context.report({ node: typeNode, @@ -193,6 +244,15 @@ export default util.createRule({ fix: fixWith ? (fixer): TSESLint.RuleFix => fixer.replaceText(typeNode, fixWith) : null, + suggest: suggest?.map(replacement => ({ + messageId: 'bannedTypeReplacement', + data: { + name, + replacement, + }, + fix: (fixer): TSESLint.RuleFix => + fixer.replaceText(typeNode, replacement), + })), }); } @@ -227,10 +287,16 @@ export default util.createRule({ TSTypeReference(node): void { checkBannedTypes(node.typeName); - if (node.typeParameters) { + if (node.typeArguments) { checkBannedTypes(node); } }, + TSInterfaceHeritage(node): void { + checkBannedTypes(node); + }, + TSClassImplements(node): void { + checkBannedTypes(node); + }, }; }, }); diff --git a/packages/eslint-plugin/src/rules/block-spacing.ts b/packages/eslint-plugin/src/rules/block-spacing.ts index 745132978f7..8141a979cf0 100644 --- a/packages/eslint-plugin/src/rules/block-spacing.ts +++ b/packages/eslint-plugin/src/rules/block-spacing.ts @@ -16,7 +16,6 @@ export default util.createRule({ docs: { description: 'Disallow or enforce spaces inside of blocks after opening block and before closing block', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', diff --git a/packages/eslint-plugin/src/rules/brace-style.ts b/packages/eslint-plugin/src/rules/brace-style.ts index 43d4ba63c3c..2e471cb8853 100644 --- a/packages/eslint-plugin/src/rules/brace-style.ts +++ b/packages/eslint-plugin/src/rules/brace-style.ts @@ -18,7 +18,6 @@ export default createRule({ type: 'layout', docs: { description: 'Enforce consistent brace style for blocks', - recommended: false, extendsBaseRule: true, }, messages: baseRule.meta.messages, @@ -120,7 +119,7 @@ export default createRule({ return { ...rules, 'TSInterfaceBody, TSModuleBlock'( - node: TSESTree.TSModuleBlock | TSESTree.TSInterfaceBody, + node: TSESTree.TSInterfaceBody | TSESTree.TSModuleBlock, ): void { const openingCurly = sourceCode.getFirstToken(node)!; const closingCurly = sourceCode.getLastToken(node)!; diff --git a/packages/eslint-plugin/src/rules/class-literal-property-style.ts b/packages/eslint-plugin/src/rules/class-literal-property-style.ts index ed49b144e47..bd9e0895e71 100644 --- a/packages/eslint-plugin/src/rules/class-literal-property-style.ts +++ b/packages/eslint-plugin/src/rules/class-literal-property-style.ts @@ -1,10 +1,14 @@ -import type { TSESTree } from '@typescript-eslint/utils'; +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; type Options = ['fields' | 'getters']; -type MessageIds = 'preferFieldStyle' | 'preferGetterStyle'; +type MessageIds = + | 'preferFieldStyle' + | 'preferFieldStyleSuggestion' + | 'preferGetterStyle' + | 'preferGetterStyleSuggestion'; interface NodeWithModifiers { accessibility?: TSESTree.Accessibility; @@ -13,7 +17,7 @@ interface NodeWithModifiers { const printNodeModifiers = ( node: NodeWithModifiers, - final: 'readonly' | 'get', + final: 'get' | 'readonly', ): string => `${node.accessibility ?? ''}${ node.static ? ' static' : '' @@ -43,14 +47,21 @@ export default util.createRule({ docs: { description: 'Enforce that literals on classes are exposed in a consistent style', - recommended: 'strict', + recommended: 'stylistic', }, - fixable: 'code', + hasSuggestions: true, messages: { preferFieldStyle: 'Literals should be exposed using readonly fields.', + preferFieldStyleSuggestion: 'Replace the literals with readonly fields.', preferGetterStyle: 'Literals should be exposed using getters.', + preferGetterStyleSuggestion: 'Replace the literals with getters.', }, - schema: [{ enum: ['fields', 'getters'] }], + schema: [ + { + type: 'string', + enum: ['fields', 'getters'], + }, + ], }, defaultOptions: ['fields'], create(context, [style]) { @@ -60,7 +71,7 @@ export default util.createRule({ if ( node.kind !== 'get' || !node.value.body || - !node.value.body.body.length + node.value.body.body.length === 0 ) { return; } @@ -80,18 +91,23 @@ export default util.createRule({ context.report({ node: node.key, messageId: 'preferFieldStyle', - fix(fixer) { - const sourceCode = context.getSourceCode(); - const name = sourceCode.getText(node.key); - - let text = ''; - - text += printNodeModifiers(node, 'readonly'); - text += node.computed ? `[${name}]` : name; - text += ` = ${sourceCode.getText(argument)};`; - - return fixer.replaceText(node, text); - }, + suggest: [ + { + messageId: 'preferFieldStyleSuggestion', + fix(fixer): TSESLint.RuleFix { + const sourceCode = context.getSourceCode(); + const name = sourceCode.getText(node.key); + + let text = ''; + + text += printNodeModifiers(node, 'readonly'); + text += node.computed ? `[${name}]` : name; + text += ` = ${sourceCode.getText(argument)};`; + + return fixer.replaceText(node, text); + }, + }, + ], }); }, }), @@ -110,18 +126,23 @@ export default util.createRule({ context.report({ node: node.key, messageId: 'preferGetterStyle', - fix(fixer) { - const sourceCode = context.getSourceCode(); - const name = sourceCode.getText(node.key); - - let text = ''; - - text += printNodeModifiers(node, 'get'); - text += node.computed ? `[${name}]` : name; - text += `() { return ${sourceCode.getText(value)}; }`; - - return fixer.replaceText(node, text); - }, + suggest: [ + { + messageId: 'preferGetterStyleSuggestion', + fix(fixer): TSESLint.RuleFix { + const sourceCode = context.getSourceCode(); + const name = sourceCode.getText(node.key); + + let text = ''; + + text += printNodeModifiers(node, 'get'); + text += node.computed ? `[${name}]` : name; + text += `() { return ${sourceCode.getText(value)}; }`; + + return fixer.replaceText(node, text); + }, + }, + ], }); }, }), diff --git a/packages/eslint-plugin/src/rules/comma-dangle.ts b/packages/eslint-plugin/src/rules/comma-dangle.ts index 149218c4e7e..125cb47a325 100644 --- a/packages/eslint-plugin/src/rules/comma-dangle.ts +++ b/packages/eslint-plugin/src/rules/comma-dangle.ts @@ -44,15 +44,16 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require or disallow trailing commas', - recommended: false, extendsBaseRule: true, }, schema: { $defs: { value: { + type: 'string', enum: OPTION_VALUE_SCHEME, }, valueWithIgnore: { + type: 'string', enum: [...OPTION_VALUE_SCHEME, 'ignore'], }, }, @@ -80,7 +81,7 @@ export default util.createRule({ ], }, ], - additionalProperties: false, + additionalItems: false, }, fixable: 'code', hasSuggestions: baseRule.meta.hasSuggestions, @@ -97,7 +98,9 @@ export default util.createRule({ 'always-multiline': forceCommaIfMultiline, 'only-multiline': allowCommaIfMultiline, never: forbidComma, - ignore: (): void => {}, + // https://github.com/typescript-eslint/typescript-eslint/issues/7220 + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-empty-function + ignore: () => {}, }; function last(nodes: TSESTree.Node[]): TSESTree.Node | null { diff --git a/packages/eslint-plugin/src/rules/comma-spacing.ts b/packages/eslint-plugin/src/rules/comma-spacing.ts index a1ebcc181f2..9c6e64cfc5c 100644 --- a/packages/eslint-plugin/src/rules/comma-spacing.ts +++ b/packages/eslint-plugin/src/rules/comma-spacing.ts @@ -3,6 +3,8 @@ import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import { createRule, + isClosingBraceToken, + isClosingBracketToken, isClosingParenToken, isCommaToken, isTokenOnSameLine, @@ -14,7 +16,7 @@ type Options = [ after: boolean; }, ]; -type MessageIds = 'unexpected' | 'missing'; +type MessageIds = 'missing' | 'unexpected'; export default createRule({ name: 'comma-spacing', @@ -22,7 +24,6 @@ export default createRule({ type: 'layout', docs: { description: 'Enforce consistent spacing before and after commas', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', @@ -135,6 +136,14 @@ export default createRule({ return; } + if ( + spaceAfter && + nextToken && + (isClosingBraceToken(nextToken) || isClosingBracketToken(nextToken)) + ) { + return; + } + if (!spaceAfter && nextToken && nextToken.type === AST_TOKEN_TYPES.Line) { return; } diff --git a/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts b/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts index dfcb5d4a63d..8719d0b5dc5 100644 --- a/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts +++ b/packages/eslint-plugin/src/rules/consistent-generic-constructors.ts @@ -3,8 +3,8 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { createRule } from '../util'; -type MessageIds = 'preferTypeAnnotation' | 'preferConstructor'; -type Options = ['type-annotation' | 'constructor']; +type MessageIds = 'preferConstructor' | 'preferTypeAnnotation'; +type Options = ['constructor' | 'type-annotation']; export default createRule({ name: 'consistent-generic-constructors', @@ -13,7 +13,7 @@ export default createRule({ docs: { description: 'Enforce specifying generic type arguments on type annotation or constructor name of a constructor call', - recommended: 'strict', + recommended: 'stylistic', }, messages: { preferTypeAnnotation: @@ -24,6 +24,7 @@ export default createRule({ fixable: 'code', schema: [ { + type: 'string', enum: ['type-annotation', 'constructor'], }, ], @@ -34,9 +35,9 @@ export default createRule({ return { 'VariableDeclarator,PropertyDefinition,:matches(FunctionDeclaration,FunctionExpression) > AssignmentPattern'( node: - | TSESTree.VariableDeclarator + | TSESTree.AssignmentPattern | TSESTree.PropertyDefinition - | TSESTree.AssignmentPattern, + | TSESTree.VariableDeclarator, ): void { function getLHSRHS(): [ TSESTree.BindingName | TSESTree.PropertyDefinition, @@ -74,17 +75,17 @@ export default createRule({ return; } if (mode === 'type-annotation') { - if (!lhs && rhs.typeParameters) { - const { typeParameters, callee } = rhs; + if (!lhs && rhs.typeArguments) { + const { typeArguments, callee } = rhs; const typeAnnotation = - sourceCode.getText(callee) + sourceCode.getText(typeParameters); + sourceCode.getText(callee) + sourceCode.getText(typeArguments); context.report({ node, messageId: 'preferTypeAnnotation', fix(fixer) { function getIDToAttachAnnotation(): - | TSESTree.Token - | TSESTree.Node { + | TSESTree.Node + | TSESTree.Token { if (node.type !== AST_NODE_TYPES.PropertyDefinition) { return lhsName; } @@ -96,7 +97,7 @@ export default createRule({ return sourceCode.getTokenAfter(node.key)!; } return [ - fixer.remove(typeParameters), + fixer.remove(typeArguments), fixer.insertTextAfter( getIDToAttachAnnotation(), ': ' + typeAnnotation, @@ -108,20 +109,20 @@ export default createRule({ return; } if (mode === 'constructor') { - if (lhs?.typeParameters && !rhs.typeParameters) { + if (lhs?.typeArguments && !rhs.typeArguments) { const hasParens = sourceCode.getTokenAfter(rhs.callee)?.value === '('; const extraComments = new Set( - sourceCode.getCommentsInside(lhs.parent!), + sourceCode.getCommentsInside(lhs.parent), ); sourceCode - .getCommentsInside(lhs.typeParameters) + .getCommentsInside(lhs.typeArguments) .forEach(c => extraComments.delete(c)); context.report({ node, messageId: 'preferConstructor', *fix(fixer) { - yield fixer.remove(lhs.parent!); + yield fixer.remove(lhs.parent); for (const comment of extraComments) { yield fixer.insertTextAfter( rhs.callee, @@ -130,7 +131,7 @@ export default createRule({ } yield fixer.insertTextAfter( rhs.callee, - sourceCode.getText(lhs.typeParameters), + sourceCode.getText(lhs.typeArguments), ); if (!hasParens) { yield fixer.insertTextAfter(rhs.callee, '()'); diff --git a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts index 535692f3fa8..5aece3ea480 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -3,8 +3,8 @@ import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; import { createRule } from '../util'; -type MessageIds = 'preferRecord' | 'preferIndexSignature'; -type Options = ['record' | 'index-signature']; +type MessageIds = 'preferIndexSignature' | 'preferRecord'; +type Options = ['index-signature' | 'record']; export default createRule({ name: 'consistent-indexed-object-style', @@ -12,7 +12,7 @@ export default createRule({ type: 'suggestion', docs: { description: 'Require or disallow the `Record` type', - recommended: 'strict', + recommended: 'stylistic', }, messages: { preferRecord: 'A record is preferred over an index signature.', @@ -21,6 +21,7 @@ export default createRule({ fixable: 'code', schema: [ { + type: 'string', enum: ['record', 'index-signature'], }, ], @@ -31,7 +32,7 @@ export default createRule({ function checkMembers( members: TSESTree.TypeElement[], - node: TSESTree.TSTypeLiteral | TSESTree.TSInterfaceDeclaration, + node: TSESTree.TSInterfaceDeclaration | TSESTree.TSTypeLiteral, parentId: TSESTree.Identifier | undefined, prefix: string, postfix: string, @@ -108,7 +109,7 @@ export default createRule({ return; } - const params = node.typeParameters?.params; + const params = node.typeArguments?.params; if (params?.length !== 2) { return; } @@ -132,8 +133,8 @@ export default createRule({ TSInterfaceDeclaration(node): void { let genericTypes = ''; - if ((node.typeParameters?.params ?? []).length > 0) { - genericTypes = `<${node.typeParameters?.params + if (node.typeParameters?.params?.length) { + genericTypes = `<${node.typeParameters.params .map(p => sourceCode.getText(p)) .join(', ')}>`; } diff --git a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts index 66268b0adc6..9903f15e19e 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-assertions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-assertions.ts @@ -1,37 +1,45 @@ -import type { TSESTree } from '@typescript-eslint/utils'; +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; // intentionally mirroring the options -type MessageIds = - | 'as' +export type MessageIds = | 'angle-bracket' + | 'as' | 'never' + | 'replaceObjectTypeAssertionWithAnnotation' + | 'replaceObjectTypeAssertionWithSatisfies' | 'unexpectedObjectTypeAssertion'; type OptUnion = | { - assertionStyle: 'as' | 'angle-bracket'; - objectLiteralTypeAssertions?: 'allow' | 'allow-as-parameter' | 'never'; + assertionStyle: 'angle-bracket' | 'as'; + objectLiteralTypeAssertions?: 'allow-as-parameter' | 'allow' | 'never'; } | { assertionStyle: 'never'; }; -type Options = [OptUnion]; +export type Options = readonly [OptUnion]; export default util.createRule({ name: 'consistent-type-assertions', meta: { type: 'suggestion', + fixable: 'code', + hasSuggestions: true, docs: { description: 'Enforce consistent usage of type assertions', - recommended: 'strict', + recommended: 'stylistic', }, messages: { as: "Use 'as {{cast}}' instead of '<{{cast}}>'.", 'angle-bracket': "Use '<{{cast}}>' instead of 'as {{cast}}'.", never: 'Do not use any type assertions.', unexpectedObjectTypeAssertion: 'Always prefer const x: T = { ... }.', + replaceObjectTypeAssertionWithAnnotation: + 'Use const x: {{cast}} = { ... } instead.', + replaceObjectTypeAssertionWithSatisfies: + 'Use const x = { ... } satisfies {{cast}} instead.', }, schema: [ { @@ -40,6 +48,7 @@ export default util.createRule({ type: 'object', properties: { assertionStyle: { + type: 'string', enum: ['never'], }, }, @@ -50,9 +59,11 @@ export default util.createRule({ type: 'object', properties: { assertionStyle: { + type: 'string', enum: ['as', 'angle-bracket'], }, objectLiteralTypeAssertions: { + type: 'string', enum: ['allow', 'allow-as-parameter', 'never'], }, }, @@ -83,8 +94,30 @@ export default util.createRule({ ); } + function getTextWithParentheses(node: TSESTree.Node): string { + // Capture parentheses before and after the node + let beforeCount = 0; + let afterCount = 0; + + if (util.isParenthesized(node, sourceCode)) { + const bodyOpeningParen = sourceCode.getTokenBefore( + node, + util.isOpeningParenToken, + )!; + const bodyClosingParen = sourceCode.getTokenAfter( + node, + util.isClosingParenToken, + )!; + + beforeCount = node.range[0] - bodyOpeningParen.range[0]; + afterCount = bodyClosingParen.range[1] - node.range[1]; + } + + return sourceCode.getText(node, beforeCount, afterCount); + } + function reportIncorrectAssertionType( - node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, + node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, ): void { const messageId = options.assertionStyle; @@ -100,6 +133,19 @@ export default util.createRule({ messageId !== 'never' ? { cast: sourceCode.getText(node.typeAnnotation) } : {}, + fix: + messageId === 'as' + ? (fixer): TSESLint.RuleFix[] => [ + fixer.replaceText( + node, + getTextWithParentheses(node.expression), + ), + fixer.insertTextAfter( + node, + ` as ${getTextWithParentheses(node.typeAnnotation)}`, + ), + ] + : undefined, }); } @@ -122,7 +168,7 @@ export default util.createRule({ } function checkExpression( - node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, + node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, ): void { if ( options.assertionStyle === 'never' || @@ -134,7 +180,6 @@ export default util.createRule({ if ( options.objectLiteralTypeAssertions === 'allow-as-parameter' && - node.parent && (node.parent.type === AST_NODE_TYPES.NewExpression || node.parent.type === AST_NODE_TYPES.CallExpression || node.parent.type === AST_NODE_TYPES.ThrowStatement || @@ -148,9 +193,42 @@ export default util.createRule({ checkType(node.typeAnnotation) && node.expression.type === AST_NODE_TYPES.ObjectExpression ) { + const suggest: TSESLint.ReportSuggestionArray = []; + if ( + node.parent?.type === AST_NODE_TYPES.VariableDeclarator && + !node.parent.id.typeAnnotation + ) { + const { parent } = node; + suggest.push({ + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: sourceCode.getText(node.typeAnnotation) }, + fix: fixer => [ + fixer.insertTextAfter( + parent.id, + `: ${sourceCode.getText(node.typeAnnotation)}`, + ), + fixer.replaceText(node, getTextWithParentheses(node.expression)), + ], + }); + } + suggest.push({ + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: sourceCode.getText(node.typeAnnotation) }, + fix: fixer => [ + fixer.replaceText(node, getTextWithParentheses(node.expression)), + fixer.insertTextAfter( + node, + ` satisfies ${context + .getSourceCode() + .getText(node.typeAnnotation)}`, + ), + ], + }); + context.report({ node, messageId: 'unexpectedObjectTypeAssertion', + suggest, }); } } diff --git a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts index fdf7ac947c6..b504081ee4a 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts @@ -10,7 +10,7 @@ export default util.createRule({ docs: { description: 'Enforce type definitions to consistently use either `interface` or `type`', - recommended: 'strict', + recommended: 'stylistic', }, messages: { interfaceOverType: 'Use an `interface` instead of a `type`.', @@ -18,6 +18,7 @@ export default util.createRule({ }, schema: [ { + type: 'string', enum: ['interface', 'type'], }, ], diff --git a/packages/eslint-plugin/src/rules/consistent-type-exports.ts b/packages/eslint-plugin/src/rules/consistent-type-exports.ts index 54364054690..e65451ded1d 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-exports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-exports.ts @@ -1,8 +1,4 @@ -import type { - ParserServices, - TSESLint, - TSESTree, -} from '@typescript-eslint/utils'; +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { SymbolFlags } from 'typescript'; @@ -29,9 +25,9 @@ interface ReportValueExport { } type MessageIds = - | 'typeOverValue' + | 'multipleExportsAreTypes' | 'singleExportIsType' - | 'multipleExportsAreTypes'; + | 'typeOverValue'; export default util.createRule({ name: 'consistent-type-exports', @@ -39,7 +35,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Enforce consistent usage of type exports', - recommended: false, requiresTypeChecking: true, }, messages: { @@ -73,7 +68,29 @@ export default util.createRule({ create(context, [{ fixMixedExportsWithInlineTypeSpecifier }]) { const sourceCode = context.getSourceCode(); const sourceExportsMap: { [key: string]: SourceExports } = {}; - const parserServices = util.getParserServices(context); + const services = util.getParserServices(context); + + /** + * Helper for identifying if an export specifier resolves to a + * JavaScript value or a TypeScript type. + * + * @returns True/false if is a type or not, or undefined if the specifier + * can't be resolved. + */ + function isSpecifierTypeBased( + specifier: TSESTree.ExportSpecifier, + ): boolean | undefined { + const checker = services.program.getTypeChecker(); + const symbol = services.getSymbolAtLocation(specifier.exported); + const aliasedSymbol = checker.getAliasedSymbol(symbol!); + + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison + if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') { + return undefined; + } + + return !(aliasedSymbol.flags & SymbolFlags.Value); + } return { ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void { @@ -112,7 +129,7 @@ export default util.createRule({ continue; } - const isTypeBased = isSpecifierTypeBased(parserServices, specifier); + const isTypeBased = isSpecifierTypeBased(specifier); if (isTypeBased === true) { typeBasedSpecifiers.push(specifier); @@ -199,29 +216,6 @@ export default util.createRule({ }, }); -/** - * Helper for identifying if an export specifier resolves to a - * JavaScript value or a TypeScript type. - * - * @returns True/false if is a type or not, or undefined if the specifier - * can't be resolved. - */ -function isSpecifierTypeBased( - parserServices: ParserServices, - specifier: TSESTree.ExportSpecifier, -): boolean | undefined { - const checker = parserServices.program.getTypeChecker(); - const node = parserServices.esTreeNodeToTSNodeMap.get(specifier.exported); - const symbol = checker.getSymbolAtLocation(node); - const aliasedSymbol = checker.getAliasedSymbol(symbol!); - - if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') { - return undefined; - } - - return !(aliasedSymbol.flags & SymbolFlags.Value); -} - /** * Inserts "type" into an export. * diff --git a/packages/eslint-plugin/src/rules/consistent-type-imports.ts b/packages/eslint-plugin/src/rules/consistent-type-imports.ts index 4c5cf771901..dfa5e48ed65 100644 --- a/packages/eslint-plugin/src/rules/consistent-type-imports.ts +++ b/packages/eslint-plugin/src/rules/consistent-type-imports.ts @@ -3,8 +3,8 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; -type Prefer = 'type-imports' | 'no-type-imports'; -type FixStyle = 'separate-type-imports' | 'inline-type-imports'; +type Prefer = 'no-type-imports' | 'type-imports'; +type FixStyle = 'inline-type-imports' | 'separate-type-imports'; type Options = [ { @@ -33,20 +33,19 @@ interface ReportValueImport { } type MessageIds = - | 'typeOverValue' - | 'someImportsAreOnlyTypes' + | 'aImportInDecoMeta' | 'aImportIsOnlyTypes' - | 'valueOverType' | 'noImportTypeAnnotations' + | 'someImportsAreOnlyTypes' | 'someImportsInDecoMeta' - | 'aImportInDecoMeta'; + | 'typeOverValue' + | 'valueOverType'; export default util.createRule({ name: 'consistent-type-imports', meta: { type: 'suggestion', docs: { description: 'Enforce consistent usage of type imports', - recommended: false, }, messages: { typeOverValue: @@ -66,12 +65,14 @@ export default util.createRule({ type: 'object', properties: { prefer: { + type: 'string', enum: ['type-imports', 'no-type-imports'], }, disallowTypeAnnotations: { type: 'boolean', }, fixStyle: { + type: 'string', enum: ['separate-type-imports', 'inline-type-imports'], }, }, diff --git a/packages/eslint-plugin/src/rules/default-param-last.ts b/packages/eslint-plugin/src/rules/default-param-last.ts index ba9d5da7b4e..e76ce14fa05 100644 --- a/packages/eslint-plugin/src/rules/default-param-last.ts +++ b/packages/eslint-plugin/src/rules/default-param-last.ts @@ -9,7 +9,6 @@ export default createRule({ type: 'suggestion', docs: { description: 'Enforce default parameters to be last', - recommended: false, extendsBaseRule: true, }, schema: [], diff --git a/packages/eslint-plugin/src/rules/dot-notation.ts b/packages/eslint-plugin/src/rules/dot-notation.ts index 9f0b0d1304b..d79c8fcdb5e 100644 --- a/packages/eslint-plugin/src/rules/dot-notation.ts +++ b/packages/eslint-plugin/src/rules/dot-notation.ts @@ -1,5 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import type { @@ -20,7 +20,7 @@ export default createRule({ type: 'suggestion', docs: { description: 'Enforce dot notation whenever possible', - recommended: 'strict', + recommended: 'stylistic', extendsBaseRule: true, requiresTypeChecking: true, }, @@ -67,9 +67,7 @@ export default createRule({ ], create(context, [options]) { const rules = baseRule.create(context); - - const { program, esTreeNodeToTSNodeMap } = getParserServices(context); - const typeChecker = program.getTypeChecker(); + const services = getParserServices(context); const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess; @@ -78,8 +76,7 @@ export default createRule({ const allowIndexSignaturePropertyAccess = (options.allowIndexSignaturePropertyAccess ?? false) || tsutils.isCompilerOptionEnabled( - program.getCompilerOptions(), - // @ts-expect-error - TS is refining the type to never for some reason + services.program.getCompilerOptions(), 'noPropertyAccessFromIndexSignature', ); @@ -92,9 +89,7 @@ export default createRule({ node.computed ) { // for perf reasons - only fetch symbols if we have to - const propertySymbol = typeChecker.getSymbolAtLocation( - esTreeNodeToTSNodeMap.get(node.property), - ); + const propertySymbol = services.getSymbolAtLocation(node.property); const modifierKind = getModifiers( propertySymbol?.getDeclarations()?.[0], )?.[0].kind; @@ -110,9 +105,7 @@ export default createRule({ propertySymbol === undefined && allowIndexSignaturePropertyAccess ) { - const objectType = typeChecker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(node.object), - ); + const objectType = services.getTypeAtLocation(node.object); const indexType = objectType .getNonNullableType() .getStringIndexType(); diff --git a/packages/eslint-plugin/src/rules/enum-utils/shared.ts b/packages/eslint-plugin/src/rules/enum-utils/shared.ts new file mode 100644 index 00000000000..e629d00e7be --- /dev/null +++ b/packages/eslint-plugin/src/rules/enum-utils/shared.ts @@ -0,0 +1,40 @@ +import * as tsutils from 'ts-api-utils'; +import * as ts from 'typescript'; + +import * as util from '../../util'; + +/* + * If passed an enum member, returns the type of the parent. Otherwise, + * returns itself. + * + * For example: + * - `Fruit` --> `Fruit` + * - `Fruit.Apple` --> `Fruit` + */ +function getBaseEnumType(typeChecker: ts.TypeChecker, type: ts.Type): ts.Type { + const symbol = type.getSymbol()!; + if (!tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.EnumMember)) { + return type; + } + + return typeChecker.getTypeAtLocation(symbol.valueDeclaration!.parent); +} + +/** + * A type can have 0 or more enum types. For example: + * - 123 --> [] + * - {} --> [] + * - Fruit.Apple --> [Fruit] + * - Fruit.Apple | Vegetable.Lettuce --> [Fruit, Vegetable] + * - Fruit.Apple | Vegetable.Lettuce | 123 --> [Fruit, Vegetable] + * - T extends Fruit --> [Fruit] + */ +export function getEnumTypes( + typeChecker: ts.TypeChecker, + type: ts.Type, +): ts.Type[] { + return tsutils + .unionTypeParts(type) + .filter(subType => util.isTypeFlagSet(subType, ts.TypeFlags.EnumLiteral)) + .map(type => getBaseEnumType(typeChecker, type)); +} diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index b19ec1527ec..e57465be836 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -29,7 +29,6 @@ export default util.createRule({ docs: { description: 'Require explicit return types on functions and class methods', - recommended: false, }, messages: { missingReturnType: 'Missing return type on function.', @@ -103,8 +102,8 @@ export default util.createRule({ function isAllowedFunction( node: | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionExpression - | TSESTree.FunctionDeclaration, + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, ): boolean { if (options.allowFunctionsWithoutTypeParameters && !node.typeParameters) { return true; @@ -165,10 +164,10 @@ export default util.createRule({ function isIIFE( node: | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionExpression - | TSESTree.FunctionDeclaration, + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, ): boolean { - return node.parent!.type === AST_NODE_TYPES.CallExpression; + return node.parent.type === AST_NODE_TYPES.CallExpression; } return { diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index 3fc42a956f6..d95a58dc281 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -23,26 +23,9 @@ interface Config { type Options = [Config]; type MessageIds = - | 'unwantedPublicAccessibility' + | 'addExplicitAccessibility' | 'missingAccessibility' - | 'addExplicitAccessibility'; - -const accessibilityLevel = { - oneOf: [ - { - const: 'explicit', - description: 'Always require an accessor.', - }, - { - const: 'no-public', - description: 'Require an accessor except when public.', - }, - { - const: 'off', - description: 'Never check whether there is an accessor.', - }, - ], -}; + | 'unwantedPublicAccessibility'; export default util.createRule({ name: 'explicit-member-accessibility', @@ -53,7 +36,6 @@ export default util.createRule({ description: 'Require explicit accessibility modifiers on class properties and methods', // too opinionated to be recommended - recommended: false, }, fixable: 'code', messages: { @@ -63,41 +45,56 @@ export default util.createRule({ 'Public accessibility modifier on {{type}} {{name}}.', addExplicitAccessibility: "Add '{{ type }}' accessibility modifier", }, - schema: { - $defs: { - accessibilityLevel, - }, - prefixItems: [ - { - type: 'object', - properties: { - accessibility: { $ref: '#/$defs/accessibilityLevel' }, - overrides: { - type: 'object', - properties: { - accessors: { $ref: '#/$defs/accessibilityLevel' }, - constructors: { $ref: '#/$defs/accessibilityLevel' }, - methods: { $ref: '#/$defs/accessibilityLevel' }, - properties: { $ref: '#/$defs/accessibilityLevel' }, - parameterProperties: { - $ref: '#/$defs/accessibilityLevel', - }, + schema: [ + { + $defs: { + accessibilityLevel: { + oneOf: [ + { + type: 'string', + enum: ['explicit'], + description: 'Always require an accessor.', }, - - additionalProperties: false, - }, - ignoredMethodNames: { - type: 'array', - items: { + { type: 'string', + enum: ['no-public'], + description: 'Require an accessor except when public.', + }, + { + type: 'string', + enum: ['off'], + description: 'Never check whether there is an accessor.', + }, + ], + }, + }, + type: 'object', + properties: { + accessibility: { $ref: '#/items/0/$defs/accessibilityLevel' }, + overrides: { + type: 'object', + properties: { + accessors: { $ref: '#/items/0/$defs/accessibilityLevel' }, + constructors: { $ref: '#/items/0/$defs/accessibilityLevel' }, + methods: { $ref: '#/items/0/$defs/accessibilityLevel' }, + properties: { $ref: '#/items/0/$defs/accessibilityLevel' }, + parameterProperties: { + $ref: '#/items/0/$defs/accessibilityLevel', }, }, + + additionalProperties: false, + }, + ignoredMethodNames: { + type: 'array', + items: { + type: 'string', + }, }, - additionalProperties: false, }, - ], - type: 'array', - }, + additionalProperties: false, + }, + ], }, defaultOptions: [{ accessibility: 'explicit' }], create(context, [option]) { @@ -230,7 +227,7 @@ export default util.createRule({ accessibility: TSESTree.Accessibility, fixer: TSESLint.RuleFixer, ): TSESLint.RuleFix | null { - if (node?.decorators?.length) { + if (node?.decorators.length) { const lastDecorator = node.decorators[node.decorators.length - 1]; const nextToken = sourceCode.getTokenAfter(lastDecorator)!; return fixer.insertTextBefore(nextToken, `${accessibility} `); diff --git a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts index e7552e0cbd8..1ac7e70bb9f 100644 --- a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts +++ b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts @@ -22,15 +22,14 @@ type Options = [ allowedNames?: string[]; allowHigherOrderFunctions?: boolean; allowTypedFunctionExpressions?: boolean; - shouldTrackReferences?: boolean; }, ]; type MessageIds = - | 'missingReturnType' + | 'anyTypedArg' + | 'anyTypedArgUnnamed' | 'missingArgType' | 'missingArgTypeUnnamed' - | 'anyTypedArg' - | 'anyTypedArgUnnamed'; + | 'missingReturnType'; export default util.createRule({ name: 'explicit-module-boundary-types', @@ -39,7 +38,6 @@ export default util.createRule({ docs: { description: "Require explicit return and argument types on exported functions' and classes' public class methods", - recommended: false, }, messages: { missingReturnType: 'Missing return type on function.', @@ -85,10 +83,6 @@ export default util.createRule({ 'Whether to ignore type annotations on the variable of a function expresion.', type: 'boolean', }, - // DEPRECATED - To be removed in next major - shouldTrackReferences: { - type: 'boolean', - }, }, additionalProperties: false, }, @@ -160,7 +154,7 @@ export default util.createRule({ }; function checkParameters( - node: TSESTree.TSEmptyBodyFunctionExpression | FunctionNode, + node: FunctionNode | TSESTree.TSEmptyBodyFunctionExpression, ): void { function checkParameter(param: TSESTree.Parameter): void { function report( @@ -235,7 +229,7 @@ export default util.createRule({ * Checks if a function name is allowed and should not be checked. */ function isAllowedName(node: TSESTree.Node | undefined): boolean { - if (!node || !options.allowedNames || !options.allowedNames.length) { + if (!node || !options.allowedNames || options.allowedNames.length === 0) { return false; } @@ -274,7 +268,7 @@ export default util.createRule({ } function isExportedHigherOrderFunction(node: FunctionNode): boolean { - let current = node.parent; + let current: TSESTree.Node | undefined = node.parent; while (current) { if (current.type === AST_NODE_TYPES.ReturnStatement) { // the parent of a return will always be a block statement, so we can skip over it diff --git a/packages/eslint-plugin/src/rules/func-call-spacing.ts b/packages/eslint-plugin/src/rules/func-call-spacing.ts index 31d8fa41046..b72c54951f9 100644 --- a/packages/eslint-plugin/src/rules/func-call-spacing.ts +++ b/packages/eslint-plugin/src/rules/func-call-spacing.ts @@ -3,15 +3,15 @@ import type { TSESTree } from '@typescript-eslint/utils'; import * as util from '../util'; export type Options = [ - 'never' | 'always', + 'always' | 'never', { allowNewlines?: boolean; }?, ]; export type MessageIds = - | 'unexpectedWhitespace' + | 'missing' | 'unexpectedNewline' - | 'missing'; + | 'unexpectedWhitespace'; export default util.createRule({ name: 'func-call-spacing', @@ -20,7 +20,6 @@ export default util.createRule({ docs: { description: 'Require or disallow spacing between function identifiers and their invocations', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', @@ -30,6 +29,7 @@ export default util.createRule({ type: 'array', items: [ { + type: 'string', enum: ['never'], }, ], @@ -40,6 +40,7 @@ export default util.createRule({ type: 'array', items: [ { + type: 'string', enum: ['always'], }, { @@ -83,7 +84,7 @@ export default util.createRule({ const closingParenToken = sourceCode.getLastToken(node)!; const lastCalleeTokenWithoutPossibleParens = sourceCode.getLastToken( - node.typeParameters ?? node.callee, + node.typeArguments ?? node.callee, )!; const openingParenToken = sourceCode.getFirstTokenBetween( lastCalleeTokenWithoutPossibleParens, diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 19796054a4c..f2f3805d800 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -91,7 +91,6 @@ export default util.createRule({ docs: { description: 'Enforce consistent indentation', // too opinionated to be recommended - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', @@ -131,12 +130,12 @@ export default util.createRule({ */ function TSPropertySignatureToProperty( node: - | TSESTree.TSPropertySignature | TSESTree.TSEnumMember + | TSESTree.TSPropertySignature | TSESTree.TypeElement, type: - | AST_NODE_TYPES.PropertyDefinition - | AST_NODE_TYPES.Property = AST_NODE_TYPES.Property, + | AST_NODE_TYPES.Property + | AST_NODE_TYPES.PropertyDefinition = AST_NODE_TYPES.Property, ): TSESTree.Node | null { const base = { // indent doesn't actually use these @@ -163,9 +162,15 @@ export default util.createRule({ } else { return { type, - static: false, - readonly: false, + accessibility: undefined, declare: false, + decorators: [], + definite: false, + optional: false, + override: false, + readonly: false, + static: false, + typeAnnotation: undefined, ...base, } as TSESTree.PropertyDefinition; } @@ -193,7 +198,7 @@ export default util.createRule({ // transform it to a BinaryExpression return rules['BinaryExpression, LogicalExpression']({ type: AST_NODE_TYPES.BinaryExpression, - operator: 'as', + operator: 'as' as any, left: node.expression, // the first typeAnnotation includes the as token right: node.typeAnnotation as any, @@ -210,8 +215,9 @@ export default util.createRule({ return rules.ConditionalExpression({ type: AST_NODE_TYPES.ConditionalExpression, test: { + parent: node, type: AST_NODE_TYPES.BinaryExpression, - operator: 'extends', + operator: 'extends' as any, left: node.checkType as any, right: node.extendsType as any, @@ -297,6 +303,7 @@ export default util.createRule({ }, } as TSESTree.VariableDeclarator, ], + declare: false, // location data parent: node.parent, @@ -351,7 +358,14 @@ export default util.createRule({ body: node.body as any, id: null, // TODO: This is invalid, there can be more than one extends in interface - superClass: node.extends![0].expression as any, + superClass: node.extends[0].expression as any, + abstract: false, + declare: false, + decorators: [], + implements: [], + superTypeArguments: undefined, + superTypeParameters: undefined, + typeParameters: undefined, // location data parent: node.parent, @@ -371,6 +385,7 @@ export default util.createRule({ type: AST_NODE_TYPES.ObjectExpression, properties: [ { + parent: node, type: AST_NODE_TYPES.Property, key: node.typeParameter as any, value: node.typeAnnotation as any, @@ -391,6 +406,7 @@ export default util.createRule({ kind: 'init' as const, computed: false, method: false, + optional: false, shorthand: false, }, ], @@ -457,6 +473,8 @@ export default util.createRule({ selfClosing: false, name: name as any, attributes: attributes as any, + typeArguments: undefined, + typeParameters: undefined, // location data parent: node.parent, diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index e1d871103ec..f5cf92c28d1 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -37,7 +37,7 @@ import confusingNonNullAssertionLikeNotEqual from './no-confusing-non-null-asser import noConfusingVoidExpression from './no-confusing-void-expression'; import noDupeClassMembers from './no-dupe-class-members'; import noDuplicateEnumValues from './no-duplicate-enum-values'; -import noDuplicateImports from './no-duplicate-imports'; +import noDuplicateTypeConstituents from './no-duplicate-type-constituents'; import noDynamicDelete from './no-dynamic-delete'; import noEmptyFunction from './no-empty-function'; import noEmptyInterface from './no-empty-interface'; @@ -48,7 +48,6 @@ import noExtraSemi from './no-extra-semi'; import noExtraneousClass from './no-extraneous-class'; import noFloatingPromises from './no-floating-promises'; import noForInArray from './no-for-in-array'; -import noImplicitAnyCatch from './no-implicit-any-catch'; import noImpliedEval from './no-implied-eval'; import noImportTypeSideEffects from './no-import-type-side-effects'; import noInferrableTypes from './no-inferrable-types'; @@ -65,7 +64,6 @@ import noNamespace from './no-namespace'; import noNonNullAssertedNullishCoalescing from './no-non-null-asserted-nullish-coalescing'; import noNonNullAssertedOptionalChain from './no-non-null-asserted-optional-chain'; import noNonNullAssertion from './no-non-null-assertion'; -import noParameterProperties from './no-parameter-properties'; import noRedeclare from './no-redeclare'; import noRedundantTypeConstituents from './no-redundant-type-constituents'; import noRequireImports from './no-require-imports'; @@ -84,6 +82,7 @@ import noUnsafeArgument from './no-unsafe-argument'; import noUnsafeAssignment from './no-unsafe-assignment'; import noUnsafeCall from './no-unsafe-call'; import noUnsafeDeclarationMerging from './no-unsafe-declaration-merging'; +import noUnsafeEnumComparison from './no-unsafe-enum-comparison'; import noUnsafeMemberAccess from './no-unsafe-member-access'; import noUnsafeReturn from './no-unsafe-return'; import noUnusedExpressions from './no-unused-expressions'; @@ -121,7 +120,6 @@ import restrictTemplateExpressions from './restrict-template-expressions'; import returnAwait from './return-await'; import semi from './semi'; import sortTypeConstituents from './sort-type-constituents'; -import sortTypeUnionIntersectionMembers from './sort-type-union-intersection-members'; import spaceBeforeBlocks from './space-before-blocks'; import spaceBeforeFunctionParen from './space-before-function-paren'; import spaceInfixOps from './space-infix-ops'; @@ -173,7 +171,7 @@ export default { 'no-confusing-void-expression': noConfusingVoidExpression, 'no-dupe-class-members': noDupeClassMembers, 'no-duplicate-enum-values': noDuplicateEnumValues, - 'no-duplicate-imports': noDuplicateImports, + 'no-duplicate-type-constituents': noDuplicateTypeConstituents, 'no-dynamic-delete': noDynamicDelete, 'no-empty-function': noEmptyFunction, 'no-empty-interface': noEmptyInterface, @@ -184,7 +182,6 @@ export default { 'no-extraneous-class': noExtraneousClass, 'no-floating-promises': noFloatingPromises, 'no-for-in-array': noForInArray, - 'no-implicit-any-catch': noImplicitAnyCatch, 'no-implied-eval': noImpliedEval, 'no-import-type-side-effects': noImportTypeSideEffects, 'no-inferrable-types': noInferrableTypes, @@ -201,7 +198,6 @@ export default { 'no-non-null-asserted-nullish-coalescing': noNonNullAssertedNullishCoalescing, 'no-non-null-asserted-optional-chain': noNonNullAssertedOptionalChain, 'no-non-null-assertion': noNonNullAssertion, - 'no-parameter-properties': noParameterProperties, 'no-redeclare': noRedeclare, 'no-redundant-type-constituents': noRedundantTypeConstituents, 'no-require-imports': noRequireImports, @@ -220,6 +216,7 @@ export default { 'no-unsafe-assignment': noUnsafeAssignment, 'no-unsafe-call': noUnsafeCall, 'no-unsafe-declaration-merging': noUnsafeDeclarationMerging, + 'no-unsafe-enum-comparison': noUnsafeEnumComparison, 'no-unsafe-member-access': noUnsafeMemberAccess, 'no-unsafe-return': noUnsafeReturn, 'no-unused-expressions': noUnusedExpressions, @@ -257,7 +254,6 @@ export default { 'return-await': returnAwait, semi: semi, 'sort-type-constituents': sortTypeConstituents, - 'sort-type-union-intersection-members': sortTypeUnionIntersectionMembers, 'space-before-blocks': spaceBeforeBlocks, 'space-before-function-paren': spaceBeforeFunctionParen, 'space-infix-ops': spaceInfixOps, diff --git a/packages/eslint-plugin/src/rules/init-declarations.ts b/packages/eslint-plugin/src/rules/init-declarations.ts index 27bdf3c75a5..fabbe73898a 100644 --- a/packages/eslint-plugin/src/rules/init-declarations.ts +++ b/packages/eslint-plugin/src/rules/init-declarations.ts @@ -20,7 +20,6 @@ export default createRule({ docs: { description: 'Require or disallow initialization in variable declarations', - recommended: false, extendsBaseRule: true, }, hasSuggestions: baseRule.meta.hasSuggestions, @@ -49,7 +48,7 @@ export default createRule({ function isAncestorNamespaceDeclared( node: TSESTree.VariableDeclaration, ): boolean { - let ancestor = node.parent; + let ancestor: TSESTree.Node | undefined = node.parent; while (ancestor) { if ( diff --git a/packages/eslint-plugin/src/rules/key-spacing.ts b/packages/eslint-plugin/src/rules/key-spacing.ts index 2d4d3f5c11d..096f3b7493e 100644 --- a/packages/eslint-plugin/src/rules/key-spacing.ts +++ b/packages/eslint-plugin/src/rules/key-spacing.ts @@ -31,7 +31,6 @@ export default util.createRule({ docs: { description: 'Enforce consistent spacing between property names and type annotations in types and interfaces', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', @@ -66,9 +65,9 @@ export default util.createRule({ } type KeyTypeNode = + | TSESTree.PropertyDefinition | TSESTree.TSIndexSignature - | TSESTree.TSPropertySignature - | TSESTree.PropertyDefinition; + | TSESTree.TSPropertySignature; type KeyTypeNodeWithTypeAnnotation = KeyTypeNode & { typeAnnotation: TSESTree.TSTypeAnnotation; @@ -128,7 +127,7 @@ export default util.createRule({ function checkBeforeColon( node: KeyTypeNodeWithTypeAnnotation, expectedWhitespaceBeforeColon: number, - mode: 'strict' | 'minimum', + mode: 'minimum' | 'strict', ): void { const { typeAnnotation } = node; const colon = typeAnnotation.loc.start.column; @@ -162,7 +161,7 @@ export default util.createRule({ function checkAfterColon( node: KeyTypeNodeWithTypeAnnotation, expectedWhitespaceAfterColon: number, - mode: 'strict' | 'minimum', + mode: 'minimum' | 'strict', ): void { const { typeAnnotation } = node; const colon = typeAnnotation.loc.start.column; @@ -240,7 +239,7 @@ export default util.createRule({ function checkAlignGroup(group: TSESTree.Node[]): void { let alignColumn = 0; - const align: 'value' | 'colon' = + const align: 'colon' | 'value' = (typeof options.align === 'object' ? options.align.on : typeof options.multiLine?.align === 'object' @@ -373,9 +372,9 @@ export default util.createRule({ function validateBody( body: - | TSESTree.TSTypeLiteral + | TSESTree.ClassBody | TSESTree.TSInterfaceBody - | TSESTree.ClassBody, + | TSESTree.TSTypeLiteral, ): void { const isSingleLine = body.loc.start.line === body.loc.end.line; diff --git a/packages/eslint-plugin/src/rules/keyword-spacing.ts b/packages/eslint-plugin/src/rules/keyword-spacing.ts index aa09fb3d1b8..893c70db767 100644 --- a/packages/eslint-plugin/src/rules/keyword-spacing.ts +++ b/packages/eslint-plugin/src/rules/keyword-spacing.ts @@ -1,5 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; @@ -26,7 +27,7 @@ const schema = util.deepMerge( }, }, }, -); +) as unknown as JSONSchema4; export default util.createRule({ name: 'keyword-spacing', @@ -34,7 +35,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Enforce consistent spacing before and after keywords', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', diff --git a/packages/eslint-plugin/src/rules/lines-around-comment.ts b/packages/eslint-plugin/src/rules/lines-around-comment.ts index 478667040c5..f7cdef33b2e 100644 --- a/packages/eslint-plugin/src/rules/lines-around-comment.ts +++ b/packages/eslint-plugin/src/rules/lines-around-comment.ts @@ -48,92 +48,88 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require empty lines around comments', - recommended: false, extendsBaseRule: true, }, - schema: { - type: 'array', - items: [ - { - type: 'object', - properties: { - beforeBlockComment: { - type: 'boolean', - default: true, - }, - afterBlockComment: { - type: 'boolean', - default: false, - }, - beforeLineComment: { - type: 'boolean', - default: false, - }, - afterLineComment: { - type: 'boolean', - default: false, - }, - allowBlockStart: { - type: 'boolean', - default: false, - }, - allowBlockEnd: { - type: 'boolean', - default: false, - }, - allowClassStart: { - type: 'boolean', - }, - allowClassEnd: { - type: 'boolean', - }, - allowObjectStart: { - type: 'boolean', - }, - allowObjectEnd: { - type: 'boolean', - }, - allowArrayStart: { - type: 'boolean', - }, - allowArrayEnd: { - type: 'boolean', - }, - allowInterfaceStart: { - type: 'boolean', - }, - allowInterfaceEnd: { - type: 'boolean', - }, - allowTypeStart: { - type: 'boolean', - }, - allowTypeEnd: { - type: 'boolean', - }, - allowEnumStart: { - type: 'boolean', - }, - allowEnumEnd: { - type: 'boolean', - }, - allowModuleStart: { - type: 'boolean', - }, - allowModuleEnd: { - type: 'boolean', - }, - ignorePattern: { - type: 'string', - }, - applyDefaultIgnorePatterns: { - type: 'boolean', - }, + schema: [ + { + type: 'object', + properties: { + beforeBlockComment: { + type: 'boolean', + default: true, + }, + afterBlockComment: { + type: 'boolean', + default: false, + }, + beforeLineComment: { + type: 'boolean', + default: false, + }, + afterLineComment: { + type: 'boolean', + default: false, + }, + allowBlockStart: { + type: 'boolean', + default: false, + }, + allowBlockEnd: { + type: 'boolean', + default: false, + }, + allowClassStart: { + type: 'boolean', + }, + allowClassEnd: { + type: 'boolean', + }, + allowObjectStart: { + type: 'boolean', + }, + allowObjectEnd: { + type: 'boolean', + }, + allowArrayStart: { + type: 'boolean', + }, + allowArrayEnd: { + type: 'boolean', + }, + allowInterfaceStart: { + type: 'boolean', + }, + allowInterfaceEnd: { + type: 'boolean', + }, + allowTypeStart: { + type: 'boolean', + }, + allowTypeEnd: { + type: 'boolean', + }, + allowEnumStart: { + type: 'boolean', + }, + allowEnumEnd: { + type: 'boolean', + }, + allowModuleStart: { + type: 'boolean', + }, + allowModuleEnd: { + type: 'boolean', + }, + ignorePattern: { + type: 'string', + }, + applyDefaultIgnorePatterns: { + type: 'boolean', }, - additionalProperties: false, }, - ], - }, + additionalProperties: false, + }, + ], fixable: baseRule.meta.fixable, hasSuggestions: baseRule.meta.hasSuggestions, messages: baseRule.meta.messages, diff --git a/packages/eslint-plugin/src/rules/lines-between-class-members.ts b/packages/eslint-plugin/src/rules/lines-between-class-members.ts index 2f37b365dae..e88e42d477a 100644 --- a/packages/eslint-plugin/src/rules/lines-between-class-members.ts +++ b/packages/eslint-plugin/src/rules/lines-between-class-members.ts @@ -1,5 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; @@ -9,17 +10,21 @@ const baseRule = getESLintCoreRule('lines-between-class-members'); type Options = util.InferOptionsTypeFromRule; type MessageIds = util.InferMessageIdsTypeFromRule; -const schema = util.deepMerge( - { ...baseRule.meta.schema }, - { - 1: { - exceptAfterOverload: { - type: 'boolean', - default: true, +const schema = Object.values( + util.deepMerge( + { ...baseRule.meta.schema }, + { + 1: { + properties: { + exceptAfterOverload: { + type: 'boolean', + default: true, + }, + }, }, }, - }, -); + ), +) as JSONSchema4[]; export default util.createRule({ name: 'lines-between-class-members', @@ -27,7 +32,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require or disallow an empty line between class members', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', diff --git a/packages/eslint-plugin/src/rules/member-delimiter-style.ts b/packages/eslint-plugin/src/rules/member-delimiter-style.ts index 53d2019e97d..e0055a385e1 100644 --- a/packages/eslint-plugin/src/rules/member-delimiter-style.ts +++ b/packages/eslint-plugin/src/rules/member-delimiter-style.ts @@ -1,5 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; @@ -27,10 +28,10 @@ type Config = BaseOptions & { }; type Options = [Config]; type MessageIds = - | 'unexpectedComma' - | 'unexpectedSemi' | 'expectedComma' - | 'expectedSemi'; + | 'expectedSemi' + | 'unexpectedComma' + | 'unexpectedSemi'; type LastTokenType = TSESTree.Token; interface MakeFixFunctionParams { @@ -47,30 +48,6 @@ type MakeFixFunctionReturnType = | ((fixer: TSESLint.RuleFixer) => TSESLint.RuleFix) | null; -const definition = { - type: 'object', - properties: { - multiline: { - type: 'object', - properties: { - delimiter: { enum: ['none', 'semi', 'comma'] }, - requireLast: { type: 'boolean' }, - }, - additionalProperties: false, - }, - singleline: { - type: 'object', - properties: { - // note can't have "none" for single line delimiter as it's invalid syntax - delimiter: { enum: ['semi', 'comma'] }, - requireLast: { type: 'boolean' }, - }, - additionalProperties: false, - }, - }, - additionalProperties: false, -}; - const isLastTokenEndOfLine = (token: LastTokenType, line: string): boolean => { const positionInLine = token.loc.start.column; @@ -132,6 +109,29 @@ const makeFixFunction = ({ }; }; +const BASE_SCHEMA: JSONSchema4 = { + type: 'object', + properties: { + multiline: { + type: 'object', + properties: { + delimiter: { $ref: '#/items/0/$defs/multiLineOption' }, + requireLast: { type: 'boolean' }, + }, + additionalProperties: false, + }, + singleline: { + type: 'object', + properties: { + delimiter: { $ref: '#/items/0/$defs/singleLineOption' }, + requireLast: { type: 'boolean' }, + }, + additionalProperties: false, + }, + }, + additionalProperties: false, +}; + export default util.createRule({ name: 'member-delimiter-style', meta: { @@ -139,7 +139,6 @@ export default util.createRule({ docs: { description: 'Require a specific member delimiter style for interfaces and type literals', - recommended: false, }, fixable: 'whitespace', messages: { @@ -150,20 +149,39 @@ export default util.createRule({ }, schema: [ { + $defs: { + multiLineOption: { + type: 'string', + enum: ['none', 'semi', 'comma'], + }, + // note can't have "none" for single line delimiter as it's invalid syntax + singleLineOption: { + type: 'string', + enum: ['semi', 'comma'], + }, + // note - need to define this last as it references the enums + delimiterConfig: BASE_SCHEMA, + }, type: 'object', - properties: Object.assign({}, definition.properties, { + properties: { + ...BASE_SCHEMA.properties, overrides: { type: 'object', properties: { - interface: definition, - typeLiteral: definition, + interface: { + $ref: '#/items/0/$defs/delimiterConfig', + }, + typeLiteral: { + $ref: '#/items/0/$defs/delimiterConfig', + }, }, additionalProperties: false, }, multilineDetection: { + type: 'string', enum: ['brackets', 'last-member'], }, - }), + }, additionalProperties: false, }, ], diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index cadd1023058..29b748e88cf 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -1,6 +1,6 @@ import type { JSONSchema, TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import naturalCompare from 'natural-compare-lite'; +import naturalCompare from 'natural-compare'; import * as util from '../util'; @@ -12,9 +12,9 @@ export type MessageIds = type ReadonlyType = 'readonly-field' | 'readonly-signature'; type MemberKind = + | ReadonlyType | 'call-signature' | 'constructor' - | ReadonlyType | 'field' | 'get' | 'method' @@ -25,16 +25,16 @@ type MemberKind = type DecoratedMemberKind = | Exclude | 'field' - | 'method' | 'get' + | 'method' | 'set'; type NonCallableMemberKind = Exclude< MemberKind, - 'constructor' | 'signature' | 'readonly-signature' + 'constructor' | 'readonly-signature' | 'signature' >; -type MemberScope = 'static' | 'instance' | 'abstract'; +type MemberScope = 'abstract' | 'instance' | 'static'; type Accessibility = TSESTree.Accessibility | '#private'; @@ -42,20 +42,20 @@ type BaseMemberType = | MemberKind | `${Accessibility}-${Exclude< MemberKind, - 'signature' | 'readonly-signature' | 'static-initialization' + 'readonly-signature' | 'signature' | 'static-initialization' >}` - | `${Accessibility}-decorated-${DecoratedMemberKind}` - | `decorated-${DecoratedMemberKind}` | `${Accessibility}-${MemberScope}-${NonCallableMemberKind}` - | `${MemberScope}-${NonCallableMemberKind}`; + | `${Accessibility}-decorated-${DecoratedMemberKind}` + | `${MemberScope}-${NonCallableMemberKind}` + | `decorated-${DecoratedMemberKind}`; type MemberType = BaseMemberType | BaseMemberType[]; type AlphabeticalOrder = - | 'alphabetically' | 'alphabetically-case-insensitive' - | 'natural' - | 'natural-case-insensitive'; + | 'alphabetically' + | 'natural-case-insensitive' + | 'natural'; type Order = AlphabeticalOrder | 'as-written'; @@ -85,42 +85,34 @@ const neverConfig: JSONSchema.JSONSchema4 = { enum: ['never'], }; -const arrayConfig = (memberTypes: MemberType[]): JSONSchema.JSONSchema4 => ({ +const arrayConfig = (memberTypes: string): JSONSchema.JSONSchema4 => ({ type: 'array', items: { oneOf: [ { - enum: memberTypes, + $ref: memberTypes, }, { type: 'array', items: { - enum: memberTypes, + $ref: memberTypes, }, }, ], }, }); -const objectConfig = (memberTypes: MemberType[]): JSONSchema.JSONSchema4 => ({ +const objectConfig = (memberTypes: string): JSONSchema.JSONSchema4 => ({ type: 'object', properties: { memberTypes: { oneOf: [arrayConfig(memberTypes), neverConfig], }, order: { - type: 'string', - enum: [ - 'alphabetically', - 'alphabetically-case-insensitive', - 'as-written', - 'natural', - 'natural-case-insensitive', - ], + $ref: '#/items/0/$defs/orderOptions', }, optionalityOrder: { - type: 'string', - enum: ['optional-first', 'required-first'], + $ref: '#/items/0/$defs/optionalityOrderOptions', }, }, additionalProperties: false, @@ -380,11 +372,11 @@ function getNodeType(node: Member): MemberKind | null { function getMemberRawName( member: | TSESTree.MethodDefinition - | TSESTree.TSMethodSignature - | TSESTree.TSAbstractMethodDefinition + | TSESTree.Property | TSESTree.PropertyDefinition + | TSESTree.TSAbstractMethodDefinition | TSESTree.TSAbstractPropertyDefinition - | TSESTree.Property + | TSESTree.TSMethodSignature | TSESTree.TSPropertySignature, sourceCode: TSESLint.SourceCode, ): string { @@ -529,7 +521,7 @@ function getRank( const memberGroups: BaseMemberType[] = []; if (supportsModifiers) { - const decorated = 'decorators' in node && node.decorators!.length > 0; + const decorated = 'decorators' in node && node.decorators.length > 0; if ( decorated && (type === 'readonly-field' || @@ -625,7 +617,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Require a consistent member declaration order', - recommended: false, }, messages: { incorrectOrder: @@ -636,70 +627,68 @@ export default util.createRule({ }, schema: [ { - type: 'object', - properties: { - default: { - oneOf: [ - neverConfig, - arrayConfig(allMemberTypes), - objectConfig(allMemberTypes), + $defs: { + orderOptions: { + type: 'string', + enum: [ + 'alphabetically', + 'alphabetically-case-insensitive', + 'as-written', + 'natural', + 'natural-case-insensitive', ], }, - classes: { - oneOf: [ - neverConfig, - arrayConfig(allMemberTypes), - objectConfig(allMemberTypes), + optionalityOrderOptions: { + type: 'string', + enum: ['optional-first', 'required-first'], + }, + allItems: { + type: 'string', + enum: allMemberTypes as string[], + }, + typeItems: { + type: 'string', + enum: [ + 'readonly-signature', + 'signature', + 'readonly-field', + 'field', + 'method', + 'constructor', ], }, - classExpressions: { + + baseConfig: { oneOf: [ neverConfig, - arrayConfig(allMemberTypes), - objectConfig(allMemberTypes), + arrayConfig('#/items/0/$defs/allItems'), + objectConfig('#/items/0/$defs/allItems'), ], }, - interfaces: { + typesConfig: { oneOf: [ neverConfig, - arrayConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), - objectConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), + arrayConfig('#/items/0/$defs/typeItems'), + objectConfig('#/items/0/$defs/typeItems'), ], }, + }, + type: 'object', + properties: { + default: { + $ref: '#/items/0/$defs/baseConfig', + }, + classes: { + $ref: '#/items/0/$defs/baseConfig', + }, + classExpressions: { + $ref: '#/items/0/$defs/baseConfig', + }, + interfaces: { + $ref: '#/items/0/$defs/typesConfig', + }, typeLiterals: { - oneOf: [ - neverConfig, - arrayConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), - objectConfig([ - 'readonly-signature', - 'signature', - 'readonly-field', - 'field', - 'method', - 'constructor', - ]), - ], + $ref: '#/items/0/$defs/typesConfig', }, }, additionalProperties: false, @@ -725,9 +714,9 @@ export default util.createRule({ members: Member[], groupOrder: MemberType[], supportsModifiers: boolean, - ): Array | null { + ): Member[][] | null { const previousRanks: number[] = []; - const memberGroups: Array = []; + const memberGroups: Member[][] = []; let isCorrectlySorted = true; // Find first member which isn't correctly sorted @@ -896,7 +885,7 @@ export default util.createRule({ // Standardize config let order: Order | undefined; - let memberTypes: string | MemberType[] | undefined; + let memberTypes: MemberType[] | string | undefined; let optionalityOrder: OptionalityOrder | undefined; // returns true if everything is good and false if an error was reported diff --git a/packages/eslint-plugin/src/rules/method-signature-style.ts b/packages/eslint-plugin/src/rules/method-signature-style.ts index 93b21408511..ee8ea18ebf8 100644 --- a/packages/eslint-plugin/src/rules/method-signature-style.ts +++ b/packages/eslint-plugin/src/rules/method-signature-style.ts @@ -3,7 +3,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; -export type Options = [('property' | 'method')?]; +export type Options = [('method' | 'property')?]; export type MessageIds = 'errorMethod' | 'errorProperty'; export default util.createRule({ @@ -12,7 +12,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Enforce using a particular method signature syntax', - recommended: false, }, fixable: 'code', messages: { @@ -23,6 +22,7 @@ export default util.createRule({ }, schema: [ { + type: 'string', enum: ['property', 'method'], }, ], @@ -49,7 +49,7 @@ export default util.createRule({ } function getMethodParams( - node: TSESTree.TSMethodSignature | TSESTree.TSFunctionType, + node: TSESTree.TSFunctionType | TSESTree.TSMethodSignature, ): string { let params = '()'; if (node.params.length > 0) { @@ -78,7 +78,7 @@ export default util.createRule({ } function getMethodReturnType( - node: TSESTree.TSMethodSignature | TSESTree.TSFunctionType, + node: TSESTree.TSFunctionType | TSESTree.TSMethodSignature, ): string { return node.returnType == null ? // if the method has no return type, it implicitly has an `any` return type diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts index 02900ab1d8b..1b26c18ecb2 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts @@ -78,7 +78,7 @@ enum MetaSelectors { Selectors.typeProperty, } type MetaSelectorsString = keyof typeof MetaSelectors; -type IndividualAndMetaSelectorsString = SelectorsString | MetaSelectorsString; +type IndividualAndMetaSelectorsString = MetaSelectorsString | SelectorsString; enum Modifiers { // const variable diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/parse-options.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/parse-options.ts index c4e6e36b303..945777dd7fb 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/parse-options.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/parse-options.ts @@ -83,10 +83,13 @@ function parseOptions(context: Context): ParsedOptions { const normalizedOptions = context.options .map(opt => normalizeOption(opt)) .reduce((acc, val) => acc.concat(val), []); - return util.getEnumNames(Selectors).reduce((acc, k) => { + + const result = util.getEnumNames(Selectors).reduce((acc, k) => { acc[k] = createValidator(k, context, normalizedOptions); return acc; }, {} as ParsedOptions); + + return result; } export { parseOptions }; diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts index ff91d2e156d..2cb6d9fed62 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/schema.ts @@ -14,35 +14,45 @@ import { UnderscoreOptions, } from './enums'; -const UNDERSCORE_SCHEMA: JSONSchema.JSONSchema4 = { - type: 'string', - enum: util.getEnumNames(UnderscoreOptions), -}; -const PREFIX_SUFFIX_SCHEMA: JSONSchema.JSONSchema4 = { - type: 'array', - items: { +const $DEFS: Record = { + // enums + underscoreOptions: { type: 'string', - minLength: 1, + enum: util.getEnumNames(UnderscoreOptions), }, - additionalItems: false, -}; -const MATCH_REGEX_SCHEMA: JSONSchema.JSONSchema4 = { - type: 'object', - properties: { - match: { type: 'boolean' }, - regex: { type: 'string' }, + predefinedFormats: { + type: 'string', + enum: util.getEnumNames(PredefinedFormats), }, - required: ['match', 'regex'], -}; -type JSONSchemaProperties = Record; -const FORMAT_OPTIONS_PROPERTIES: JSONSchemaProperties = { - format: { + typeModifiers: { + type: 'string', + enum: util.getEnumNames(TypeModifiers), + }, + + // repeated types + prefixSuffixConfig: { + type: 'array', + items: { + type: 'string', + minLength: 1, + }, + additionalItems: false, + }, + matchRegexConfig: { + type: 'object', + additionalProperties: false, + properties: { + match: { type: 'boolean' }, + regex: { type: 'string' }, + }, + required: ['match', 'regex'], + }, + formatOptionsConfig: { oneOf: [ { type: 'array', items: { - type: 'string', - enum: util.getEnumNames(PredefinedFormats), + $ref: '#/$defs/predefinedFormats', }, additionalItems: false, }, @@ -51,6 +61,22 @@ const FORMAT_OPTIONS_PROPERTIES: JSONSchemaProperties = { }, ], }, +}; + +const UNDERSCORE_SCHEMA: JSONSchema.JSONSchema4 = { + $ref: '#/$defs/underscoreOptions', +}; +const PREFIX_SUFFIX_SCHEMA: JSONSchema.JSONSchema4 = { + $ref: '#/$defs/prefixSuffixConfig', +}; +const MATCH_REGEX_SCHEMA: JSONSchema.JSONSchema4 = { + $ref: '#/$defs/matchRegexConfig', +}; +type JSONSchemaProperties = Record; +const FORMAT_OPTIONS_PROPERTIES: JSONSchemaProperties = { + format: { + $ref: '#/$defs/formatOptionsConfig', + }, custom: MATCH_REGEX_SCHEMA, leadingUnderscore: UNDERSCORE_SCHEMA, trailingUnderscore: UNDERSCORE_SCHEMA, @@ -94,8 +120,7 @@ function selectorSchema( selector.types = { type: 'array', items: { - type: 'string', - enum: util.getEnumNames(TypeModifiers), + $ref: '#/$defs/typeModifiers', }, additionalItems: false, }; @@ -104,6 +129,7 @@ function selectorSchema( return [ { type: 'object', + description: `Selector '${selectorString}'`, properties: { ...FORMAT_OPTIONS_PROPERTIES, ...selector, @@ -117,6 +143,7 @@ function selectorSchema( function selectorsSchema(): JSONSchema.JSONSchema4 { return { type: 'object', + description: 'Multiple selectors in one config', properties: { ...FORMAT_OPTIONS_PROPERTIES, ...{ @@ -151,8 +178,7 @@ function selectorsSchema(): JSONSchema.JSONSchema4 { types: { type: 'array', items: { - type: 'string', - enum: util.getEnumNames(TypeModifiers), + $ref: '#/$defs/typeModifiers', }, additionalItems: false, }, @@ -164,6 +190,7 @@ function selectorsSchema(): JSONSchema.JSONSchema4 { } const SCHEMA: JSONSchema.JSONSchema4 = { + $defs: $DEFS, type: 'array', items: { oneOf: [ diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/shared.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/shared.ts index 9772f91ced8..a1d63d31bad 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/shared.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/shared.ts @@ -12,13 +12,13 @@ function selectorTypeToMessageString(selectorType: SelectorsString): string { } function isMetaSelector( - selector: IndividualAndMetaSelectorsString | Selectors | MetaSelectors, + selector: IndividualAndMetaSelectorsString | MetaSelectors | Selectors, ): selector is MetaSelectorsString { return selector in MetaSelectors; } function isMethodOrPropertySelector( - selector: IndividualAndMetaSelectorsString | Selectors | MetaSelectors, + selector: IndividualAndMetaSelectorsString | MetaSelectors | Selectors, ): boolean { return ( selector === MetaSelectors.method || selector === MetaSelectors.property diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/types.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/types.ts index d5c15994b8b..fd0910050e0 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/types.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/types.ts @@ -35,7 +35,7 @@ interface Selector { | IndividualAndMetaSelectorsString[]; modifiers?: ModifiersString[]; types?: TypeModifiersString[]; - filter?: string | MatchRegex; + filter?: MatchRegex | string; } interface NormalizedMatchRegex { @@ -52,7 +52,7 @@ interface NormalizedSelector { prefix: string[] | null; suffix: string[] | null; // selector options - selector: Selectors | MetaSelectors; + selector: MetaSelectors | Selectors; modifiers: Modifiers[] | null; types: TypeModifiers[] | null; filter: NormalizedMatchRegex | null; @@ -61,7 +61,7 @@ interface NormalizedSelector { } type ValidatorFunction = ( - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, modifiers?: Set, ) => void; type ParsedOptions = Record; diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts index c2b87ccc33b..4c80a167a0f 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/validator.ts @@ -25,7 +25,7 @@ function createValidator( context: Context, allConfigs: NormalizedSelector[], ): ( - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, ) => void { // make sure the "highest priority" configs are checked first const selectorType = Selectors[type]; @@ -71,7 +71,7 @@ function createValidator( }); return ( - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, modifiers: Set = new Set(), ): void => { const originalName = @@ -155,7 +155,7 @@ function createValidator( formats?: PredefinedFormats[]; originalName: string; processedName?: string; - position?: 'leading' | 'trailing' | 'prefix' | 'suffix'; + position?: 'leading' | 'prefix' | 'suffix' | 'trailing'; custom?: NonNullable; count?: 'one' | 'two'; }): Record { @@ -184,7 +184,7 @@ function createValidator( position: 'leading' | 'trailing', config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, originalName: string, ): string | null { const option = @@ -305,7 +305,7 @@ function createValidator( position: 'prefix' | 'suffix', config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, originalName: string, ): string | null { const affixes = config[position]; @@ -345,7 +345,7 @@ function createValidator( function validateCustom( config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, originalName: string, ): boolean { const custom = config.custom; @@ -378,7 +378,7 @@ function createValidator( function validatePredefinedFormat( config: NormalizedSelector, name: string, - node: TSESTree.Identifier | TSESTree.PrivateIdentifier | TSESTree.Literal, + node: TSESTree.Identifier | TSESTree.Literal | TSESTree.PrivateIdentifier, originalName: string, modifiers: Set, ): boolean { @@ -435,11 +435,10 @@ function isCorrectType( return true; } - const { esTreeNodeToTSNodeMap, program } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const tsNode = esTreeNodeToTSNodeMap.get(node); - const type = checker - .getTypeAtLocation(tsNode) + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const type = services + .getTypeAtLocation(node) // remove null and undefined from the type, as we don't care about it here .getNonNullableType(); diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 1c6c0ae31d1..d3e52d377cf 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -12,12 +12,12 @@ import type { import { Modifiers, parseOptions, SCHEMA } from './naming-convention-utils'; type MessageIds = - | 'unexpectedUnderscore' - | 'missingUnderscore' + | 'doesNotMatchFormat' + | 'doesNotMatchFormatTrimmed' | 'missingAffix' + | 'missingUnderscore' | 'satisfyCustom' - | 'doesNotMatchFormat' - | 'doesNotMatchFormatTrimmed'; + | 'unexpectedUnderscore'; // Note that this intentionally does not strictly type the modifiers/types properties. // This is because doing so creates a huge headache, as the rule's code doesn't need to care. @@ -53,7 +53,6 @@ export default util.createRule({ docs: { description: 'Enforce naming conventions for everything across a codebase', - recommended: false, // technically only requires type checking if the user uses "type" modifiers requiresTypeChecking: true, }, @@ -90,20 +89,18 @@ export default util.createRule({ const validators = parseOptions(context); - // getParserServices(context, false) -- dirty hack to work around the docs checker test... - const compilerOptions = util - .getParserServices(context, true) - .program.getCompilerOptions(); + const compilerOptions = + util.getParserServices(context, true).program?.getCompilerOptions() ?? {}; function handleMember( validator: ValidatorFunction, node: - | TSESTree.PropertyNonComputedName - | TSESTree.PropertyDefinitionNonComputedName - | TSESTree.TSAbstractPropertyDefinitionNonComputedName - | TSESTree.TSPropertySignatureNonComputedName | TSESTree.MethodDefinitionNonComputedName + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.PropertyNonComputedName | TSESTree.TSAbstractMethodDefinitionNonComputedName - | TSESTree.TSMethodSignatureNonComputedName, + | TSESTree.TSAbstractPropertyDefinitionNonComputedName + | TSESTree.TSMethodSignatureNonComputedName + | TSESTree.TSPropertySignatureNonComputedName, modifiers: Set, ): void { if (!validator) { @@ -120,10 +117,10 @@ export default util.createRule({ function getMemberModifiers( node: - | TSESTree.PropertyDefinition - | TSESTree.TSAbstractPropertyDefinition | TSESTree.MethodDefinition + | TSESTree.PropertyDefinition | TSESTree.TSAbstractMethodDefinition + | TSESTree.TSAbstractPropertyDefinition | TSESTree.TSParameterProperty, ): Set { const modifiers = new Set(); @@ -189,12 +186,12 @@ export default util.createRule({ function isAsyncMemberOrProperty( propertyOrMemberNode: - | TSESTree.PropertyNonComputedName - | TSESTree.TSMethodSignatureNonComputedName + | TSESTree.MethodDefinitionNonComputedName | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.PropertyNonComputedName + | TSESTree.TSAbstractMethodDefinitionNonComputedName | TSESTree.TSAbstractPropertyDefinitionNonComputedName - | TSESTree.MethodDefinitionNonComputedName - | TSESTree.TSAbstractMethodDefinitionNonComputedName, + | TSESTree.TSMethodSignatureNonComputedName, ): boolean { return Boolean( 'value' in propertyOrMemberNode && @@ -276,8 +273,8 @@ export default util.createRule({ handler: ( node: | TSESTree.FunctionDeclaration - | TSESTree.TSDeclareFunction - | TSESTree.FunctionExpression, + | TSESTree.FunctionExpression + | TSESTree.TSDeclareFunction, validator, ): void => { if (node.id == null) { @@ -316,11 +313,11 @@ export default util.createRule({ validator: validators.parameter, handler: ( node: + | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration - | TSESTree.TSDeclareFunction - | TSESTree.TSEmptyBodyFunctionExpression | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression, + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression, validator, ): void => { node.params.forEach(param => { @@ -445,10 +442,10 @@ export default util.createRule({ validator: validators.classMethod, handler: ( node: - | TSESTree.PropertyDefinitionNonComputedName - | TSESTree.TSAbstractPropertyDefinitionNonComputedName | TSESTree.MethodDefinitionNonComputedName - | TSESTree.TSAbstractMethodDefinitionNonComputedName, + | TSESTree.PropertyDefinitionNonComputedName + | TSESTree.TSAbstractMethodDefinitionNonComputedName + | TSESTree.TSAbstractPropertyDefinitionNonComputedName, validator, ): void => { const modifiers = getMemberModifiers(node); diff --git a/packages/eslint-plugin/src/rules/no-array-constructor.ts b/packages/eslint-plugin/src/rules/no-array-constructor.ts index 2b6105890ea..fc71f275d7c 100644 --- a/packages/eslint-plugin/src/rules/no-array-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-array-constructor.ts @@ -9,7 +9,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow generic `Array` constructors', - recommended: 'error', + recommended: 'recommended', extendsBaseRule: true, }, fixable: 'code', @@ -31,7 +31,7 @@ export default util.createRule({ node.arguments.length !== 1 && node.callee.type === AST_NODE_TYPES.Identifier && node.callee.name === 'Array' && - !node.typeParameters && + !node.typeArguments && !util.isOptionalCallExpression(node) ) { context.report({ diff --git a/packages/eslint-plugin/src/rules/no-base-to-string.ts b/packages/eslint-plugin/src/rules/no-base-to-string.ts index 8b8521491f2..9d74c87117c 100644 --- a/packages/eslint-plugin/src/rules/no-base-to-string.ts +++ b/packages/eslint-plugin/src/rules/no-base-to-string.ts @@ -5,7 +5,7 @@ import * as ts from 'typescript'; import * as util from '../util'; enum Usefulness { - Always, + Always = 'always', Never = 'will', Sometimes = 'may', } @@ -23,7 +23,7 @@ export default util.createRule({ docs: { description: 'Require `.toString()` to only be called on objects which provide useful information when stringified', - recommended: 'strict', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -52,8 +52,8 @@ export default util.createRule({ }, ], create(context, [option]) { - const parserServices = util.getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const ignoredTypeNames = option.ignoredTypeNames ?? []; function checkExpression(node: TSESTree.Expression, type?: ts.Type): void { @@ -62,10 +62,7 @@ export default util.createRule({ } const certainty = collectToStringCertainty( - type ?? - typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node), - ), + type ?? services.getTypeAtLocation(node), ); if (certainty === Usefulness.Always) { return; @@ -82,7 +79,7 @@ export default util.createRule({ } function collectToStringCertainty(type: ts.Type): Usefulness { - const toString = typeChecker.getPropertyOfType(type, 'toString'); + const toString = checker.getPropertyOfType(type, 'toString'); const declarations = toString?.getDeclarations(); if (!toString || !declarations || declarations.length === 0) { return Usefulness.Always; @@ -96,7 +93,7 @@ export default util.createRule({ return Usefulness.Always; } - if (ignoredTypeNames.includes(util.getTypeName(typeChecker, type))) { + if (ignoredTypeNames.includes(util.getTypeName(checker, type))) { return Usefulness.Always; } @@ -155,17 +152,13 @@ export default util.createRule({ 'AssignmentExpression[operator = "+="], BinaryExpression[operator = "+"]'( node: TSESTree.AssignmentExpression | TSESTree.BinaryExpression, ): void { - const leftType = typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.left), - ); - const rightType = typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.right), - ); - - if (util.getTypeName(typeChecker, leftType) === 'string') { + const leftType = services.getTypeAtLocation(node.left); + const rightType = services.getTypeAtLocation(node.right); + + if (util.getTypeName(checker, leftType) === 'string') { checkExpression(node.right, rightType); } else if ( - util.getTypeName(typeChecker, rightType) === 'string' && + util.getTypeName(checker, rightType) === 'string' && node.left.type !== AST_NODE_TYPES.PrivateIdentifier ) { checkExpression(node.left, leftType); @@ -178,10 +171,7 @@ export default util.createRule({ checkExpression(memberExpr.object); }, TemplateLiteral(node: TSESTree.TemplateLiteral): void { - if ( - node.parent && - node.parent.type === AST_NODE_TYPES.TaggedTemplateExpression - ) { + if (node.parent.type === AST_NODE_TYPES.TaggedTemplateExpression) { return; } for (const expression of node.expressions) { diff --git a/packages/eslint-plugin/src/rules/no-confusing-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-confusing-non-null-assertion.ts index 6268a9e6c75..5e91950ed20 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-non-null-assertion.ts @@ -10,7 +10,7 @@ export default util.createRule({ docs: { description: 'Disallow non-null assertion in locations that may be confusing', - recommended: 'strict', + recommended: 'stylistic', }, fixable: 'code', hasSuggestions: true, @@ -32,7 +32,7 @@ export default util.createRule({ const sourceCode = context.getSourceCode(); return { 'BinaryExpression, AssignmentExpression'( - node: TSESTree.BinaryExpression | TSESTree.AssignmentExpression, + node: TSESTree.AssignmentExpression | TSESTree.BinaryExpression, ): void { function isLeftHandPrimaryExpression( node: TSESTree.Expression | TSESTree.PrivateIdentifier, diff --git a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts index 62945ac689b..66ac9e28c51 100644 --- a/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts +++ b/packages/eslint-plugin/src/rules/no-confusing-void-expression.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -14,12 +14,12 @@ export type Options = [ export type MessageId = | 'invalidVoidExpr' - | 'invalidVoidExprWrapVoid' | 'invalidVoidExprArrow' | 'invalidVoidExprArrowWrapVoid' | 'invalidVoidExprReturn' | 'invalidVoidExprReturnLast' | 'invalidVoidExprReturnWrapVoid' + | 'invalidVoidExprWrapVoid' | 'voidExprWrapVoid'; export default util.createRule({ @@ -28,7 +28,7 @@ export default util.createRule({ docs: { description: 'Require expressions of type void to appear in statement position', - recommended: false, + recommended: 'strict', requiresTypeChecking: true, }, messages: { @@ -80,10 +80,8 @@ export default util.createRule({ | TSESTree.CallExpression | TSESTree.TaggedTemplateExpression, ): void { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(checker, tsNode); + const services = util.getParserServices(context); + const type = util.getConstrainedTypeAtLocation(services, node); if (!tsutils.isTypeFlagSet(type, ts.TypeFlags.VoidLike)) { // not a void expression return; @@ -186,7 +184,7 @@ export default util.createRule({ // put a semicolon at the beginning of the line newReturnStmtText = `;${newReturnStmtText}`; } - if (returnStmt.parent?.type !== AST_NODE_TYPES.BlockStatement) { + if (returnStmt.parent.type !== AST_NODE_TYPES.BlockStatement) { // e.g. `if (cond) return console.error();` // add braces if not inside a block newReturnStmtText = `{ ${newReturnStmtText} }`; diff --git a/packages/eslint-plugin/src/rules/no-dupe-class-members.ts b/packages/eslint-plugin/src/rules/no-dupe-class-members.ts index 62c1a8feb80..95689cae513 100644 --- a/packages/eslint-plugin/src/rules/no-dupe-class-members.ts +++ b/packages/eslint-plugin/src/rules/no-dupe-class-members.ts @@ -15,7 +15,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow duplicate class members', - recommended: false, extendsBaseRule: true, }, hasSuggestions: baseRule.meta.hasSuggestions, diff --git a/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts b/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts index 4bb011d1234..8aeb1c4200b 100644 --- a/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts +++ b/packages/eslint-plugin/src/rules/no-duplicate-enum-values.ts @@ -9,7 +9,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow duplicate enum member values', - recommended: 'strict', + recommended: 'recommended', }, hasSuggestions: false, messages: { @@ -45,7 +45,7 @@ export default util.createRule({ return; } - let value: string | number | undefined; + let value: number | string | undefined; if (isStringLiteral(member.initializer)) { value = String(member.initializer.value); } else if (isNumberLiteral(member.initializer)) { diff --git a/packages/eslint-plugin/src/rules/no-duplicate-imports.ts b/packages/eslint-plugin/src/rules/no-duplicate-imports.ts deleted file mode 100644 index c84fd26468f..00000000000 --- a/packages/eslint-plugin/src/rules/no-duplicate-imports.ts +++ /dev/null @@ -1,127 +0,0 @@ -import type { TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - -import * as util from '../util'; -import { getESLintCoreRule } from '../util/getESLintCoreRule'; - -const baseRule = getESLintCoreRule('no-duplicate-imports'); - -type Options = util.InferOptionsTypeFromRule; -type MessageIds = util.InferMessageIdsTypeFromRule; - -export default util.createRule({ - name: 'no-duplicate-imports', - meta: { - deprecated: true, - replacedBy: ['import/no-duplicates'], - type: 'problem', - docs: { - description: 'Disallow duplicate imports', - recommended: false, - extendsBaseRule: true, - }, - hasSuggestions: baseRule.meta.hasSuggestions, - schema: baseRule.meta.schema, - messages: { - ...baseRule.meta.messages, - importType: '{{module}} type import is duplicated.', - importTypeAs: '{{module}} type import is duplicated as type export.', - exportType: '{{module}} type export is duplicated.', - exportTypeAs: '{{module}} type export is duplicated as type import.', - }, - }, - defaultOptions: [ - { - includeExports: false, - }, - ], - create(context, [{ includeExports }]) { - const rules = baseRule.create(context); - const typeMemberImports = new Set(); - const typeDefaultImports = new Set(); - const typeExports = new Set(); - - function report( - messageId: MessageIds, - node: TSESTree.Node, - module: string, - ): void { - context.report({ - messageId, - node, - data: { - module, - }, - }); - } - - function isAllMemberImport(node: TSESTree.ImportDeclaration): boolean { - return node.specifiers.every( - specifier => specifier.type === AST_NODE_TYPES.ImportSpecifier, - ); - } - - function checkTypeImport(node: TSESTree.ImportDeclaration): void { - if (node.source) { - const value = node.source.value; - const isMemberImport = isAllMemberImport(node); - if ( - isMemberImport - ? typeMemberImports.has(value) - : typeDefaultImports.has(value) - ) { - report('importType', node, value); - } - - if (includeExports && typeExports.has(value)) { - report('importTypeAs', node, value); - } - if (isMemberImport) { - typeMemberImports.add(value); - } else { - typeDefaultImports.add(value); - } - } - } - - function checkTypeExport( - node: TSESTree.ExportNamedDeclaration | TSESTree.ExportAllDeclaration, - ): void { - if (node.source) { - const value = node.source.value; - if (typeExports.has(value)) { - report('exportType', node, value); - } - if (typeMemberImports.has(value) || typeDefaultImports.has(value)) { - report('exportTypeAs', node, value); - } - typeExports.add(value); - } - } - - return { - ...rules, - ImportDeclaration(node): void { - if (node.importKind === 'type') { - checkTypeImport(node); - return; - } - rules.ImportDeclaration(node); - }, - ExportNamedDeclaration(node): void { - if (includeExports && node.exportKind === 'type') { - checkTypeExport(node); - return; - } - rules.ExportNamedDeclaration?.(node); - }, - ExportAllDeclaration(node): void { - if (includeExports && node.exportKind === 'type') { - checkTypeExport(node); - return; - } - rules.ExportAllDeclaration?.(node); - }, - }; - }, -}); diff --git a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts new file mode 100644 index 00000000000..c6e31acf586 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts @@ -0,0 +1,207 @@ +import type { TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { Type } from 'typescript'; + +import * as util from '../util'; + +export type Options = [ + { + ignoreIntersections?: boolean; + ignoreUnions?: boolean; + }, +]; + +export type MessageIds = 'duplicate'; + +const astIgnoreKeys = new Set(['range', 'loc', 'parent']); + +const isSameAstNode = (actualNode: unknown, expectedNode: unknown): boolean => { + if (actualNode === expectedNode) { + return true; + } + if ( + actualNode && + expectedNode && + typeof actualNode === 'object' && + typeof expectedNode === 'object' + ) { + if (Array.isArray(actualNode) && Array.isArray(expectedNode)) { + if (actualNode.length !== expectedNode.length) { + return false; + } + return !actualNode.some( + (nodeEle, index) => !isSameAstNode(nodeEle, expectedNode[index]), + ); + } + const actualNodeKeys = Object.keys(actualNode).filter( + key => !astIgnoreKeys.has(key), + ); + const expectedNodeKeys = Object.keys(expectedNode).filter( + key => !astIgnoreKeys.has(key), + ); + if (actualNodeKeys.length !== expectedNodeKeys.length) { + return false; + } + if ( + actualNodeKeys.some( + actualNodeKey => + !Object.prototype.hasOwnProperty.call(expectedNode, actualNodeKey), + ) + ) { + return false; + } + if ( + actualNodeKeys.some( + actualNodeKey => + !isSameAstNode( + actualNode[actualNodeKey as keyof typeof actualNode], + expectedNode[actualNodeKey as keyof typeof expectedNode], + ), + ) + ) { + return false; + } + return true; + } + return false; +}; + +export default util.createRule({ + name: 'no-duplicate-type-constituents', + meta: { + type: 'suggestion', + docs: { + description: + 'Disallow duplicate constituents of union or intersection types', + recommended: 'recommended', + requiresTypeChecking: true, + }, + fixable: 'code', + messages: { + duplicate: '{{type}} type constituent is duplicated with {{previous}}.', + }, + schema: [ + { + additionalProperties: false, + type: 'object', + properties: { + ignoreIntersections: { + type: 'boolean', + }, + ignoreUnions: { + type: 'boolean', + }, + }, + }, + ], + }, + defaultOptions: [ + { + ignoreIntersections: false, + ignoreUnions: false, + }, + ], + create(context, [{ ignoreIntersections, ignoreUnions }]) { + const parserServices = util.getParserServices(context); + const checker = parserServices.program.getTypeChecker(); + + function checkDuplicate( + node: TSESTree.TSIntersectionType | TSESTree.TSUnionType, + ): void { + const cachedTypeMap = new Map(); + node.types.reduce( + (uniqueConstituents, constituentNode) => { + const duplicatedPreviousConstituentInAst = uniqueConstituents.find( + ele => isSameAstNode(ele, constituentNode), + ); + if (duplicatedPreviousConstituentInAst) { + reportDuplicate( + { + duplicated: constituentNode, + duplicatePrevious: duplicatedPreviousConstituentInAst, + }, + node, + ); + return uniqueConstituents; + } + const constituentNodeType = checker.getTypeAtLocation( + parserServices.esTreeNodeToTSNodeMap.get(constituentNode), + ); + const duplicatedPreviousConstituentInType = + cachedTypeMap.get(constituentNodeType); + if (duplicatedPreviousConstituentInType) { + reportDuplicate( + { + duplicated: constituentNode, + duplicatePrevious: duplicatedPreviousConstituentInType, + }, + node, + ); + return uniqueConstituents; + } + cachedTypeMap.set(constituentNodeType, constituentNode); + return [...uniqueConstituents, constituentNode]; + }, + [], + ); + } + function reportDuplicate( + duplicateConstituent: { + duplicated: TSESTree.TypeNode; + duplicatePrevious: TSESTree.TypeNode; + }, + parentNode: TSESTree.TSIntersectionType | TSESTree.TSUnionType, + ): void { + const sourceCode = context.getSourceCode(); + const beforeTokens = sourceCode.getTokensBefore( + duplicateConstituent.duplicated, + { filter: token => token.value === '|' || token.value === '&' }, + ); + const beforeUnionOrIntersectionToken = + beforeTokens[beforeTokens.length - 1]; + const bracketBeforeTokens = sourceCode.getTokensBetween( + beforeUnionOrIntersectionToken, + duplicateConstituent.duplicated, + ); + const bracketAfterTokens = sourceCode.getTokensAfter( + duplicateConstituent.duplicated, + { count: bracketBeforeTokens.length }, + ); + const reportLocation: TSESTree.SourceLocation = { + start: duplicateConstituent.duplicated.loc.start, + end: + bracketAfterTokens.length > 0 + ? bracketAfterTokens[bracketAfterTokens.length - 1].loc.end + : duplicateConstituent.duplicated.loc.end, + }; + context.report({ + data: { + type: + parentNode.type === AST_NODE_TYPES.TSIntersectionType + ? 'Intersection' + : 'Union', + previous: sourceCode.getText(duplicateConstituent.duplicatePrevious), + }, + messageId: 'duplicate', + node: duplicateConstituent.duplicated, + loc: reportLocation, + fix: fixer => { + return [ + beforeUnionOrIntersectionToken, + ...bracketBeforeTokens, + duplicateConstituent.duplicated, + ...bracketAfterTokens, + ].map(token => fixer.remove(token)); + }, + }); + } + return { + ...(!ignoreIntersections && { + TSIntersectionType: checkDuplicate, + }), + ...(!ignoreUnions && { + TSUnionType: checkDuplicate, + }), + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts index 09d5b5420d8..0d1127f8a92 100644 --- a/packages/eslint-plugin/src/rules/no-dynamic-delete.ts +++ b/packages/eslint-plugin/src/rules/no-dynamic-delete.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/no-empty-function.ts b/packages/eslint-plugin/src/rules/no-empty-function.ts index a78e4b86db4..e77981eab30 100644 --- a/packages/eslint-plugin/src/rules/no-empty-function.ts +++ b/packages/eslint-plugin/src/rules/no-empty-function.ts @@ -1,5 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; @@ -18,6 +19,7 @@ const schema = util.deepMerge( properties: { allow: { items: { + type: 'string', enum: [ 'functions', 'arrowFunctions', @@ -38,7 +40,7 @@ const schema = util.deepMerge( }, }, }, -); +) as unknown as JSONSchema4; export default util.createRule({ name: 'no-empty-function', @@ -46,7 +48,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow empty functions', - recommended: 'error', + recommended: 'stylistic', extendsBaseRule: true, }, hasSuggestions: baseRule.meta.hasSuggestions, @@ -129,7 +131,7 @@ export default util.createRule({ * @private */ function isAllowedEmptyDecoratedFunctions( - node: TSESTree.FunctionExpression | TSESTree.FunctionDeclaration, + node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, ): boolean { if (isAllowedDecoratedFunctions && isBodyEmpty(node)) { const decorators = @@ -166,13 +168,6 @@ export default util.createRule({ rules.FunctionExpression(node); }, - FunctionDeclaration(node): void { - if (isAllowedEmptyDecoratedFunctions(node)) { - return; - } - - rules.FunctionDeclaration(node); - }, }; }, }); diff --git a/packages/eslint-plugin/src/rules/no-empty-interface.ts b/packages/eslint-plugin/src/rules/no-empty-interface.ts index d74034114bb..12499f3b95c 100644 --- a/packages/eslint-plugin/src/rules/no-empty-interface.ts +++ b/packages/eslint-plugin/src/rules/no-empty-interface.ts @@ -1,3 +1,4 @@ +import { ScopeType } from '@typescript-eslint/scope-manager'; import type { TSESLint } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; @@ -16,7 +17,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow the declaration of empty interfaces', - recommended: 'error', + recommended: 'stylistic', }, fixable: 'code', hasSuggestions: true, @@ -84,7 +85,7 @@ export default util.createRule({ const isInAmbientDeclaration = !!( util.isDefinitionFile(filename) && - scope.type === 'tsModule' && + scope.type === ScopeType.tsModule && scope.block.declare ); diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index 65b253a8a33..fd2ddeefbe2 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -9,7 +9,7 @@ export type Options = [ ignoreRestArgs?: boolean; }, ]; -export type MessageIds = 'unexpectedAny' | 'suggestUnknown' | 'suggestNever'; +export type MessageIds = 'suggestNever' | 'suggestUnknown' | 'unexpectedAny'; export default util.createRule({ name: 'no-explicit-any', @@ -17,7 +17,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow the `any` type', - recommended: 'warn', + recommended: 'recommended', }, fixable: 'code', hasSuggestions: true, @@ -83,7 +83,6 @@ export default util.createRule({ function isNodeRestElementInFunction(node: TSESTree.Node): boolean { return ( node.type === AST_NODE_TYPES.RestElement && - node.parent !== undefined && isNodeValidFunction(node.parent) ); } diff --git a/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts index a69cd262d6e..082c3d212a6 100644 --- a/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts @@ -8,7 +8,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow extra non-null assertions', - recommended: 'error', + recommended: 'recommended', }, fixable: 'code', schema: [], diff --git a/packages/eslint-plugin/src/rules/no-extra-parens.ts b/packages/eslint-plugin/src/rules/no-extra-parens.ts index a44276a0a76..b3a150ad201 100644 --- a/packages/eslint-plugin/src/rules/no-extra-parens.ts +++ b/packages/eslint-plugin/src/rules/no-extra-parens.ts @@ -18,7 +18,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Disallow unnecessary parentheses', - recommended: false, extendsBaseRule: true, }, fixable: 'code', @@ -80,7 +79,7 @@ export default util.createRule({ if ( node.arguments.length === 1 && - node.typeParameters?.params.some( + node.typeArguments?.params.some( param => param.type === AST_NODE_TYPES.TSImportType || param.type === AST_NODE_TYPES.TSArrayType, diff --git a/packages/eslint-plugin/src/rules/no-extra-semi.ts b/packages/eslint-plugin/src/rules/no-extra-semi.ts index 6fcfb4871ee..d2860771c53 100644 --- a/packages/eslint-plugin/src/rules/no-extra-semi.ts +++ b/packages/eslint-plugin/src/rules/no-extra-semi.ts @@ -12,7 +12,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow unnecessary semicolons', - recommended: 'error', extendsBaseRule: true, }, fixable: 'code', diff --git a/packages/eslint-plugin/src/rules/no-extraneous-class.ts b/packages/eslint-plugin/src/rules/no-extraneous-class.ts index b7b93c8c77c..21dda4c686d 100644 --- a/packages/eslint-plugin/src/rules/no-extraneous-class.ts +++ b/packages/eslint-plugin/src/rules/no-extraneous-class.ts @@ -11,7 +11,7 @@ type Options = [ allowWithDecorator?: boolean; }, ]; -type MessageIds = 'empty' | 'onlyStatic' | 'onlyConstructor'; +type MessageIds = 'empty' | 'onlyConstructor' | 'onlyStatic'; export default util.createRule({ name: 'no-extraneous-class', @@ -72,9 +72,8 @@ export default util.createRule({ ): boolean => { return !!( allowWithDecorator && - node && - node.decorators && - node.decorators.length + node?.decorators && + node.decorators.length !== 0 ); }; @@ -82,10 +81,9 @@ export default util.createRule({ ClassBody(node): void { const parent = node.parent as | TSESTree.ClassDeclaration - | TSESTree.ClassExpression - | undefined; + | TSESTree.ClassExpression; - if (!parent || parent.superClass || isAllowWithDecorator(parent)) { + if (parent.superClass || isAllowWithDecorator(parent)) { return; } diff --git a/packages/eslint-plugin/src/rules/no-floating-promises.ts b/packages/eslint-plugin/src/rules/no-floating-promises.ts index c4ce3db8e1c..b0a34e03340 100644 --- a/packages/eslint-plugin/src/rules/no-floating-promises.ts +++ b/packages/eslint-plugin/src/rules/no-floating-promises.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -16,8 +16,20 @@ type Options = [ type MessageId = | 'floating' | 'floatingVoid' - | 'floatingFixVoid' - | 'floatingFixAwait'; + | 'floatingUselessRejectionHandler' + | 'floatingUselessRejectionHandlerVoid' + | 'floatingFixAwait' + | 'floatingFixVoid'; + +const messageBase = + 'Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler.'; + +const messageBaseVoid = + 'Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler' + + ' or be explicitly marked as ignored with the `void` operator.'; + +const messageRejectionHandler = + 'A rejection handler that is not a function will be ignored.'; export default util.createRule({ name: 'no-floating-promises', @@ -25,18 +37,19 @@ export default util.createRule({ docs: { description: 'Require Promise-like statements to be handled appropriately', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, hasSuggestions: true, messages: { - floating: - 'Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler.', + floating: messageBase, floatingFixAwait: 'Add await operator.', - floatingVoid: - 'Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler' + - ' or be explicitly marked as ignored with the `void` operator.', + floatingVoid: messageBaseVoid, floatingFixVoid: 'Add void operator to ignore.', + floatingUselessRejectionHandler: + messageBase + ' ' + messageRejectionHandler, + floatingUselessRejectionHandlerVoid: + messageBaseVoid + ' ' + messageRejectionHandler, }, schema: [ { @@ -48,7 +61,7 @@ export default util.createRule({ }, ignoreIIFE: { description: - 'Whether to ignore async IIFEs (Immediately Invocated Function Expressions).', + 'Whether to ignore async IIFEs (Immediately Invoked Function Expressions).', type: 'boolean', }, }, @@ -65,8 +78,8 @@ export default util.createRule({ ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { ExpressionStatement(node): void { @@ -80,16 +93,23 @@ export default util.createRule({ expression = expression.expression; } - if (isUnhandledPromise(checker, expression)) { + const { isUnhandled, nonFunctionHandler } = isUnhandledPromise( + checker, + expression, + ); + + if (isUnhandled) { if (options.ignoreVoid) { context.report({ node, - messageId: 'floatingVoid', + messageId: nonFunctionHandler + ? 'floatingUselessRejectionHandlerVoid' + : 'floatingVoid', suggest: [ { messageId: 'floatingFixVoid', fix(fixer): TSESLint.RuleFix | TSESLint.RuleFix[] { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get( + const tsNode = services.esTreeNodeToTSNodeMap.get( node.expression, ); if (isHigherPrecedenceThanUnary(tsNode)) { @@ -110,7 +130,9 @@ export default util.createRule({ } else { context.report({ node, - messageId: 'floating', + messageId: nonFunctionHandler + ? 'floatingUselessRejectionHandler' + : 'floating', suggest: [ { messageId: 'floatingFixAwait', @@ -124,7 +146,7 @@ export default util.createRule({ 'await', ); } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get( + const tsNode = services.esTreeNodeToTSNodeMap.get( node.expression, ); if (isHigherPrecedenceThanUnary(tsNode)) { @@ -148,7 +170,7 @@ export default util.createRule({ }; function isHigherPrecedenceThanUnary(node: ts.Node): boolean { - const operator = tsutils.isBinaryExpression(node) + const operator = ts.isBinaryExpression(node) ? node.operatorToken.kind : ts.SyntaxKind.Unknown; const nodePrecedence = util.getOperatorPrecedence(node.kind, operator); @@ -168,16 +190,31 @@ export default util.createRule({ ); } + function isValidRejectionHandler(rejectionHandler: TSESTree.Node): boolean { + return ( + services.program + .getTypeChecker() + .getTypeAtLocation( + services.esTreeNodeToTSNodeMap.get(rejectionHandler), + ) + .getCallSignatures().length > 0 + ); + } + function isUnhandledPromise( checker: ts.TypeChecker, node: TSESTree.Node, - ): boolean { + ): { isUnhandled: boolean; nonFunctionHandler?: boolean } { // First, check expressions whose resulting types may not be promise-like if (node.type === AST_NODE_TYPES.SequenceExpression) { // Any child in a comma expression could return a potentially unhandled // promise, so we check them all regardless of whether the final returned // value is promise-like. - return node.expressions.some(item => isUnhandledPromise(checker, item)); + return ( + node.expressions + .map(item => isUnhandledPromise(checker, item)) + .find(result => result.isUnhandled) ?? { isUnhandled: false } + ); } if ( @@ -191,27 +228,50 @@ export default util.createRule({ } // Check the type. At this point it can't be unhandled if it isn't a promise - if ( - !isPromiseLike(checker, parserServices.esTreeNodeToTSNodeMap.get(node)) - ) { - return false; + if (!isPromiseLike(checker, services.esTreeNodeToTSNodeMap.get(node))) { + return { isUnhandled: false }; } if (node.type === AST_NODE_TYPES.CallExpression) { - // If the outer expression is a call, it must be either a `.then()` or - // `.catch()` that handles the promise. - return ( - !isPromiseCatchCallWithHandler(node) && - !isPromiseThenCallWithRejectionHandler(node) && - !isPromiseFinallyCallWithHandler(node) - ); + // If the outer expression is a call, a `.catch()` or `.then()` with + // rejection handler handles the promise. + + const catchRejectionHandler = getRejectionHandlerFromCatchCall(node); + if (catchRejectionHandler) { + if (isValidRejectionHandler(catchRejectionHandler)) { + return { isUnhandled: false }; + } else { + return { isUnhandled: true, nonFunctionHandler: true }; + } + } + + const thenRejectionHandler = getRejectionHandlerFromThenCall(node); + if (thenRejectionHandler) { + if (isValidRejectionHandler(thenRejectionHandler)) { + return { isUnhandled: false }; + } else { + return { isUnhandled: true, nonFunctionHandler: true }; + } + } + + // `x.finally()` is transparent to resolution of the promise, so check `x`. + // ("object" in this context is the `x` in `x.finally()`) + const promiseFinallyObject = getObjectFromFinallyCall(node); + if (promiseFinallyObject) { + return isUnhandledPromise(checker, promiseFinallyObject); + } + + // All other cases are unhandled. + return { isUnhandled: true }; } else if (node.type === AST_NODE_TYPES.ConditionalExpression) { // We must be getting the promise-like value from one of the branches of the // ternary. Check them directly. - return ( - isUnhandledPromise(checker, node.alternate) || - isUnhandledPromise(checker, node.consequent) - ); + const alternateResult = isUnhandledPromise(checker, node.alternate); + if (alternateResult.isUnhandled) { + return alternateResult; + } else { + return isUnhandledPromise(checker, node.consequent); + } } else if ( node.type === AST_NODE_TYPES.MemberExpression || node.type === AST_NODE_TYPES.Identifier || @@ -220,18 +280,20 @@ export default util.createRule({ // If it is just a property access chain or a `new` call (e.g. `foo.bar` or // `new Promise()`), the promise is not handled because it doesn't have the // necessary then/catch call at the end of the chain. - return true; + return { isUnhandled: true }; } else if (node.type === AST_NODE_TYPES.LogicalExpression) { - return ( - isUnhandledPromise(checker, node.left) || - isUnhandledPromise(checker, node.right) - ); + const leftResult = isUnhandledPromise(checker, node.left); + if (leftResult.isUnhandled) { + return leftResult; + } else { + return isUnhandledPromise(checker, node.right); + } } // We conservatively return false for all other types of expressions because // we don't want to accidentally fail if the promise is handled internally but // we just can't tell. - return false; + return { isUnhandled: false }; } }, }); @@ -293,35 +355,42 @@ function isFunctionParam( return false; } -function isPromiseCatchCallWithHandler( +function getRejectionHandlerFromCatchCall( expression: TSESTree.CallExpression, -): boolean { - return ( +): TSESTree.CallExpressionArgument | undefined { + if ( expression.callee.type === AST_NODE_TYPES.MemberExpression && expression.callee.property.type === AST_NODE_TYPES.Identifier && expression.callee.property.name === 'catch' && expression.arguments.length >= 1 - ); + ) { + return expression.arguments[0]; + } else { + return undefined; + } } -function isPromiseThenCallWithRejectionHandler( +function getRejectionHandlerFromThenCall( expression: TSESTree.CallExpression, -): boolean { - return ( +): TSESTree.CallExpressionArgument | undefined { + if ( expression.callee.type === AST_NODE_TYPES.MemberExpression && expression.callee.property.type === AST_NODE_TYPES.Identifier && expression.callee.property.name === 'then' && expression.arguments.length >= 2 - ); + ) { + return expression.arguments[1]; + } else { + return undefined; + } } -function isPromiseFinallyCallWithHandler( +function getObjectFromFinallyCall( expression: TSESTree.CallExpression, -): boolean { - return ( - expression.callee.type === AST_NODE_TYPES.MemberExpression && +): TSESTree.Expression | undefined { + return expression.callee.type === AST_NODE_TYPES.MemberExpression && expression.callee.property.type === AST_NODE_TYPES.Identifier && - expression.callee.property.name === 'finally' && - expression.arguments.length >= 1 - ); + expression.callee.property.name === 'finally' + ? expression.callee.object + : undefined; } diff --git a/packages/eslint-plugin/src/rules/no-for-in-array.ts b/packages/eslint-plugin/src/rules/no-for-in-array.ts index 34590d4e569..ab6e9832165 100644 --- a/packages/eslint-plugin/src/rules/no-for-in-array.ts +++ b/packages/eslint-plugin/src/rules/no-for-in-array.ts @@ -7,7 +7,7 @@ export default util.createRule({ meta: { docs: { description: 'Disallow iterating over an array with a for-in loop', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -21,14 +21,10 @@ export default util.createRule({ create(context) { return { ForInStatement(node): void { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); - const type = util.getConstrainedTypeAtLocation( - checker, - originalNode.expression, - ); + const type = util.getConstrainedTypeAtLocation(services, node.right); if ( util.isTypeArrayTypeOrUnionOfArrayTypes(type, checker) || diff --git a/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts b/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts deleted file mode 100644 index bed757b8072..00000000000 --- a/packages/eslint-plugin/src/rules/no-implicit-any-catch.ts +++ /dev/null @@ -1,96 +0,0 @@ -import type { TSESLint } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - -import * as util from '../util'; - -export type Options = [ - { - allowExplicitAny: boolean; - }, -]; -export type MessageIds = - | 'implicitAnyInCatch' - | 'explicitAnyInCatch' - | 'suggestExplicitUnknown'; - -export default util.createRule({ - name: 'no-implicit-any-catch', - meta: { - deprecated: true, - type: 'suggestion', - docs: { - description: 'Disallow usage of the implicit `any` type in catch clauses', - recommended: false, - }, - fixable: 'code', - hasSuggestions: true, - messages: { - implicitAnyInCatch: 'Implicit any in catch clause.', - explicitAnyInCatch: 'Explicit any in catch clause.', - suggestExplicitUnknown: - 'Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.', - }, - schema: [ - { - type: 'object', - additionalProperties: false, - properties: { - allowExplicitAny: { - description: - 'Whether to disallow specifying `: any` as the error type as well. See also `no-explicit-any`.', - type: 'boolean', - }, - }, - }, - ], - }, - defaultOptions: [ - { - allowExplicitAny: false, - }, - ], - create(context, [{ allowExplicitAny }]) { - return { - CatchClause(node): void { - if (!node.param) { - return; // ignore catch without variable - } - - if (!node.param.typeAnnotation) { - context.report({ - node, - messageId: 'implicitAnyInCatch', - suggest: [ - { - messageId: 'suggestExplicitUnknown', - fix(fixer): TSESLint.RuleFix { - return fixer.insertTextAfter(node.param!, ': unknown'); - }, - }, - ], - }); - } else if ( - !allowExplicitAny && - node.param.typeAnnotation.typeAnnotation.type === - AST_NODE_TYPES.TSAnyKeyword - ) { - context.report({ - node, - messageId: 'explicitAnyInCatch', - suggest: [ - { - messageId: 'suggestExplicitUnknown', - fix(fixer): TSESLint.RuleFix { - return fixer.replaceText( - node.param!.typeAnnotation!, - ': unknown', - ); - }, - }, - ], - }); - } - }, - }; - }, -}); diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index d88cd05ff6f..0560d7647c4 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -19,7 +19,7 @@ export default util.createRule({ meta: { docs: { description: 'Disallow the use of `eval()`-like methods', - recommended: 'error', + recommended: 'recommended', extendsBaseRule: true, requiresTypeChecking: true, }, @@ -33,9 +33,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const program = parserServices.program; - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function getCalleeName( node: TSESTree.LeftHandSideExpression, @@ -65,8 +64,7 @@ export default util.createRule({ } function isFunctionType(node: TSESTree.Node): boolean { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node); const symbol = type.getSymbol(); if ( @@ -79,11 +77,12 @@ export default util.createRule({ return true; } + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison if (symbol && symbol.escapedName === FUNCTION_CONSTRUCTOR) { const declarations = symbol.getDeclarations() ?? []; for (const declaration of declarations) { const sourceFile = declaration.getSourceFile(); - if (program.isSourceFileDefaultLibrary(sourceFile)) { + if (services.program.isSourceFileDefaultLibrary(sourceFile)) { return true; } } @@ -132,7 +131,7 @@ export default util.createRule({ } function checkImpliedEval( - node: TSESTree.NewExpression | TSESTree.CallExpression, + node: TSESTree.CallExpression | TSESTree.NewExpression, ): void { const calleeName = getCalleeName(node.callee); if (calleeName == null) { @@ -140,14 +139,13 @@ export default util.createRule({ } if (calleeName === FUNCTION_CONSTRUCTOR) { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.callee); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node.callee); const symbol = type.getSymbol(); if (symbol) { const declarations = symbol.getDeclarations() ?? []; for (const declaration of declarations) { const sourceFile = declaration.getSourceFile(); - if (program.isSourceFileDefaultLibrary(sourceFile)) { + if (services.program.isSourceFileDefaultLibrary(sourceFile)) { context.report({ node, messageId: 'noFunctionConstructor' }); return; } diff --git a/packages/eslint-plugin/src/rules/no-import-type-side-effects.ts b/packages/eslint-plugin/src/rules/no-import-type-side-effects.ts index 941aa93e72a..0e814a0ca48 100644 --- a/packages/eslint-plugin/src/rules/no-import-type-side-effects.ts +++ b/packages/eslint-plugin/src/rules/no-import-type-side-effects.ts @@ -13,7 +13,6 @@ export default util.createRule({ docs: { description: 'Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers', - recommended: false, }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index 1bc83c07c70..54823f7be39 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -19,7 +19,7 @@ export default util.createRule({ docs: { description: 'Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean', - recommended: 'error', + recommended: 'stylistic', }, fixable: 'code', messages: { @@ -90,12 +90,12 @@ export default util.createRule({ type Keywords = | TSESTree.TSBigIntKeyword | TSESTree.TSBooleanKeyword - | TSESTree.TSNumberKeyword | TSESTree.TSNullKeyword + | TSESTree.TSNumberKeyword | TSESTree.TSStringKeyword | TSESTree.TSSymbolKeyword - | TSESTree.TSUndefinedKeyword - | TSESTree.TSTypeReference; + | TSESTree.TSTypeReference + | TSESTree.TSUndefinedKeyword; const keywordMap = { [AST_NODE_TYPES.TSBigIntKeyword]: 'bigint', [AST_NODE_TYPES.TSBooleanKeyword]: 'boolean', @@ -193,9 +193,9 @@ export default util.createRule({ */ function reportInferrableType( node: - | TSESTree.VariableDeclarator | TSESTree.Parameter - | TSESTree.PropertyDefinition, + | TSESTree.PropertyDefinition + | TSESTree.VariableDeclarator, typeNode: TSESTree.TSTypeAnnotation | undefined, initNode: TSESTree.Expression | null | undefined, ): void { @@ -243,9 +243,9 @@ export default util.createRule({ function inferrableParameterVisitor( node: - | TSESTree.FunctionExpression + | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration - | TSESTree.ArrowFunctionExpression, + | TSESTree.FunctionExpression, ): void { if (ignoreParameters || !node.params) { return; diff --git a/packages/eslint-plugin/src/rules/no-invalid-this.ts b/packages/eslint-plugin/src/rules/no-invalid-this.ts index 36236d0b4af..c1acdb24fe7 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-this.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-this.ts @@ -20,13 +20,9 @@ export default createRule({ docs: { description: 'Disallow `this` keywords outside of classes or class-like objects', - recommended: false, extendsBaseRule: true, }, - // TODO: this rule has only had messages since v7.0 - remove this when we remove support for v6 - messages: baseRule.meta.messages ?? { - unexpectedThis: "Unexpected 'this'.", - }, + messages: baseRule.meta.messages, hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, }, diff --git a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts index 9f938ac438f..4808a439f5a 100644 --- a/packages/eslint-plugin/src/rules/no-invalid-void-type.ts +++ b/packages/eslint-plugin/src/rules/no-invalid-void-type.ts @@ -4,14 +4,14 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; interface Options { - allowInGenericTypeArguments?: boolean | string[]; + allowInGenericTypeArguments?: string[] | boolean; allowAsThisParameter?: boolean; } type MessageIds = | 'invalidVoidForGeneric' - | 'invalidVoidNotReturnOrGeneric' | 'invalidVoidNotReturn' + | 'invalidVoidNotReturnOrGeneric' | 'invalidVoidNotReturnOrThisParam' | 'invalidVoidNotReturnOrThisParamOrGeneric' | 'invalidVoidUnionConstituent'; @@ -47,7 +47,7 @@ export default util.createRule<[Options], MessageIds>({ { type: 'array', items: { type: 'string' }, - minLength: 1, + minItems: 1, }, ], }, @@ -156,9 +156,9 @@ export default util.createRule<[Options], MessageIds>({ validUnionMembers.includes(member.type) || // allows any T<..., void, ...> here, checked by checkGenericTypeArgument (member.type === AST_NODE_TYPES.TSTypeReference && - member.typeParameters?.type === + member.typeArguments?.type === AST_NODE_TYPES.TSTypeParameterInstantiation && - member.typeParameters?.params + member.typeArguments?.params .map(param => param.type) .includes(AST_NODE_TYPES.TSVoidKeyword)), ); @@ -166,11 +166,6 @@ export default util.createRule<[Options], MessageIds>({ return { TSVoidKeyword(node: TSESTree.TSVoidKeyword): void { - /* istanbul ignore next */ - if (!node.parent?.parent) { - return; - } - // checks T<..., void, ...> against specification of allowInGenericArguments option if ( node.parent.type === AST_NODE_TYPES.TSTypeParameterInstantiation && @@ -211,7 +206,7 @@ export default util.createRule<[Options], MessageIds>({ // default cases if ( validParents.includes(node.parent.type) && - !invalidGrandParents.includes(node.parent.parent.type) + !invalidGrandParents.includes(node.parent.parent!.type) ) { return; } @@ -235,7 +230,7 @@ export default util.createRule<[Options], MessageIds>({ function getNotReturnOrGenericMessageId( node: TSESTree.TSVoidKeyword, ): MessageIds { - return node.parent!.type === AST_NODE_TYPES.TSUnionType + return node.parent.type === AST_NODE_TYPES.TSUnionType ? 'invalidVoidUnionConstituent' : 'invalidVoidNotReturnOrGeneric'; } diff --git a/packages/eslint-plugin/src/rules/no-loop-func.ts b/packages/eslint-plugin/src/rules/no-loop-func.ts index 9e24cef086c..f4e4b50825c 100644 --- a/packages/eslint-plugin/src/rules/no-loop-func.ts +++ b/packages/eslint-plugin/src/rules/no-loop-func.ts @@ -16,7 +16,6 @@ export default util.createRule({ docs: { description: 'Disallow function declarations that contain unsafe references inside loop statements', - recommended: false, extendsBaseRule: true, }, hasSuggestions: baseRule.meta.hasSuggestions, @@ -36,8 +35,8 @@ export default util.createRule({ function checkForLoops( node: | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionExpression - | TSESTree.FunctionDeclaration, + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, ): void { const loopNode = getContainingLoopNode(node); diff --git a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts index 2c0d84364e4..8a07f975ab1 100644 --- a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts +++ b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts @@ -16,7 +16,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow literal numbers that lose precision', - recommended: 'error', + recommended: 'recommended', extendsBaseRule: true, }, hasSuggestions: baseRule?.meta.hasSuggestions, diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 604e82d2186..92a03c9078d 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -1,5 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; import * as util from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; @@ -31,7 +32,7 @@ const schema = util.deepMerge( }, }, }, -); +) as unknown as JSONSchema4; export default util.createRule({ name: 'no-magic-numbers', @@ -39,7 +40,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow magic numbers', - recommended: false, extendsBaseRule: true, }, schema: [schema], diff --git a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts index 79d0611e5d0..524c5438788 100644 --- a/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts +++ b/packages/eslint-plugin/src/rules/no-meaningless-void-operator.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { ESLintUtils } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -47,8 +47,8 @@ export default util.createRule< defaultOptions: [{ checkNever: false }], create(context, [{ checkNever }]) { - const parserServices = ESLintUtils.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = ESLintUtils.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); return { @@ -60,10 +60,7 @@ export default util.createRule< ]); }; - const argTsNode = parserServices.esTreeNodeToTSNodeMap.get( - node.argument, - ); - const argType = checker.getTypeAtLocation(argTsNode); + const argType = services.getTypeAtLocation(node.argument); const unionParts = tsutils.unionTypeParts(argType); if ( unionParts.every( diff --git a/packages/eslint-plugin/src/rules/no-misused-new.ts b/packages/eslint-plugin/src/rules/no-misused-new.ts index 7a4dcc69dab..41df0cb5f99 100644 --- a/packages/eslint-plugin/src/rules/no-misused-new.ts +++ b/packages/eslint-plugin/src/rules/no-misused-new.ts @@ -9,7 +9,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Enforce valid definition of `new` and `constructor`', - recommended: 'error', + recommended: 'recommended', }, schema: [], messages: { @@ -25,9 +25,9 @@ export default util.createRule({ */ function getTypeReferenceName( node: + | TSESTree.EntityName | TSESTree.TSTypeAnnotation | TSESTree.TypeNode - | TSESTree.EntityName | undefined, ): string | null { if (node) { @@ -50,7 +50,7 @@ export default util.createRule({ * @param returnType type to be compared */ function isMatchingParentType( - parent: undefined | TSESTree.Node, + parent: TSESTree.Node | undefined, returnType: TSESTree.TSTypeAnnotation | undefined, ): boolean { if ( @@ -70,7 +70,7 @@ export default util.createRule({ ): void { if ( isMatchingParentType( - node.parent!.parent as TSESTree.TSInterfaceDeclaration, + node.parent.parent as TSESTree.TSInterfaceDeclaration, node.returnType, ) ) { @@ -93,10 +93,7 @@ export default util.createRule({ node: TSESTree.MethodDefinition, ): void { if (node.value.type === AST_NODE_TYPES.TSEmptyBodyFunctionExpression) { - if ( - node.parent && - isMatchingParentType(node.parent.parent, node.value.returnType) - ) { + if (isMatchingParentType(node.parent.parent, node.value.returnType)) { context.report({ node, messageId: 'errorMessageClass', diff --git a/packages/eslint-plugin/src/rules/no-misused-promises.ts b/packages/eslint-plugin/src/rules/no-misused-promises.ts index 06aad3bf1fb..a5fe0721b88 100644 --- a/packages/eslint-plugin/src/rules/no-misused-promises.ts +++ b/packages/eslint-plugin/src/rules/no-misused-promises.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -8,7 +8,7 @@ import * as util from '../util'; type Options = [ { checksConditionals?: boolean; - checksVoidReturn?: boolean | ChecksVoidReturnOptions; + checksVoidReturn?: ChecksVoidReturnOptions | boolean; checksSpreads?: boolean; }, ]; @@ -23,15 +23,15 @@ interface ChecksVoidReturnOptions { type MessageId = | 'conditional' + | 'spread' | 'voidReturnArgument' - | 'voidReturnVariable' + | 'voidReturnAttribute' | 'voidReturnProperty' | 'voidReturnReturnValue' - | 'voidReturnAttribute' - | 'spread'; + | 'voidReturnVariable'; function parseChecksVoidReturn( - checksVoidReturn: boolean | ChecksVoidReturnOptions | undefined, + checksVoidReturn: ChecksVoidReturnOptions | boolean | undefined, ): ChecksVoidReturnOptions | false { switch (checksVoidReturn) { case false: @@ -63,7 +63,7 @@ export default util.createRule({ meta: { docs: { description: 'Disallow Promises in places not designed to handle them', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -83,6 +83,7 @@ export default util.createRule({ schema: [ { type: 'object', + additionalProperties: false, properties: { checksConditionals: { type: 'boolean', @@ -120,8 +121,8 @@ export default util.createRule({ ], create(context, [{ checksConditionals, checksVoidReturn, checksSpreads }]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const checkedNodes = new Set(); @@ -200,7 +201,7 @@ export default util.createRule({ } return; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (isAlwaysThenable(checker, tsNode)) { context.report({ messageId: 'conditional', @@ -212,7 +213,7 @@ export default util.createRule({ function checkArguments( node: TSESTree.CallExpression | TSESTree.NewExpression, ): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); const voidArgs = voidFunctionArguments(checker, tsNode); if (voidArgs.size === 0) { return; @@ -223,7 +224,7 @@ export default util.createRule({ continue; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(argument); + const tsNode = services.esTreeNodeToTSNodeMap.get(argument); if (returnsThenable(checker, tsNode as ts.Expression)) { context.report({ messageId: 'voidReturnArgument', @@ -234,8 +235,8 @@ export default util.createRule({ } function checkAssignment(node: TSESTree.AssignmentExpression): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const varType = checker.getTypeAtLocation(tsNode.left); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); + const varType = services.getTypeAtLocation(node.left); if (!isVoidReturningFunctionType(checker, tsNode.left, varType)) { return; } @@ -249,11 +250,11 @@ export default util.createRule({ } function checkVariableDeclaration(node: TSESTree.VariableDeclarator): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (tsNode.initializer === undefined || node.init == null) { return; } - const varType = checker.getTypeAtLocation(tsNode.name); + const varType = services.getTypeAtLocation(node.id); if (!isVoidReturningFunctionType(checker, tsNode.initializer, varType)) { return; } @@ -267,7 +268,7 @@ export default util.createRule({ } function checkProperty(node: TSESTree.Property): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (ts.isPropertyAssignment(tsNode)) { const contextualType = checker.getContextualType(tsNode.initializer); if ( @@ -343,7 +344,7 @@ export default util.createRule({ } function checkReturnStatement(node: TSESTree.ReturnStatement): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (tsNode.expression === undefined || node.argument == null) { return; } @@ -371,10 +372,10 @@ export default util.createRule({ ) { return; } - const expressionContainer = parserServices.esTreeNodeToTSNodeMap.get( + const expressionContainer = services.esTreeNodeToTSNodeMap.get( node.value, ); - const expression = parserServices.esTreeNodeToTSNodeMap.get( + const expression = services.esTreeNodeToTSNodeMap.get( node.value.expression, ); const contextualType = checker.getContextualType(expressionContainer); @@ -395,7 +396,7 @@ export default util.createRule({ } function checkSpread(node: TSESTree.SpreadElement): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (isSometimesThenable(checker, tsNode.expression)) { context.report({ @@ -555,7 +556,7 @@ function voidFunctionArguments( // Unwrap 'Array' to 'MaybeVoidFunction', // so that we'll handle it in the same way as a non-rest // 'param: MaybeVoidFunction' - type = checker.getTypeArguments(type)[0]; + type = util.getTypeArguments(type, checker)[0]; for (let i = index; i < node.arguments.length; i++) { checkThenableOrVoidArgument( checker, @@ -569,7 +570,7 @@ function voidFunctionArguments( } else if (checker.isTupleType(type)) { // Check each type in the tuple - for example, [boolean, () => void] would // add the index of the second tuple parameter to 'voidReturnIndices' - const typeArgs = checker.getTypeArguments(type); + const typeArgs = util.getTypeArguments(type, checker); for ( let i = index; i < node.arguments.length && i - index < typeArgs.length; diff --git a/packages/eslint-plugin/src/rules/no-mixed-enums.ts b/packages/eslint-plugin/src/rules/no-mixed-enums.ts index 047471d4b26..33ad352b1b6 100644 --- a/packages/eslint-plugin/src/rules/no-mixed-enums.ts +++ b/packages/eslint-plugin/src/rules/no-mixed-enums.ts @@ -2,7 +2,7 @@ import type { Scope } from '@typescript-eslint/scope-manager'; import { DefinitionType } from '@typescript-eslint/scope-manager'; import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -157,8 +157,8 @@ export default util.createRule({ // export enum MyEnum { B } // } if ( - node.parent!.type === AST_NODE_TYPES.ExportNamedDeclaration && - node.parent!.parent!.type === AST_NODE_TYPES.TSModuleBlock + node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration && + node.parent.parent.type === AST_NODE_TYPES.TSModuleBlock ) { // TODO: We don't need to dip into the TypeScript type checker here! // Merged namespaces must all exist in the same file. diff --git a/packages/eslint-plugin/src/rules/no-namespace.ts b/packages/eslint-plugin/src/rules/no-namespace.ts index 2a9a4a251be..145ddc3ad16 100644 --- a/packages/eslint-plugin/src/rules/no-namespace.ts +++ b/packages/eslint-plugin/src/rules/no-namespace.ts @@ -17,7 +17,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow TypeScript namespaces', - recommended: 'error', + recommended: 'recommended', }, messages: { moduleSyntaxIsPreferred: @@ -63,12 +63,11 @@ export default util.createRule({ } return { - "TSModuleDeclaration[global!=true][id.type='Identifier']"( + "TSModuleDeclaration[global!=true][id.type!='Literal']"( node: TSESTree.TSModuleDeclaration, ): void { if ( - (node.parent && - node.parent.type === AST_NODE_TYPES.TSModuleDeclaration) || + node.parent.type === AST_NODE_TYPES.TSModuleDeclaration || (allowDefinitionFiles && util.isDefinitionFile(filename)) || (allowDeclarations && isDeclaration(node)) ) { diff --git a/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts b/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts index d63b3ad43e3..3939fbdebb2 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-asserted-optional-chain.ts @@ -1,18 +1,7 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as semver from 'semver'; -import * as ts from 'typescript'; import * as util from '../util'; -const is3dot9 = semver.satisfies( - ts.version, - `>= 3.9.0 || >= 3.9.1-rc || >= 3.9.0-beta`, - { - includePrerelease: true, - }, -); - export default util.createRule({ name: 'no-non-null-asserted-optional-chain', meta: { @@ -20,7 +9,7 @@ export default util.createRule({ docs: { description: 'Disallow non-null assertions after an optional chain expression', - recommended: 'error', + recommended: 'recommended', }, hasSuggestions: true, messages: { @@ -32,16 +21,7 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - // TS3.9 made a breaking change to how non-null works with optional chains. - // Pre-3.9, `x?.y!.z` means `(x?.y).z` - i.e. it essentially scrubbed the optionality from the chain - // Post-3.9, `x?.y!.z` means `x?.y!.z` - i.e. it just asserts that the property `y` is non-null, not the result of `x?.y`. - // This means that for > 3.9, x?.y!.z is valid! - // - // NOTE: these cases are still invalid for 3.9: - // - x?.y.z! - // - (x?.y)!.z - - const baseSelectors = { + return { // non-nulling a wrapped chain will scrub all nulls introduced by the chain // (x?.y)! // (x?.())! @@ -89,62 +69,5 @@ export default util.createRule({ }); }, }; - - if (is3dot9) { - return baseSelectors; - } - - return { - ...baseSelectors, - [[ - // > :not(ChainExpression) because that case is handled by a previous selector - 'MemberExpression > TSNonNullExpression.object > :not(ChainExpression)', - 'CallExpression > TSNonNullExpression.callee > :not(ChainExpression)', - ].join(', ')](child: TSESTree.Node): void { - // selector guarantees this assertion - const node = child.parent as TSESTree.TSNonNullExpression; - - let current = child; - while (current) { - switch (current.type) { - case AST_NODE_TYPES.MemberExpression: - if (current.optional) { - // found an optional chain! stop traversing - break; - } - - current = current.object; - continue; - - case AST_NODE_TYPES.CallExpression: - if (current.optional) { - // found an optional chain! stop traversing - break; - } - - current = current.callee; - continue; - - default: - // something that's not a ChainElement, which means this is not an optional chain we want to check - return; - } - } - - context.report({ - node, - messageId: 'noNonNullOptionalChain', - // use a suggestion instead of a fixer, because this can obviously break type checks - suggest: [ - { - messageId: 'suggestRemovingNonNull', - fix(fixer): TSESLint.RuleFix { - return fixer.removeRange([node.range[1] - 1, node.range[1]]); - }, - }, - ], - }); - }, - }; }, }); diff --git a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts index 7a11802a737..ba8b88158de 100644 --- a/packages/eslint-plugin/src/rules/no-non-null-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-non-null-assertion.ts @@ -12,7 +12,7 @@ export default util.createRule<[], MessageIds>({ docs: { description: 'Disallow non-null assertions using the `!` postfix operator', - recommended: 'warn', + recommended: 'strict', }, hasSuggestions: true, messages: { @@ -29,7 +29,7 @@ export default util.createRule<[], MessageIds>({ TSNonNullExpression(node): void { const suggest: TSESLint.ReportSuggestionArray = []; function convertTokenToOptional( - replacement: '?' | '?.', + replacement: '?.' | '?', ): TSESLint.ReportFixFunction { return (fixer: TSESLint.RuleFixer): TSESLint.RuleFix | null => { const operator = sourceCode.getTokenAfter( diff --git a/packages/eslint-plugin/src/rules/no-parameter-properties.ts b/packages/eslint-plugin/src/rules/no-parameter-properties.ts deleted file mode 100644 index 3952dfc581f..00000000000 --- a/packages/eslint-plugin/src/rules/no-parameter-properties.ts +++ /dev/null @@ -1,114 +0,0 @@ -import type { TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - -import * as util from '../util'; - -type Modifier = - | 'readonly' - | 'private' - | 'protected' - | 'public' - | 'private readonly' - | 'protected readonly' - | 'public readonly'; -type Options = [ - { - allows: Modifier[]; - }, -]; -type MessageIds = 'noParamProp'; - -export default util.createRule({ - name: 'no-parameter-properties', - meta: { - deprecated: true, - replacedBy: ['@typescript-eslint/parameter-properties'], - type: 'problem', - docs: { - description: - 'Disallow the use of parameter properties in class constructors', - // too opinionated to be recommended - recommended: false, - }, - messages: { - noParamProp: - 'Property {{parameter}} cannot be declared in the constructor.', - }, - schema: [ - { - type: 'object', - properties: { - allows: { - type: 'array', - items: { - enum: [ - 'readonly', - 'private', - 'protected', - 'public', - 'private readonly', - 'protected readonly', - 'public readonly', - ], - }, - minItems: 1, - }, - }, - additionalProperties: false, - }, - ], - }, - defaultOptions: [ - { - allows: [], - }, - ], - create(context, [{ allows }]) { - /** - * Gets the modifiers of `node`. - * @param node the node to be inspected. - */ - function getModifiers(node: TSESTree.TSParameterProperty): Modifier { - const modifiers: Modifier[] = []; - - if (node.accessibility) { - modifiers.push(node.accessibility); - } - if (node.readonly) { - modifiers.push('readonly'); - } - - return modifiers.filter(Boolean).join(' ') as Modifier; - } - - return { - TSParameterProperty(node): void { - const modifiers = getModifiers(node); - - if (!allows.includes(modifiers)) { - // HAS to be an identifier or assignment or TSC will throw - if ( - node.parameter.type !== AST_NODE_TYPES.Identifier && - node.parameter.type !== AST_NODE_TYPES.AssignmentPattern - ) { - return; - } - - const name = - node.parameter.type === AST_NODE_TYPES.Identifier - ? node.parameter.name - : // has to be an Identifier or TSC will throw an error - (node.parameter.left as TSESTree.Identifier).name; - - context.report({ - node, - messageId: 'noParamProp', - data: { - parameter: name, - }, - }); - } - }, - }; - }, -}); diff --git a/packages/eslint-plugin/src/rules/no-redeclare.ts b/packages/eslint-plugin/src/rules/no-redeclare.ts index 2b10c97c8e7..1f47b575c81 100644 --- a/packages/eslint-plugin/src/rules/no-redeclare.ts +++ b/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -1,3 +1,4 @@ +import { ScopeType } from '@typescript-eslint/scope-manager'; import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; @@ -17,7 +18,6 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow variable redeclaration', - recommended: false, extendsBaseRule: true, }, schema: [ @@ -67,8 +67,8 @@ export default util.createRule({ function* iterateDeclarations(variable: TSESLint.Scope.Variable): Generator< { - type: 'builtin' | 'syntax' | 'comment'; - node?: TSESTree.Identifier | TSESTree.Comment; + type: 'builtin' | 'comment' | 'syntax'; + node?: TSESTree.Comment | TSESTree.Identifier; loc?: TSESTree.SourceLocation; }, void, @@ -103,7 +103,7 @@ export default util.createRule({ const identifiers = variable.identifiers .map(id => ({ identifier: id, - parent: id.parent!, + parent: id.parent, })) // ignore function declarations because TS will treat them as an overload .filter( @@ -256,7 +256,7 @@ export default util.createRule({ // Node.js or ES modules has a special scope. if ( - scope.type === 'global' && + scope.type === ScopeType.global && scope.childScopes[0] && // The special scope's block is the Program node. scope.block === scope.childScopes[0].block diff --git a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts index bc8fc8a4a3f..e70637256bf 100644 --- a/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-redundant-type-constituents.ts @@ -1,5 +1,5 @@ import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -51,7 +51,7 @@ const keywordNodeTypesToTsTypes = new Map([ [TSESTree.AST_NODE_TYPES.TSStringKeyword, ts.TypeFlags.String], ]); -type PrimitiveTypeFlag = typeof primitiveTypeFlags[number]; +type PrimitiveTypeFlag = (typeof primitiveTypeFlags)[number]; interface TypeFlagsWithName { typeFlags: ts.TypeFlags; @@ -87,6 +87,7 @@ function describeLiteralType(type: ts.Type): string { } if (type.isLiteral()) { + // eslint-disable-next-line @typescript-eslint/no-base-to-string return type.value.toString(); } @@ -106,11 +107,15 @@ function describeLiteralType(type: ts.Type): string { return 'template literal type'; } - if (tsutils.isBooleanLiteralType(type, true)) { + if (util.isTypeBigIntLiteralType(type)) { + return `${type.value.negative ? '-' : ''}${type.value.base10Value}n`; + } + + if (tsutils.isTrueLiteralType(type)) { return 'true'; } - if (tsutils.isBooleanLiteralType(type, false)) { + if (tsutils.isFalseLiteralType(type)) { return 'false'; } @@ -155,7 +160,6 @@ function describeLiteralTypeNode(typeNode: TSESTree.TypeNode): string { function isNodeInsideReturnType(node: TSESTree.TSUnionType): boolean { return !!( node.parent?.type === AST_NODE_TYPES.TSTypeAnnotation && - node.parent.parent && (util.isFunctionType(node.parent.parent) || util.isFunction(node.parent.parent)) ); @@ -167,8 +171,8 @@ function isNodeInsideReturnType(node: TSESTree.TSUnionType): boolean { function unionTypePartsUnlessBoolean(type: ts.Type): ts.Type[] { return type.isUnion() && type.types.length === 2 && - tsutils.isBooleanLiteralType(type.types[0], false) && - tsutils.isBooleanLiteralType(type.types[1], true) + tsutils.isFalseLiteralType(type.types[0]) && + tsutils.isTrueLiteralType(type.types[1]) ? [type] : tsutils.unionTypeParts(type); } @@ -179,7 +183,7 @@ export default util.createRule({ docs: { description: 'Disallow members of unions and intersections that do nothing or override type information', - recommended: false, + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -193,7 +197,7 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); + const services = util.getParserServices(context); const typesCache = new Map(); function getTypeNodeTypePartFlags( @@ -229,9 +233,7 @@ export default util.createRule({ return typeNode.types.flatMap(getTypeNodeTypePartFlags); } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(typeNode); - const checker = parserServices.program.getTypeChecker(); - const nodeType = checker.getTypeAtLocation(tsNode); + const nodeType = services.getTypeAtLocation(typeNode); const typeParts = unionTypePartsUnlessBoolean(nodeType); return typeParts.map(typePart => ({ diff --git a/packages/eslint-plugin/src/rules/no-require-imports.ts b/packages/eslint-plugin/src/rules/no-require-imports.ts index 9abe1250406..2f9310b38fc 100644 --- a/packages/eslint-plugin/src/rules/no-require-imports.ts +++ b/packages/eslint-plugin/src/rules/no-require-imports.ts @@ -9,7 +9,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow invocation of `require()`', - recommended: false, }, schema: [], messages: { diff --git a/packages/eslint-plugin/src/rules/no-restricted-imports.ts b/packages/eslint-plugin/src/rules/no-restricted-imports.ts index c2c2b54aa72..28f001fcaaf 100644 --- a/packages/eslint-plugin/src/rules/no-restricted-imports.ts +++ b/packages/eslint-plugin/src/rules/no-restricted-imports.ts @@ -1,4 +1,9 @@ import type { TSESTree } from '@typescript-eslint/utils'; +import type { + JSONSchema4AnyOfSchema, + JSONSchema4ArraySchema, + JSONSchema4ObjectSchema, +} from '@typescript-eslint/utils/json-schema'; import type { ArrayOfStringOrObject, ArrayOfStringOrObjectPatterns, @@ -10,7 +15,7 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../util'; -import { createRule, deepMerge } from '../util'; +import { createRule } from '../util'; import { getESLintCoreRule } from '../util/getESLintCoreRule'; const baseRule = getESLintCoreRule('no-restricted-imports'); @@ -18,48 +23,149 @@ const baseRule = getESLintCoreRule('no-restricted-imports'); export type Options = InferOptionsTypeFromRule; export type MessageIds = InferMessageIdsTypeFromRule; -const allowTypeImportsOptionSchema = { +// In some versions of eslint, the base rule has a completely incompatible schema +// This helper function is to safely try to get parts of the schema. If it's not +// possible, we'll fallback to less strict checks. +const tryAccess = (getter: () => T, fallback: T): T => { + try { + return getter(); + } catch { + return fallback; + } +}; + +const baseSchema = baseRule.meta.schema as { + anyOf: [ + unknown, + { + type: 'array'; + items: [ + { + type: 'object'; + properties: { + paths: { + type: 'array'; + items: { + anyOf: [ + { type: 'string' }, + { + type: 'object'; + properties: JSONSchema4ObjectSchema['properties']; + required: string[]; + }, + ]; + }; + }; + patterns: { + anyOf: [ + { type: 'array'; items: { type: 'string' } }, + { + type: 'array'; + items: { + type: 'object'; + properties: JSONSchema4ObjectSchema['properties']; + required: string[]; + }; + }, + ]; + }; + }; + }, + ]; + }, + ]; +}; + +const allowTypeImportsOptionSchema: JSONSchema4ObjectSchema['properties'] = { allowTypeImports: { type: 'boolean', - default: false, + description: 'Disallow value imports, but allow type-only imports.', }, }; -const schemaForMergeArrayOfStringsOrObjects = { + +const arrayOfStringsOrObjects: JSONSchema4ArraySchema = { + type: 'array', items: { anyOf: [ - {}, + { type: 'string' }, { - properties: allowTypeImportsOptionSchema, + type: 'object', + additionalProperties: false, + properties: { + ...tryAccess( + () => + baseSchema.anyOf[1].items[0].properties.paths.items.anyOf[1] + .properties, + undefined, + ), + ...allowTypeImportsOptionSchema, + }, + required: tryAccess( + () => + baseSchema.anyOf[1].items[0].properties.paths.items.anyOf[1] + .required, + undefined, + ), }, ], }, + uniqueItems: true, }; -const schemaForMergeArrayOfStringsOrObjectPatterns = { + +const arrayOfStringsOrObjectPatterns: JSONSchema4AnyOfSchema = { anyOf: [ - {}, { + type: 'array', + items: { + type: 'string', + }, + uniqueItems: true, + }, + { + type: 'array', items: { - properties: allowTypeImportsOptionSchema, + type: 'object', + additionalProperties: false, + properties: { + ...tryAccess( + () => + baseSchema.anyOf[1].items[0].properties.patterns.anyOf[1].items + .properties, + undefined, + ), + ...allowTypeImportsOptionSchema, + }, + required: tryAccess( + () => + baseSchema.anyOf[1].items[0].properties.patterns.anyOf[1].items + .required, + [], + ), }, + uniqueItems: true, }, ], }; -const schema = deepMerge( - { ...baseRule.meta.schema }, - { - anyOf: [ - schemaForMergeArrayOfStringsOrObjects, - { - items: { + +const schema: JSONSchema4AnyOfSchema = { + anyOf: [ + arrayOfStringsOrObjects, + { + type: 'array', + items: [ + { + type: 'object', properties: { - paths: schemaForMergeArrayOfStringsOrObjects, - patterns: schemaForMergeArrayOfStringsOrObjectPatterns, + paths: arrayOfStringsOrObjects, + patterns: arrayOfStringsOrObjectPatterns, }, + additionalProperties: false, }, - }, - ], - }, -); + ], + additionalItems: false, + }, + ], +}; function isObjectOfPaths( obj: unknown, @@ -110,7 +216,6 @@ export default createRule({ type: 'suggestion', docs: { description: 'Disallow specified modules when loaded by `import`', - recommended: false, extendsBaseRule: true, }, messages: baseRule.meta.messages, @@ -127,7 +232,7 @@ export default createRule({ } const restrictedPaths = getRestrictedPaths(options); - const allowedTypeImportPathNameSet: Set = new Set(); + const allowedTypeImportPathNameSet = new Set(); for (const restrictedPath of restrictedPaths) { if ( typeof restrictedPath === 'object' && diff --git a/packages/eslint-plugin/src/rules/no-shadow.ts b/packages/eslint-plugin/src/rules/no-shadow.ts index e9b73370966..ed202e9ea75 100644 --- a/packages/eslint-plugin/src/rules/no-shadow.ts +++ b/packages/eslint-plugin/src/rules/no-shadow.ts @@ -33,7 +33,6 @@ export default util.createRule({ docs: { description: 'Disallow variable declarations from shadowing variables declared in the outer scope', - recommended: false, extendsBaseRule: true, }, schema: [ @@ -44,6 +43,7 @@ export default util.createRule({ type: 'boolean', }, hoist: { + type: 'string', enum: ['all', 'functions', 'never'], }, allow: { @@ -365,7 +365,7 @@ export default util.createRule({ ): TSESLint.Scope.Scope | null { const upper = scope.upper; - if (upper?.type === 'function-expression-name') { + if (upper?.type === ScopeType.functionExpressionName) { return upper.upper; } return upper; @@ -529,7 +529,7 @@ export default util.createRule({ */ function getDeclaredLocation( variable: TSESLint.Scope.Variable, - ): { global: true } | { global: false; line: number; column: number } { + ): { global: false; line: number; column: number } | { global: true } { const identifier = variable.identifiers[0]; if (identifier) { return { diff --git a/packages/eslint-plugin/src/rules/no-this-alias.ts b/packages/eslint-plugin/src/rules/no-this-alias.ts index 2301bf11a99..57a326e2e80 100644 --- a/packages/eslint-plugin/src/rules/no-this-alias.ts +++ b/packages/eslint-plugin/src/rules/no-this-alias.ts @@ -17,7 +17,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow aliasing `this`', - recommended: 'error', + recommended: 'recommended', }, schema: [ { @@ -55,7 +55,7 @@ export default util.createRule({ create(context, [{ allowDestructuring, allowedNames }]) { return { "VariableDeclarator[init.type='ThisExpression'], AssignmentExpression[right.type='ThisExpression']"( - node: TSESTree.VariableDeclarator | TSESTree.AssignmentExpression, + node: TSESTree.AssignmentExpression | TSESTree.VariableDeclarator, ): void { const id = node.type === AST_NODE_TYPES.VariableDeclarator ? node.id : node.left; diff --git a/packages/eslint-plugin/src/rules/no-throw-literal.ts b/packages/eslint-plugin/src/rules/no-throw-literal.ts index 9f79ea0ff47..55145507d65 100644 --- a/packages/eslint-plugin/src/rules/no-throw-literal.ts +++ b/packages/eslint-plugin/src/rules/no-throw-literal.ts @@ -49,9 +49,8 @@ export default util.createRule({ }, ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const program = parserServices.program; - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function isErrorLike(type: ts.Type): boolean { if (type.isIntersection()) { @@ -70,7 +69,7 @@ export default util.createRule({ const declarations = symbol.getDeclarations() ?? []; for (const declaration of declarations) { const sourceFile = declaration.getSourceFile(); - if (program.isSourceFileDefaultLibrary(sourceFile)) { + if (services.program.isSourceFileDefaultLibrary(sourceFile)) { return true; } } @@ -95,8 +94,7 @@ export default util.createRule({ return; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node); if (type.flags & ts.TypeFlags.Undefined) { context.report({ node, messageId: 'undef' }); diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index a3edcd8a024..cc568a6fa9d 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -5,17 +5,10 @@ import * as util from '../util'; type Values = | 'always' - | 'never' - | 'in-unions' | 'in-intersections' - | 'in-unions-and-intersections'; -const enumValues: Values[] = [ - 'always', - 'never', - 'in-unions', - 'in-intersections', - 'in-unions-and-intersections', -]; + | 'in-unions-and-intersections' + | 'in-unions' + | 'never'; type Options = [ { @@ -29,11 +22,11 @@ type Options = [ allowGenerics?: 'always' | 'never'; }, ]; -type MessageIds = 'noTypeAlias' | 'noCompositionAlias'; +type MessageIds = 'noCompositionAlias' | 'noTypeAlias'; type CompositionType = - | AST_NODE_TYPES.TSUnionType - | AST_NODE_TYPES.TSIntersectionType; + | AST_NODE_TYPES.TSIntersectionType + | AST_NODE_TYPES.TSUnionType; interface TypeWithLabel { node: TSESTree.Node; compositionType: CompositionType | null; @@ -42,11 +35,11 @@ interface TypeWithLabel { export default util.createRule({ name: 'no-type-alias', meta: { + deprecated: true, type: 'suggestion', docs: { description: 'Disallow type aliases', // too opinionated to be recommended - recommended: false, }, messages: { noTypeAlias: 'Type {{alias}} are not allowed.', @@ -55,40 +48,56 @@ export default util.createRule({ }, schema: [ { + $defs: { + expandedOptions: { + type: 'string', + enum: [ + 'always', + 'never', + 'in-unions', + 'in-intersections', + 'in-unions-and-intersections', + ] satisfies Values[], + }, + simpleOptions: { + type: 'string', + enum: ['always', 'never'], + }, + }, type: 'object', properties: { allowAliases: { description: 'Whether to allow direct one-to-one type aliases.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowCallbacks: { description: 'Whether to allow type aliases for callbacks.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, allowConditionalTypes: { description: 'Whether to allow type aliases for conditional types.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, allowConstructors: { description: 'Whether to allow type aliases with constructors.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, allowLiterals: { description: 'Whether to allow type aliases with object literal types.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowMappedTypes: { description: 'Whether to allow type aliases with mapped types.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowTupleTypes: { description: 'Whether to allow type aliases with tuple types.', - enum: enumValues, + $ref: '#/items/0/$defs/expandedOptions', }, allowGenerics: { description: 'Whether to allow type aliases with generic types.', - enum: ['always', 'never'], + $ref: '#/items/0/$defs/simpleOptions', }, }, additionalProperties: false, @@ -220,7 +229,7 @@ export default util.createRule({ const isValidGeneric = (type: TypeWithLabel): boolean => { return ( type.node.type === AST_NODE_TYPES.TSTypeReference && - type.node.typeParameters !== undefined + type.node.typeArguments !== undefined ); }; diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts b/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts index ae6c56e82be..d0aba2defc7 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-boolean-literal-compare.ts @@ -1,16 +1,16 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; type MessageIds = - | 'direct' - | 'negated' + | 'comparingNullableToFalse' | 'comparingNullableToTrueDirect' | 'comparingNullableToTrueNegated' - | 'comparingNullableToFalse'; + | 'direct' + | 'negated'; type Options = [ { @@ -78,8 +78,7 @@ export default util.createRule({ }, ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); const sourceCode = context.getSourceCode(); function getBooleanComparison( @@ -90,9 +89,7 @@ export default util.createRule({ return undefined; } - const expressionType = checker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(comparison.expression), - ); + const expressionType = services.getTypeAtLocation(comparison.expression); if (isBooleanType(expressionType)) { return { @@ -231,7 +228,7 @@ export default util.createRule({ const shouldNegate = comparison.negated !== comparison.literalBooleanInComparison; - const mutatedNode = isUnaryNegation ? node.parent! : node; + const mutatedNode = isUnaryNegation ? node.parent : node; yield fixer.replaceText( mutatedNode, diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts index 6af9bc0e9e0..007a8a07a6d 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts @@ -1,13 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import { - getCallSignaturesOfType, - isBooleanLiteralType, - isFalsyType, - isLiteralType, - isStrictCompilerOptionEnabled, - unionTypeParts, -} from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import { @@ -28,17 +21,20 @@ import { // Truthiness utilities // #region const isTruthyLiteral = (type: ts.Type): boolean => - isBooleanLiteralType(type, true) || (isLiteralType(type) && !!type.value); + tsutils.isTrueLiteralType(type) || + // || type. + (type.isLiteral() && !!type.value); const isPossiblyFalsy = (type: ts.Type): boolean => - unionTypeParts(type) + tsutils + .unionTypeParts(type) // PossiblyFalsy flag includes literal values, so exclude ones that // are definitely truthy .filter(t => !isTruthyLiteral(t)) .some(type => isTypeFlagSet(type, ts.TypeFlags.PossiblyFalsy)); const isPossiblyTruthy = (type: ts.Type): boolean => - unionTypeParts(type).some(type => !isFalsyType(type)); + tsutils.unionTypeParts(type).some(type => !tsutils.isFalsyType(type)); // Nullish utilities const nullishFlag = ts.TypeFlags.Undefined | ts.TypeFlags.Null; @@ -46,19 +42,18 @@ const isNullishType = (type: ts.Type): boolean => isTypeFlagSet(type, nullishFlag); const isPossiblyNullish = (type: ts.Type): boolean => - unionTypeParts(type).some(isNullishType); + tsutils.unionTypeParts(type).some(isNullishType); const isAlwaysNullish = (type: ts.Type): boolean => - unionTypeParts(type).every(isNullishType); + tsutils.unionTypeParts(type).every(isNullishType); // isLiteralType only covers numbers and strings, this is a more exhaustive check. const isLiteral = (type: ts.Type): boolean => - isBooleanLiteralType(type, true) || - isBooleanLiteralType(type, false) || + tsutils.isBooleanLiteralType(type) || type.flags === ts.TypeFlags.Undefined || type.flags === ts.TypeFlags.Null || type.flags === ts.TypeFlags.Void || - isLiteralType(type); + type.isLiteral(); // #endregion export type Options = [ @@ -69,16 +64,16 @@ export type Options = [ ]; export type MessageId = - | 'alwaysTruthy' | 'alwaysFalsy' - | 'alwaysTruthyFunc' | 'alwaysFalsyFunc' - | 'neverNullish' | 'alwaysNullish' + | 'alwaysTruthy' + | 'alwaysTruthyFunc' | 'literalBooleanExpression' - | 'noOverlapBooleanExpression' | 'never' + | 'neverNullish' | 'neverOptionalChain' + | 'noOverlapBooleanExpression' | 'noStrictNullCheck'; export default createRule({ @@ -146,11 +141,11 @@ export default createRule({ }, ], ) { - const service = getParserServices(context); - const checker = service.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); - const compilerOptions = service.program.getCompilerOptions(); - const isStrictNullChecks = isStrictCompilerOptionEnabled( + const compilerOptions = services.program.getCompilerOptions(); + const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'strictNullChecks', ); @@ -168,17 +163,12 @@ export default createRule({ }); } - function getNodeType(node: TSESTree.Node): ts.Type { - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - return getConstrainedTypeAtLocation(checker, tsNode); - } - function nodeIsArrayType(node: TSESTree.Expression): boolean { - const nodeType = getNodeType(node); + const nodeType = getConstrainedTypeAtLocation(services, node); return checker.isArrayType(nodeType); } function nodeIsTupleType(node: TSESTree.Expression): boolean { - const nodeType = getNodeType(node); + const nodeType = getConstrainedTypeAtLocation(services, node); return checker.isTupleType(nodeType); } @@ -232,17 +222,19 @@ export default createRule({ return checkNode(node.right); } - const type = getNodeType(node); + const type = getConstrainedTypeAtLocation(services, node); // Conditional is always necessary if it involves: // `any` or `unknown` or a naked type variable if ( - unionTypeParts(type).some( - part => - isTypeAnyType(part) || - isTypeUnknownType(part) || - isTypeFlagSet(part, ts.TypeFlags.TypeVariable), - ) + tsutils + .unionTypeParts(type) + .some( + part => + isTypeAnyType(part) || + isTypeUnknownType(part) || + isTypeFlagSet(part, ts.TypeFlags.TypeVariable), + ) ) { return; } @@ -262,9 +254,15 @@ export default createRule({ } function checkNodeForNullish(node: TSESTree.Expression): void { - const type = getNodeType(node); - // Conditional is always necessary if it involves `any` or `unknown` - if (isTypeAnyType(type) || isTypeUnknownType(type)) { + const type = getConstrainedTypeAtLocation(services, node); + + // Conditional is always necessary if it involves `any`, `unknown` or a naked type parameter + if ( + isTypeFlagSet( + type, + ts.TypeFlags.Any | ts.TypeFlags.Unknown | ts.TypeFlags.TypeParameter, + ) + ) { return; } @@ -320,8 +318,8 @@ export default createRule({ if (!BOOL_OPERATORS.has(node.operator)) { return; } - const leftType = getNodeType(node.left); - const rightType = getNodeType(node.right); + const leftType = getConstrainedTypeAtLocation(services, node.left); + const rightType = getConstrainedTypeAtLocation(services, node.right); if (isLiteral(leftType) && isLiteral(rightType)) { context.report({ node, messageId: 'literalBooleanExpression' }); return; @@ -397,7 +395,9 @@ export default createRule({ */ if ( allowConstantLoopConditions && - isBooleanLiteralType(getNodeType(node.test), true) + tsutils.isTrueLiteralType( + getConstrainedTypeAtLocation(services, node.test), + ) ) { return; } @@ -451,9 +451,11 @@ export default createRule({ // (Value to complexity ratio is dubious however) } // Otherwise just do type analysis on the function as a whole. - const returnTypes = getCallSignaturesOfType(getNodeType(callback)).map( - sig => sig.getReturnType(), - ); + const returnTypes = tsutils + .getCallSignaturesOfType( + getConstrainedTypeAtLocation(services, callback), + ) + .map(sig => sig.getReturnType()); /* istanbul ignore if */ if (returnTypes.length === 0) { // Not a callable function return; @@ -486,7 +488,7 @@ export default createRule({ // ?.y // This access is considered "unnecessary" according to the types // ``` function optionChainContainsOptionArrayIndex( - node: TSESTree.MemberExpression | TSESTree.CallExpression, + node: TSESTree.CallExpression | TSESTree.MemberExpression, ): boolean { const lhsNode = node.type === AST_NODE_TYPES.CallExpression ? node.callee : node.object; @@ -541,12 +543,15 @@ export default createRule({ function isNullableOriginFromPrev( node: TSESTree.MemberExpression, ): boolean { - const prevType = getNodeType(node.object); + const prevType = getConstrainedTypeAtLocation(services, node.object); const property = node.property; if (prevType.isUnion() && isIdentifier(property)) { const isOwnNullable = prevType.types.some(type => { if (node.computed) { - const propertyType = getNodeType(node.property); + const propertyType = getConstrainedTypeAtLocation( + services, + node.property, + ); return isNullablePropertyType(type, propertyType); } const propType = getTypeOfPropertyOfName( @@ -569,7 +574,7 @@ export default createRule({ } function isOptionableExpression(node: TSESTree.Expression): boolean { - const type = getNodeType(node); + const type = getConstrainedTypeAtLocation(services, node); const isOwnNullable = node.type === AST_NODE_TYPES.MemberExpression ? !isNullableOriginFromPrev(node) @@ -583,9 +588,9 @@ export default createRule({ } function checkOptionalChain( - node: TSESTree.MemberExpression | TSESTree.CallExpression, + node: TSESTree.CallExpression | TSESTree.MemberExpression, beforeOperator: TSESTree.Node, - fix: '' | '.', + fix: '.' | '', ): void { // We only care if this step in the chain is optional. If just descend // from an optional chain, then that's fine. diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 3d0541ac453..c1c558dab8a 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -10,7 +10,6 @@ export default util.createRule({ meta: { docs: { description: 'Disallow unnecessary namespace qualifiers', - recommended: false, requiresTypeChecking: true, }, fixable: 'code', @@ -25,10 +24,9 @@ export default util.createRule({ create(context) { const namespacesInScope: ts.Node[] = []; let currentFailedNamespaceExpression: TSESTree.Node | null = null; - const parserServices = util.getParserServices(context); - const esTreeNodeToTSNodeMap = parserServices.esTreeNodeToTSNodeMap; - const program = parserServices.program; - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); function tryGetAliasedSymbol( @@ -61,7 +59,6 @@ export default util.createRule({ flags: ts.SymbolFlags, name: string, ): ts.Symbol | undefined { - // TODO:PERF `getSymbolsInScope` gets a long list. Is there a better way? const scope = checker.getSymbolsInScope(node, flags); return scope.find(scopeSymbol => scopeSymbol.name === name); @@ -75,10 +72,7 @@ export default util.createRule({ qualifier: TSESTree.EntityName | TSESTree.MemberExpression, name: TSESTree.Identifier, ): boolean { - const tsQualifier = esTreeNodeToTSNodeMap.get(qualifier); - const tsName = esTreeNodeToTSNodeMap.get(name); - - const namespaceSymbol = checker.getSymbolAtLocation(tsQualifier); + const namespaceSymbol = services.getSymbolAtLocation(qualifier); if ( namespaceSymbol === undefined || @@ -87,13 +81,14 @@ export default util.createRule({ return false; } - const accessedSymbol = checker.getSymbolAtLocation(tsName); + const accessedSymbol = services.getSymbolAtLocation(name); if (accessedSymbol === undefined) { return false; } // If the symbol in scope is different, the qualifier is necessary. + const tsQualifier = esTreeNodeToTSNodeMap.get(qualifier); const fromScope = getSymbolInScope( tsQualifier, accessedSymbol.flags, @@ -131,9 +126,9 @@ export default util.createRule({ function enterDeclaration( node: - | TSESTree.TSModuleDeclaration + | TSESTree.ExportNamedDeclaration | TSESTree.TSEnumDeclaration - | TSESTree.ExportNamedDeclaration, + | TSESTree.TSModuleDeclaration, ): void { namespacesInScope.push(esTreeNodeToTSNodeMap.get(node)); } diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index 6d300b36fe1..cb3b881e8fe 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -1,20 +1,20 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; import { findFirstResult } from '../util'; type ParameterCapableTSNode = - | ts.TaggedTemplateExpression - | ts.ImportTypeNode | ts.CallExpression - | ts.NewExpression - | ts.TypeReferenceNode | ts.ExpressionWithTypeArguments + | ts.ImportTypeNode | ts.JsxOpeningElement | ts.JsxSelfClosingElement - | ts.TypeQueryNode; + | ts.NewExpression + | ts.TaggedTemplateExpression + | ts.TypeQueryNode + | ts.TypeReferenceNode; type MessageIds = 'unnecessaryTypeParameter'; @@ -36,8 +36,8 @@ export default util.createRule<[], MessageIds>({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function getTypeForComparison(type: ts.Type): { type: ts.Type; @@ -69,8 +69,7 @@ export default util.createRule<[], MessageIds>({ // TODO: would like checker.areTypesEquivalent. https://github.com/Microsoft/TypeScript/issues/13502 const defaultType = checker.getTypeAtLocation(param.default); - const argTsNode = parserServices.esTreeNodeToTSNodeMap.get(arg); - const argType = checker.getTypeAtLocation(argTsNode); + const argType = services.getTypeAtLocation(arg); // this check should handle some of the most simple cases of like strings, numbers, etc if (defaultType !== argType) { // For more complex types (like aliases to generic object types) - TS won't always create a @@ -106,7 +105,7 @@ export default util.createRule<[], MessageIds>({ return { TSTypeParameterInstantiation(node): void { - const expression = parserServices.esTreeNodeToTSNodeMap.get(node); + const expression = services.esTreeNodeToTSNodeMap.get(node); const typeParameters = getTypeParametersFromNode(expression, checker); if (typeParameters) { @@ -137,7 +136,7 @@ function getTypeParametersFromNode( } function getTypeParametersFromType( - type: ts.EntityName | ts.Expression | ts.ClassDeclaration, + type: ts.ClassDeclaration | ts.EntityName | ts.Expression, checker: ts.TypeChecker, ): readonly ts.TypeParameterDeclaration[] | undefined { const symAtLocation = checker.getSymbolAtLocation(type); diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts index 38248f31123..d466b59fe07 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-assertion.ts @@ -1,12 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import { - isObjectFlagSet, - isObjectType, - isStrictCompilerOptionEnabled, - isTypeFlagSet, - isVariableDeclaration, -} from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -24,7 +18,7 @@ export default util.createRule({ docs: { description: 'Disallow type assertions that do not change the type of an expression', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, fixable: 'code', @@ -37,6 +31,7 @@ export default util.createRule({ schema: [ { type: 'object', + additionalProperties: false, properties: { typesToIgnore: { description: 'A list of type names to ignore.', @@ -53,9 +48,9 @@ export default util.createRule({ defaultOptions: [{}], create(context, [options]) { const sourceCode = context.getSourceCode(); - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const compilerOptions = parserServices.program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); /** * Sometimes tuple types don't have ObjectFlags.Tuple set, like when they're being matched against an inferred type. @@ -91,8 +86,8 @@ export default util.createRule({ /** * Returns true if there's a chance the variable has been used before a value has been assigned to it */ - function isPossiblyUsedBeforeAssigned(node: ts.Expression): boolean { - const declaration = util.getDeclaration(checker, node); + function isPossiblyUsedBeforeAssigned(node: TSESTree.Expression): boolean { + const declaration = util.getDeclaration(services, node); if (!declaration) { // don't know what the declaration is for some reason, so just assume the worst return true; @@ -100,10 +95,13 @@ export default util.createRule({ if ( // non-strict mode doesn't care about used before assigned errors - isStrictCompilerOptionEnabled(compilerOptions, 'strictNullChecks') && + tsutils.isStrictCompilerOptionEnabled( + compilerOptions, + 'strictNullChecks', + ) && // ignore class properties as they are compile time guarded // also ignore function arguments as they can't be used before defined - isVariableDeclaration(declaration) && + ts.isVariableDeclaration(declaration) && // is it `const x!: number` declaration.initializer === undefined && declaration.exclamationToken === undefined && @@ -111,7 +109,7 @@ export default util.createRule({ ) { // check if the defined variable type has changed since assignment const declarationType = checker.getTypeFromTypeNode(declaration.type); - const type = util.getConstrainedTypeAtLocation(checker, node); + const type = util.getConstrainedTypeAtLocation(services, node); if (declarationType === type) { // possibly used before assigned, so just skip it // better to false negative and skip it, than false positive and fix to compile erroring code @@ -157,15 +155,15 @@ export default util.createRule({ return; } - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const originalNode = services.esTreeNodeToTSNodeMap.get(node); const type = util.getConstrainedTypeAtLocation( - checker, - originalNode.expression, + services, + node.expression, ); if (!util.isNullableType(type)) { - if (isPossiblyUsedBeforeAssigned(originalNode.expression)) { + if (isPossiblyUsedBeforeAssigned(node.expression)) { return; } @@ -230,7 +228,7 @@ export default util.createRule({ } }, 'TSAsExpression, TSTypeAssertion'( - node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, + node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, ): void { if ( options.typesToIgnore?.includes( @@ -241,13 +239,12 @@ export default util.createRule({ return; } - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const castType = checker.getTypeAtLocation(originalNode); + const castType = services.getTypeAtLocation(node); if ( - isTypeFlagSet(castType, ts.TypeFlags.Literal) || - (isObjectType(castType) && - (isObjectFlagSet(castType, ts.ObjectFlags.Tuple) || + tsutils.isTypeFlagSet(castType, ts.TypeFlags.Literal) || + (tsutils.isObjectType(castType) && + (tsutils.isObjectFlagSet(castType, ts.ObjectFlags.Tuple) || couldBeTupleType(castType))) ) { // It's not always safe to remove a cast to a literal type or tuple @@ -255,14 +252,14 @@ export default util.createRule({ return; } - const uncastType = checker.getTypeAtLocation(originalNode.expression); + const uncastType = services.getTypeAtLocation(node.expression); if (uncastType === castType) { context.report({ node, messageId: 'unnecessaryAssertion', fix(fixer) { - if (originalNode.kind === ts.SyntaxKind.TypeAssertionExpression) { + if (node.type === AST_NODE_TYPES.TSTypeAssertion) { const closingAngleBracket = sourceCode.getTokenAfter( node.typeAnnotation, ); diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts index a337200a9a7..969dfbe8db2 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts @@ -1,38 +1,22 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as semver from 'semver'; -import * as ts from 'typescript'; import * as util from '../util'; -type MakeRequired = Omit & - Required>; - +type MakeRequired = Omit & { + [K in Key]-?: NonNullable; +}; type TypeParameterWithConstraint = MakeRequired< TSESTree.TSTypeParameter, 'constraint' >; -const is3dot5 = semver.satisfies( - ts.version, - `>= 3.5.0 || >= 3.5.1-rc || >= 3.5.0-beta`, - { - includePrerelease: true, - }, -); - -const is3dot9 = - is3dot5 && - semver.satisfies(ts.version, `>= 3.9.0 || >= 3.9.1-rc || >= 3.9.0-beta`, { - includePrerelease: true, - }); - export default util.createRule({ name: 'no-unnecessary-type-constraint', meta: { docs: { description: 'Disallow unnecessary constraints on generic types', - recommended: 'error', + recommended: 'recommended', }, hasSuggestions: true, messages: { @@ -46,19 +30,13 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - if (!is3dot5) { - return {}; - } - // In theory, we could use the type checker for more advanced constraint types... // ...but in practice, these types are rare, and likely not worth requiring type info. // https://github.com/typescript-eslint/typescript-eslint/pull/2516#discussion_r495731858 - const unnecessaryConstraints = is3dot9 - ? new Map([ - [AST_NODE_TYPES.TSAnyKeyword, 'any'], - [AST_NODE_TYPES.TSUnknownKeyword, 'unknown'], - ]) - : new Map([[AST_NODE_TYPES.TSUnknownKeyword, 'unknown']]); + const unnecessaryConstraints = new Map([ + [AST_NODE_TYPES.TSAnyKeyword, 'any'], + [AST_NODE_TYPES.TSUnknownKeyword, 'unknown'], + ]); const inJsx = context.getFilename().toLowerCase().endsWith('tsx'); const source = context.getSourceCode(); diff --git a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts index b5aced4d68c..dab8c33be89 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-argument.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-argument.ts @@ -6,9 +6,9 @@ import * as util from '../util'; type MessageIds = | 'unsafeArgument' - | 'unsafeTupleSpread' | 'unsafeArraySpread' - | 'unsafeSpread'; + | 'unsafeSpread' + | 'unsafeTupleSpread'; const enum RestTypeKind { Array, @@ -22,13 +22,13 @@ type RestType = index: number; } | { - typeArguments: readonly ts.Type[]; - kind: RestTypeKind.Tuple; + type: ts.Type; + kind: RestTypeKind.Other; index: number; } | { - type: ts.Type; - kind: RestTypeKind.Other; + typeArguments: readonly ts.Type[]; + kind: RestTypeKind.Tuple; index: number; }; @@ -57,13 +57,13 @@ class FunctionSignature { // is a rest param if (checker.isArrayType(type)) { restType = { - type: checker.getTypeArguments(type)[0], + type: util.getTypeArguments(type, checker)[0], kind: RestTypeKind.Array, index: i, }; } else if (checker.isTupleType(type)) { restType = { - typeArguments: checker.getTypeArguments(type), + typeArguments: util.getTypeArguments(type, checker), kind: RestTypeKind.Tuple, index: i, }; @@ -137,7 +137,7 @@ export default util.createRule<[], MessageIds>({ type: 'problem', docs: { description: 'Disallow calling a function with a value with type `any`', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -152,8 +152,8 @@ export default util.createRule<[], MessageIds>({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { 'CallExpression, NewExpression'( @@ -164,15 +164,11 @@ export default util.createRule<[], MessageIds>({ } // ignore any-typed calls as these are caught by no-unsafe-call - if ( - util.isTypeAnyType( - checker.getTypeAtLocation(esTreeNodeToTSNodeMap.get(node.callee)), - ) - ) { + if (util.isTypeAnyType(services.getTypeAtLocation(node.callee))) { return; } - const tsNode = esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); const signature = FunctionSignature.create(checker, tsNode); if (!signature) { return; @@ -182,8 +178,8 @@ export default util.createRule<[], MessageIds>({ switch (argument.type) { // spreads consume case AST_NODE_TYPES.SpreadElement: { - const spreadArgType = checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(argument.argument), + const spreadArgType = services.getTypeAtLocation( + argument.argument, ); if (util.isTypeAnyType(spreadArgType)) { @@ -202,8 +198,10 @@ export default util.createRule<[], MessageIds>({ }); } else if (checker.isTupleType(spreadArgType)) { // foo(...[tuple1, tuple2]) - const spreadTypeArguments = - checker.getTypeArguments(spreadArgType); + const spreadTypeArguments = util.getTypeArguments( + spreadArgType, + checker, + ); for (const tupleType of spreadTypeArguments) { const parameterType = signature.getNextParameterType(); if (parameterType == null) { @@ -247,9 +245,7 @@ export default util.createRule<[], MessageIds>({ continue; } - const argumentType = checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(argument), - ); + const argumentType = services.getTypeAtLocation(argument); const result = util.isUnsafeAssignment( argumentType, parameterType, diff --git a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts index 4833d84a84c..7e929071e19 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-assignment.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import type * as ts from 'typescript'; import * as util from '../util'; @@ -22,7 +22,7 @@ export default util.createRule({ docs: { description: 'Disallow assigning a value with type `any` to variables and properties', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -42,9 +42,9 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -59,8 +59,8 @@ export default util.createRule({ return false; } - const senderTsNode = esTreeNodeToTSNodeMap.get(senderNode); - const senderType = checker.getTypeAtLocation(senderTsNode); + const senderTsNode = services.esTreeNodeToTSNodeMap.get(senderNode); + const senderType = services.getTypeAtLocation(senderNode); return checkArrayDestructure(receiverNode, senderType, senderTsNode); } @@ -145,8 +145,8 @@ export default util.createRule({ return false; } - const senderTsNode = esTreeNodeToTSNodeMap.get(senderNode); - const senderType = checker.getTypeAtLocation(senderTsNode); + const senderTsNode = services.esTreeNodeToTSNodeMap.get(senderNode); + const senderType = services.getTypeAtLocation(senderNode); return checkObjectDestructure(receiverNode, senderType, senderTsNode); } @@ -232,15 +232,13 @@ export default util.createRule({ reportingNode: TSESTree.Node, comparisonType: ComparisonType, ): boolean { - const receiverTsNode = esTreeNodeToTSNodeMap.get(receiverNode); + const receiverTsNode = services.esTreeNodeToTSNodeMap.get(receiverNode); const receiverType = comparisonType === ComparisonType.Contextual ? util.getContextualType(checker, receiverTsNode as ts.Expression) ?? - checker.getTypeAtLocation(receiverTsNode) - : checker.getTypeAtLocation(receiverTsNode); - const senderType = checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(senderNode), - ); + services.getTypeAtLocation(receiverNode) + : services.getTypeAtLocation(receiverNode); + const senderType = services.getTypeAtLocation(senderNode); if (util.isTypeAnyType(senderType)) { // handle cases when we assign any ==> unknown. @@ -256,10 +254,7 @@ export default util.createRule({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'anyAssignmentThis'; @@ -372,8 +367,7 @@ export default util.createRule({ checkAssignment(node.key, node.value, node, ComparisonType.Contextual); }, 'ArrayExpression > SpreadElement'(node: TSESTree.SpreadElement): void { - const resetNode = esTreeNodeToTSNodeMap.get(node.argument); - const restType = checker.getTypeAtLocation(resetNode); + const restType = services.getTypeAtLocation(node.argument); if ( util.isTypeAnyType(restType) || util.isTypeAnyArrayType(restType, checker) diff --git a/packages/eslint-plugin/src/rules/no-unsafe-call.ts b/packages/eslint-plugin/src/rules/no-unsafe-call.ts index dfa6fa2fb4c..b47d3ee9d85 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-call.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-call.ts @@ -1,5 +1,5 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as util from '../util'; import { getThisExpression } from '../util'; @@ -16,7 +16,7 @@ export default util.createRule<[], MessageIds>({ type: 'problem', docs: { description: 'Disallow calling a value with type `any`', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -32,9 +32,8 @@ export default util.createRule<[], MessageIds>({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -45,8 +44,7 @@ export default util.createRule<[], MessageIds>({ reportingNode: TSESTree.Node, messageId: MessageIds, ): void { - const tsNode = esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(checker, tsNode); + const type = util.getConstrainedTypeAtLocation(services, node); if (util.isTypeAnyType(type)) { if (!isNoImplicitThis) { @@ -55,10 +53,7 @@ export default util.createRule<[], MessageIds>({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'unsafeCallThis'; diff --git a/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts b/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts index 89d68db6e67..3e034ba458a 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-declaration-merging.ts @@ -10,7 +10,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow unsafe declaration merging', - recommended: 'strict', + recommended: 'recommended', requiresTypeChecking: false, }, messages: { diff --git a/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts b/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts new file mode 100644 index 00000000000..0a068b577e7 --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-unsafe-enum-comparison.ts @@ -0,0 +1,121 @@ +import type { TSESTree } from '@typescript-eslint/utils'; +import * as tsutils from 'ts-api-utils'; +import * as ts from 'typescript'; + +import * as util from '../util'; +import { getEnumTypes } from './enum-utils/shared'; + +/** + * @returns Whether the right type is an unsafe comparison against any left type. + */ +function typeViolates(leftTypeParts: ts.Type[], right: ts.Type): boolean { + const leftValueKinds = new Set(leftTypeParts.map(getEnumValueType)); + + return ( + (leftValueKinds.has(ts.TypeFlags.Number) && + tsutils.isTypeFlagSet( + right, + ts.TypeFlags.Number | ts.TypeFlags.NumberLike, + )) || + (leftValueKinds.has(ts.TypeFlags.String) && + tsutils.isTypeFlagSet( + right, + ts.TypeFlags.String | ts.TypeFlags.StringLike, + )) + ); +} + +/** + * @returns What type a type's enum value is (number or string), if either. + */ +function getEnumValueType(type: ts.Type): ts.TypeFlags | undefined { + return util.isTypeFlagSet(type, ts.TypeFlags.EnumLike) + ? util.isTypeFlagSet(type, ts.TypeFlags.NumberLiteral) + ? ts.TypeFlags.Number + : ts.TypeFlags.String + : undefined; +} + +export default util.createRule({ + name: 'no-unsafe-enum-comparison', + meta: { + type: 'suggestion', + docs: { + description: 'Disallow comparing an enum value with a non-enum value', + recommended: 'recommended', + requiresTypeChecking: true, + }, + messages: { + mismatched: + 'The two values in this comparison do not have a shared enum type.', + }, + schema: [], + }, + defaultOptions: [], + create(context) { + const parserServices = util.getParserServices(context); + const typeChecker = parserServices.program.getTypeChecker(); + + function getTypeFromNode(node: TSESTree.Node): ts.Type { + return typeChecker.getTypeAtLocation( + parserServices.esTreeNodeToTSNodeMap.get(node), + ); + } + + return { + 'BinaryExpression[operator=/=|<|>/]'( + node: TSESTree.BinaryExpression, + ): void { + const left = getTypeFromNode(node.left); + const right = getTypeFromNode(node.right); + + // Allow comparisons that don't have anything to do with enums: + // + // ```ts + // 1 === 2; + // ``` + const leftEnumTypes = getEnumTypes(typeChecker, left); + const rightEnumTypes = new Set(getEnumTypes(typeChecker, right)); + if (leftEnumTypes.length === 0 && rightEnumTypes.size === 0) { + return; + } + + // Allow comparisons that share an enum type: + // + // ```ts + // Fruit.Apple === Fruit.Banana; + // ``` + for (const leftEnumType of leftEnumTypes) { + if (rightEnumTypes.has(leftEnumType)) { + return; + } + } + + const leftTypeParts = tsutils.unionTypeParts(left); + const rightTypeParts = tsutils.unionTypeParts(right); + + // If a type exists in both sides, we consider this comparison safe: + // + // ```ts + // declare const fruit: Fruit.Apple | 0; + // fruit === 0; + // ``` + for (const leftTypePart of leftTypeParts) { + if (rightTypeParts.includes(leftTypePart)) { + return; + } + } + + if ( + typeViolates(leftTypeParts, right) || + typeViolates(rightTypeParts, left) + ) { + context.report({ + messageId: 'mismatched', + node, + }); + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts index 410ff78f545..a5a8d3c6c4b 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as util from '../util'; import { getThisExpression } from '../util'; @@ -16,7 +16,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow member access on a value with type `any`', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -33,9 +33,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -60,8 +59,7 @@ export default util.createRule({ } } - const tsNode = esTreeNodeToTSNodeMap.get(node.object); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node.object); const state = util.isTypeAnyType(type) ? State.Unsafe : State.Safe; stateCache.set(node, state); @@ -78,10 +76,7 @@ export default util.createRule({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'unsafeThisMemberExpression'; @@ -119,8 +114,7 @@ export default util.createRule({ return; } - const tsNode = esTreeNodeToTSNodeMap.get(node); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node); if (util.isTypeAnyType(type)) { const propertyName = sourceCode.getText(node); diff --git a/packages/eslint-plugin/src/rules/no-unsafe-return.ts b/packages/eslint-plugin/src/rules/no-unsafe-return.ts index 63d60ff81f8..93a1226e9e4 100644 --- a/packages/eslint-plugin/src/rules/no-unsafe-return.ts +++ b/packages/eslint-plugin/src/rules/no-unsafe-return.ts @@ -1,6 +1,7 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; +import * as ts from 'typescript'; import * as util from '../util'; import { getThisExpression } from '../util'; @@ -11,7 +12,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow returning a value with type `any` from a function', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -27,9 +28,9 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const { program, esTreeNodeToTSNodeMap } = util.getParserServices(context); - const checker = program.getTypeChecker(); - const compilerOptions = program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); const isNoImplicitThis = tsutils.isStrictCompilerOptionEnabled( compilerOptions, 'noImplicitThis', @@ -64,7 +65,7 @@ export default util.createRule({ returnNode: TSESTree.Node, reportingNode: TSESTree.Node = returnNode, ): void { - const tsNode = esTreeNodeToTSNodeMap.get(returnNode); + const tsNode = services.esTreeNodeToTSNodeMap.get(returnNode); const anyType = util.isAnyOrAnyArrayTypeDiscriminated(tsNode, checker); const functionNode = getParentFunctionNode(returnNode); /* istanbul ignore if */ if (!functionNode) { @@ -73,20 +74,22 @@ export default util.createRule({ // function has an explicit return type, so ensure it's a safe return const returnNodeType = util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(returnNode), + services, + returnNode, ); - const functionTSNode = esTreeNodeToTSNodeMap.get(functionNode); + const functionTSNode = services.esTreeNodeToTSNodeMap.get(functionNode); // function expressions will not have their return type modified based on receiver typing // so we have to use the contextual typing in these cases, i.e. // const foo1: () => Set = () => new Set(); // the return type of the arrow function is Set even though the variable is typed as Set - let functionType = tsutils.isExpression(functionTSNode) - ? util.getContextualType(checker, functionTSNode) - : checker.getTypeAtLocation(functionTSNode); + let functionType = + ts.isFunctionExpression(functionTSNode) || + ts.isArrowFunction(functionTSNode) + ? util.getContextualType(checker, functionTSNode) + : services.getTypeAtLocation(functionNode); if (!functionType) { - functionType = checker.getTypeAtLocation(functionTSNode); + functionType = services.getTypeAtLocation(functionNode); } // If there is an explicit type annotation *and* that type matches the actual @@ -126,10 +129,7 @@ export default util.createRule({ if ( thisExpression && util.isTypeAnyType( - util.getConstrainedTypeAtLocation( - checker, - esTreeNodeToTSNodeMap.get(thisExpression), - ), + util.getConstrainedTypeAtLocation(services, thisExpression), ) ) { messageId = 'unsafeReturnThis'; diff --git a/packages/eslint-plugin/src/rules/no-unused-expressions.ts b/packages/eslint-plugin/src/rules/no-unused-expressions.ts index 96830736f9d..d5eb14c9350 100644 --- a/packages/eslint-plugin/src/rules/no-unused-expressions.ts +++ b/packages/eslint-plugin/src/rules/no-unused-expressions.ts @@ -15,16 +15,11 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow unused expressions', - recommended: false, extendsBaseRule: true, }, hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - // TODO: this rule has only had messages since v7.0 - remove this when we remove support for v6 - messages: baseRule.meta.messages ?? { - unusedExpression: - 'Expected an assignment or function call and instead saw an expression.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [ { diff --git a/packages/eslint-plugin/src/rules/no-unused-vars.ts b/packages/eslint-plugin/src/rules/no-unused-vars.ts index 77da885048d..7c174482dcd 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars.ts @@ -11,7 +11,7 @@ export type Options = [ | { vars?: 'all' | 'local'; varsIgnorePattern?: string; - args?: 'all' | 'after-used' | 'none'; + args?: 'after-used' | 'all' | 'none'; ignoreRestSiblings?: boolean; argsIgnorePattern?: string; caughtErrors?: 'all' | 'none'; @@ -23,7 +23,7 @@ export type Options = [ interface TranslatedOptions { vars: 'all' | 'local'; varsIgnorePattern?: RegExp; - args: 'all' | 'after-used' | 'none'; + args: 'after-used' | 'all' | 'none'; ignoreRestSiblings: boolean; argsIgnorePattern?: RegExp; caughtErrors: 'all' | 'none'; @@ -37,25 +37,28 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow unused variables', - recommended: 'warn', + recommended: 'recommended', extendsBaseRule: true, }, schema: [ { oneOf: [ { + type: 'string', enum: ['all', 'local'], }, { type: 'object', properties: { vars: { + type: 'string', enum: ['all', 'local'], }, varsIgnorePattern: { type: 'string', }, args: { + type: 'string', enum: ['all', 'after-used', 'none'], }, ignoreRestSiblings: { @@ -65,6 +68,7 @@ export default util.createRule({ type: 'string', }, caughtErrors: { + type: 'string', enum: ['all', 'none'], }, caughtErrorsIgnorePattern: { @@ -165,10 +169,10 @@ export default util.createRule({ ): boolean { if (options.ignoreRestSiblings) { const hasRestSiblingDefinition = variable.defs.some(def => - hasRestSibling(def.name.parent!), + hasRestSibling(def.name.parent), ); const hasRestSiblingReference = variable.references.some(ref => - hasRestSibling(ref.identifier.parent!), + hasRestSibling(ref.identifier.parent), ); return hasRestSiblingDefinition || hasRestSiblingReference; @@ -482,13 +486,13 @@ export default util.createRule({ } type DeclarationSelectorNode = - | TSESTree.TSInterfaceDeclaration - | TSESTree.TSTypeAliasDeclaration | TSESTree.ClassDeclaration | TSESTree.FunctionDeclaration | TSESTree.TSDeclareFunction | TSESTree.TSEnumDeclaration + | TSESTree.TSInterfaceDeclaration | TSESTree.TSModuleDeclaration + | TSESTree.TSTypeAliasDeclaration | TSESTree.VariableDeclaration; function ambientDeclarationSelector( parent: string, diff --git a/packages/eslint-plugin/src/rules/no-use-before-define.ts b/packages/eslint-plugin/src/rules/no-use-before-define.ts index b88cd82d39d..7d15cd25a19 100644 --- a/packages/eslint-plugin/src/rules/no-use-before-define.ts +++ b/packages/eslint-plugin/src/rules/no-use-before-define.ts @@ -10,7 +10,7 @@ const SENTINEL_TYPE = /** * Parses a given value as options. */ -function parseOptions(options: string | Config | null): Required { +function parseOptions(options: Config | string | null): Required { let functions = true; let classes = true; let enums = true; @@ -116,9 +116,6 @@ function referenceContainsTypeQuery(node: TSESTree.Node): boolean { case AST_NODE_TYPES.TSQualifiedName: case AST_NODE_TYPES.Identifier: - if (!node.parent) { - return false; - } return referenceContainsTypeQuery(node.parent); default: @@ -196,7 +193,7 @@ function isInInitializer( return false; } - let node = variable.identifiers[0].parent; + let node: TSESTree.Node | undefined = variable.identifiers[0].parent; const location = reference.identifier.range[1]; while (node) { @@ -236,7 +233,7 @@ interface Config { ignoreTypeReferences?: boolean; allowNamedExports?: boolean; } -type Options = ['nofunc' | Config]; +type Options = [Config | 'nofunc']; type MessageIds = 'noUseBeforeDefine'; export default util.createRule({ @@ -245,7 +242,6 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow the use of variables before they are defined', - recommended: false, extendsBaseRule: true, }, messages: { @@ -255,6 +251,7 @@ export default util.createRule({ { oneOf: [ { + type: 'string', enum: ['nofunc'], }, { diff --git a/packages/eslint-plugin/src/rules/no-useless-constructor.ts b/packages/eslint-plugin/src/rules/no-useless-constructor.ts index 98fcc9631c5..6409b8a48c3 100644 --- a/packages/eslint-plugin/src/rules/no-useless-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-useless-constructor.ts @@ -19,9 +19,7 @@ function checkAccessibility(node: TSESTree.MethodDefinition): boolean { return false; case 'public': if ( - node.parent && node.parent.type === AST_NODE_TYPES.ClassBody && - node.parent.parent && 'superClass' in node.parent.parent && node.parent.parent.superClass ) { @@ -39,7 +37,7 @@ function checkParams(node: TSESTree.MethodDefinition): boolean { return !node.value.params.some( param => param.type === AST_NODE_TYPES.TSParameterProperty || - param.decorators?.length, + param.decorators.length, ); } @@ -54,10 +52,7 @@ export default util.createRule({ }, hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - // TODO: this rule has only had messages since v7.0 - remove this when we remove support for v6 - messages: baseRule.meta.messages ?? { - noUselessConstructor: 'Useless constructor.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [], create(context) { @@ -65,8 +60,7 @@ export default util.createRule({ return { MethodDefinition(node): void { if ( - node.value && - node.value.type === AST_NODE_TYPES.FunctionExpression && + node.value?.type === AST_NODE_TYPES.FunctionExpression && node.value.body && checkAccessibility(node) && checkParams(node) diff --git a/packages/eslint-plugin/src/rules/no-useless-empty-export.ts b/packages/eslint-plugin/src/rules/no-useless-empty-export.ts index e671fbf5b1d..7c2b8ca3ea2 100644 --- a/packages/eslint-plugin/src/rules/no-useless-empty-export.ts +++ b/packages/eslint-plugin/src/rules/no-useless-empty-export.ts @@ -29,7 +29,6 @@ export default util.createRule({ docs: { description: "Disallow empty exports that don't change anything in a module file", - recommended: false, }, fixable: 'code', hasSuggestions: false, diff --git a/packages/eslint-plugin/src/rules/no-var-requires.ts b/packages/eslint-plugin/src/rules/no-var-requires.ts index dedc42cf30f..b8655d049d3 100644 --- a/packages/eslint-plugin/src/rules/no-var-requires.ts +++ b/packages/eslint-plugin/src/rules/no-var-requires.ts @@ -12,7 +12,7 @@ export default util.createRule({ type: 'problem', docs: { description: 'Disallow `require` statements except in import statements', - recommended: 'error', + recommended: 'recommended', }, messages: { noVarReqs: 'Require statement not part of import statement.', diff --git a/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts b/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts index 4953cf8041e..2cfdd7ea1f8 100644 --- a/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts +++ b/packages/eslint-plugin/src/rules/non-nullable-type-assertion-style.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -10,7 +10,7 @@ export default util.createRule({ meta: { docs: { description: 'Enforce non-null assertions over explicit type casts', - recommended: 'strict', + recommended: 'stylistic', requiresTypeChecking: true, }, fixable: 'code', @@ -24,14 +24,11 @@ export default util.createRule({ defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); const sourceCode = context.getSourceCode(); const getTypesIfNotLoose = (node: TSESTree.Node): ts.Type[] | undefined => { - const type = checker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node), - ); + const type = services.getTypeAtLocation(node); if ( tsutils.isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown) @@ -92,7 +89,7 @@ export default util.createRule({ }; const isConstAssertion = ( - node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, + node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, ): boolean => { return ( node.typeAnnotation.type === AST_NODE_TYPES.TSTypeReference && @@ -103,7 +100,7 @@ export default util.createRule({ return { 'TSAsExpression, TSTypeAssertion'( - node: TSESTree.TSTypeAssertion | TSESTree.TSAsExpression, + node: TSESTree.TSAsExpression | TSESTree.TSTypeAssertion, ): void { if (isConstAssertion(node)) { return; diff --git a/packages/eslint-plugin/src/rules/object-curly-spacing.ts b/packages/eslint-plugin/src/rules/object-curly-spacing.ts index 1c1c737c842..c448af3702c 100644 --- a/packages/eslint-plugin/src/rules/object-curly-spacing.ts +++ b/packages/eslint-plugin/src/rules/object-curly-spacing.ts @@ -25,7 +25,6 @@ export default createRule({ ...baseRule.meta, docs: { description: 'Enforce consistent spacing inside braces', - recommended: false, extendsBaseRule: true, }, }, diff --git a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts index f9b97096afc..d2342adc869 100644 --- a/packages/eslint-plugin/src/rules/padding-line-between-statements.ts +++ b/packages/eslint-plugin/src/rules/padding-line-between-statements.ts @@ -28,8 +28,8 @@ interface NodeTestObject { interface PaddingOption { blankLine: keyof typeof PaddingTypes; - prev: string | string[]; - next: string | string[]; + prev: string[] | string; + next: string[] | string; } type MessageIds = 'expectedBlankLine' | 'unexpectedBlankLine'; @@ -438,12 +438,9 @@ function verifyForAlways( messageId: 'expectedBlankLine', fix(fixer) { const sourceCode = context.getSourceCode(); - let prevToken = getActualLastToken( - prevNode, - sourceCode, - ) as TSESTree.Token; + let prevToken = getActualLastToken(prevNode, sourceCode)!; const nextToken = - (sourceCode.getFirstTokenBetween(prevToken, nextNode, { + sourceCode.getFirstTokenBetween(prevToken, nextNode, { includeComments: true, /** @@ -473,7 +470,7 @@ function verifyForAlways( } return true; }, - }) as TSESTree.Token) || nextNode; + })! || nextNode; const insertText = util.isTokenOnSameLine(prevToken, nextToken) ? '\n\n' : '\n'; @@ -590,22 +587,29 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require or disallow padding lines between statements', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', hasSuggestions: false, + // This is intentionally an array schema as you can pass 0..n config objects schema: { $defs: { paddingType: { + type: 'string', enum: Object.keys(PaddingTypes), }, statementType: { anyOf: [ - { enum: Object.keys(StatementTypes) }, + { + type: 'string', + enum: Object.keys(StatementTypes), + }, { type: 'array', - items: { enum: Object.keys(StatementTypes) }, + items: { + type: 'string', + enum: Object.keys(StatementTypes), + }, minItems: 1, uniqueItems: true, additionalItems: false, @@ -614,6 +618,7 @@ export default util.createRule({ }, }, type: 'array', + additionalItems: false, items: { type: 'object', properties: { @@ -624,7 +629,6 @@ export default util.createRule({ additionalProperties: false, required: ['blankLine', 'prev', 'next'], }, - additionalItems: false, }, messages: { unexpectedBlankLine: 'Unexpected blank line before this statement.', @@ -637,10 +641,10 @@ export default util.createRule({ // eslint-disable-next-line no-restricted-syntax -- We need all raw options. const configureList = context.options || []; - type Scope = null | { + type Scope = { upper: Scope; prevNode: TSESTree.Node | null; - }; + } | null; let scopeInfo: Scope = null; @@ -675,7 +679,7 @@ export default util.createRule({ * @returns `true` if the statement node matched the type. * @private */ - function match(node: TSESTree.Node, type: string | string[]): boolean { + function match(node: TSESTree.Node, type: string[] | string): boolean { let innerStatementNode = node; while (innerStatementNode.type === AST_NODE_TYPES.LabeledStatement) { @@ -699,7 +703,7 @@ export default util.createRule({ function getPaddingType( prevNode: TSESTree.Node, nextNode: TSESTree.Node, - ): typeof PaddingTypes[keyof typeof PaddingTypes] { + ): (typeof PaddingTypes)[keyof typeof PaddingTypes] { for (let i = configureList.length - 1; i >= 0; --i) { const configure = configureList[i]; if ( diff --git a/packages/eslint-plugin/src/rules/parameter-properties.ts b/packages/eslint-plugin/src/rules/parameter-properties.ts index 32547d9650f..8ee987caaf3 100644 --- a/packages/eslint-plugin/src/rules/parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/parameter-properties.ts @@ -4,13 +4,13 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; type Modifier = - | 'readonly' + | 'private readonly' | 'private' + | 'protected readonly' | 'protected' + | 'public readonly' | 'public' - | 'private readonly' - | 'protected readonly' - | 'public readonly'; + | 'readonly'; type Prefer = 'class-property' | 'parameter-property'; @@ -30,7 +30,6 @@ export default util.createRule({ docs: { description: 'Require or disallow parameter properties in class constructors', - recommended: false, }, messages: { preferClassProperty: @@ -38,40 +37,38 @@ export default util.createRule({ preferParameterProperty: 'Property {{parameter}} should be declared as a parameter property.', }, - schema: { - $defs: { - modifier: { - enum: [ - 'readonly', - 'private', - 'protected', - 'public', - 'private readonly', - 'protected readonly', - 'public readonly', - ], + schema: [ + { + $defs: { + modifier: { + type: 'string', + enum: [ + 'readonly', + 'private', + 'protected', + 'public', + 'private readonly', + 'protected readonly', + 'public readonly', + ], + }, }, - }, - prefixItems: [ - { - type: 'object', - properties: { - allow: { - type: 'array', - items: { - $ref: '#/$defs/modifier', - }, - minItems: 1, - }, - prefer: { - enum: ['class-property', 'parameter-property'], + type: 'object', + properties: { + allow: { + type: 'array', + items: { + $ref: '#/items/0/$defs/modifier', }, }, - additionalProperties: false, + prefer: { + type: 'string', + enum: ['class-property', 'parameter-property'], + }, }, - ], - type: 'array', - }, + additionalProperties: false, + }, + ], }, defaultOptions: [ { diff --git a/packages/eslint-plugin/src/rules/prefer-as-const.ts b/packages/eslint-plugin/src/rules/prefer-as-const.ts index b8cc483d6ee..5372e0ed3b0 100644 --- a/packages/eslint-plugin/src/rules/prefer-as-const.ts +++ b/packages/eslint-plugin/src/rules/prefer-as-const.ts @@ -9,7 +9,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Enforce the use of `as const` over literal type', - recommended: 'error', + recommended: 'recommended', }, fixable: 'code', hasSuggestions: true, @@ -49,7 +49,7 @@ export default util.createRule({ { messageId: 'variableSuggest', fix: (fixer): TSESLint.RuleFix[] => [ - fixer.remove(typeNode.parent!), + fixer.remove(typeNode.parent), fixer.insertTextAfter(valueNode, ' as const'), ], }, diff --git a/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts b/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts index c852d9fdd57..50ce4a7de6b 100644 --- a/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts +++ b/packages/eslint-plugin/src/rules/prefer-enum-initializers.ts @@ -11,7 +11,6 @@ export default util.createRule<[], MessageIds>({ docs: { description: 'Require each enum member value to be explicitly initialized', - recommended: false, }, hasSuggestions: true, messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-for-of.ts b/packages/eslint-plugin/src/rules/prefer-for-of.ts index ddde074a234..d326b1114fd 100644 --- a/packages/eslint-plugin/src/rules/prefer-for-of.ts +++ b/packages/eslint-plugin/src/rules/prefer-for-of.ts @@ -10,7 +10,7 @@ export default util.createRule({ docs: { description: 'Enforce the use of `for-of` loop over the standard `for` loop where possible', - recommended: 'strict', + recommended: 'stylistic', }, messages: { preferForOf: diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index 66c3ed0162f..a861104ce86 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -14,7 +14,7 @@ export default util.createRule({ docs: { description: 'Enforce using function types instead of interfaces with call signatures', - recommended: 'strict', + recommended: 'stylistic', }, fixable: 'code', messages: { @@ -98,7 +98,6 @@ export default util.createRule({ } const fixable = - node.parent && node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration; const fix = fixable @@ -136,7 +135,6 @@ export default util.createRule({ } const isParentExported = - node.parent && node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration; if ( @@ -153,12 +151,7 @@ export default util.createRule({ ); }, ''); // comments should move before export and not between export and interface declaration - fixes.push( - fixer.insertTextBefore( - node.parent as TSESTree.Node | TSESTree.Token, - commentsText, - ), - ); + fixes.push(fixer.insertTextBefore(node.parent, commentsText)); } else { comments.forEach(comment => { let commentText = diff --git a/packages/eslint-plugin/src/rules/prefer-includes.ts b/packages/eslint-plugin/src/rules/prefer-includes.ts index e0b5719a510..65f717c4126 100644 --- a/packages/eslint-plugin/src/rules/prefer-includes.ts +++ b/packages/eslint-plugin/src/rules/prefer-includes.ts @@ -34,7 +34,7 @@ export default createRule({ create(context) { const globalScope = context.getScope(); const services = getParserServices(context); - const types = services.program.getTypeChecker(); + const checker = services.program.getTypeChecker(); function isNumber(node: TSESTree.Node, value: number): boolean { const evaluated = getStaticValue(node, globalScope); @@ -124,6 +124,27 @@ export default createRule({ ); } + function escapeString(str: string): string { + const EscapeMap = { + '\0': '\\0', + "'": "\\'", + '\\': '\\\\', + '\n': '\\n', + '\r': '\\r', + '\v': '\\v', + '\t': '\\t', + '\f': '\\f', + // "\b" cause unexpected replacements + // '\b': '\\b', + }; + const replaceRegex = new RegExp(Object.values(EscapeMap).join('|'), 'g'); + + return str.replace( + replaceRegex, + char => EscapeMap[char as keyof typeof EscapeMap], + ); + } + function checkArrayIndexOf( node: TSESTree.MemberExpression, allowFixing: boolean, @@ -141,9 +162,8 @@ export default createRule({ } // Get the symbol of `indexOf` method. - const tsNode = services.esTreeNodeToTSNodeMap.get(node.property); - const indexofMethodDeclarations = types - .getSymbolAtLocation(tsNode) + const indexofMethodDeclarations = services + .getSymbolAtLocation(node.property) ?.getDeclarations(); if ( indexofMethodDeclarations == null || @@ -156,13 +176,12 @@ export default createRule({ // and the two methods have the same parameters. for (const instanceofMethodDecl of indexofMethodDeclarations) { const typeDecl = instanceofMethodDecl.parent; - const type = types.getTypeAtLocation(typeDecl); + const type = checker.getTypeAtLocation(typeDecl); const includesMethodDecl = type .getProperty('includes') ?.getDeclarations(); if ( - includesMethodDecl == null || - !includesMethodDecl.some(includesMethodDecl => + !includesMethodDecl?.some(includesMethodDecl => hasSameParameters(includesMethodDecl, instanceofMethodDecl), ) ) { @@ -202,20 +221,18 @@ export default createRule({ }, // /bar/.test(foo) - 'CallExpression > MemberExpression.callee[property.name="test"][computed=false]'( - node: TSESTree.MemberExpression, + 'CallExpression[arguments.length=1] > MemberExpression.callee[property.name="test"][computed=false]'( + node: TSESTree.MemberExpression & { parent: TSESTree.CallExpression }, ): void { - const callNode = node.parent as TSESTree.CallExpression; - const text = - callNode.arguments.length === 1 ? parseRegExp(node.object) : null; + const callNode = node.parent; + const text = parseRegExp(node.object); if (text == null) { return; } //check the argument type of test methods const argument = callNode.arguments[0]; - const tsNode = services.esTreeNodeToTSNodeMap.get(argument); - const type = getConstrainedTypeAtLocation(types, tsNode); + const type = getConstrainedTypeAtLocation(services, argument); const includesMethodDecl = type .getProperty('includes') @@ -237,13 +254,14 @@ export default createRule({ argNode.type !== AST_NODE_TYPES.CallExpression; yield fixer.removeRange([callNode.range[0], argNode.range[0]]); + yield fixer.removeRange([argNode.range[1], callNode.range[1]]); if (needsParen) { yield fixer.insertTextBefore(argNode, '('); yield fixer.insertTextAfter(argNode, ')'); } yield fixer.insertTextAfter( argNode, - `${node.optional ? '?.' : '.'}includes('${text}'`, + `${node.optional ? '?.' : '.'}includes('${escapeString(text)}')`, ); }, }); diff --git a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts index b40b62f3815..1aa0919d04b 100644 --- a/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts +++ b/packages/eslint-plugin/src/rules/prefer-namespace-keyword.ts @@ -9,7 +9,7 @@ export default util.createRule({ docs: { description: 'Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules', - recommended: 'error', + recommended: 'stylistic', }, fixable: 'code', messages: { diff --git a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts index 14157427efa..99bc76429d2 100644 --- a/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts +++ b/packages/eslint-plugin/src/rules/prefer-nullish-coalescing.ts @@ -1,24 +1,30 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; export type Options = [ { + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; ignoreConditionalTests?: boolean; - ignoreTernaryTests?: boolean; ignoreMixedLogicalExpressions?: boolean; - allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + ignorePrimitives?: { + bigint?: boolean; + boolean?: boolean; + number?: boolean; + string?: boolean; + }; + ignoreTernaryTests?: boolean; }, ]; export type MessageIds = + | 'noStrictNullCheck' | 'preferNullishOverOr' | 'preferNullishOverTernary' - | 'suggestNullish' - | 'noStrictNullCheck'; + | 'suggestNullish'; export default util.createRule({ name: 'prefer-nullish-coalescing', @@ -26,8 +32,8 @@ export default util.createRule({ type: 'suggestion', docs: { description: - 'Enforce using the nullish coalescing operator instead of logical chaining', - recommended: 'strict', + 'Enforce using the nullish coalescing operator instead of logical assignments or chaining', + recommended: 'stylistic', requiresTypeChecking: true, }, hasSuggestions: true, @@ -44,16 +50,25 @@ export default util.createRule({ { type: 'object', properties: { - ignoreConditionalTests: { + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: { type: 'boolean', }, - ignoreTernaryTests: { + ignoreConditionalTests: { type: 'boolean', }, ignoreMixedLogicalExpressions: { type: 'boolean', }, - allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: { + ignorePrimitives: { + type: 'object', + properties: { + bigint: { type: 'boolean' }, + boolean: { type: 'boolean' }, + number: { type: 'boolean' }, + string: { type: 'boolean' }, + }, + }, + ignoreTernaryTests: { type: 'boolean', }, }, @@ -63,20 +78,27 @@ export default util.createRule({ }, defaultOptions: [ { - ignoreConditionalTests: true, - ignoreTernaryTests: true, - ignoreMixedLogicalExpressions: true, allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false, + ignoreConditionalTests: false, + ignoreTernaryTests: false, + ignoreMixedLogicalExpressions: false, + ignorePrimitives: { + bigint: false, + boolean: false, + number: false, + string: false, + }, }, ], create( context, [ { + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing, ignoreConditionalTests, - ignoreTernaryTests, ignoreMixedLogicalExpressions, - allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing, + ignorePrimitives, + ignoreTernaryTests, }, ], ) { @@ -108,7 +130,7 @@ export default util.createRule({ return; } - let operator: '==' | '!=' | '===' | '!==' | undefined; + let operator: '!=' | '!==' | '==' | '===' | undefined; let nodesInsideTestExpression: TSESTree.Node[] = []; if (node.test.type === AST_NODE_TYPES.BinaryExpression) { nodesInsideTestExpression = [node.test.left, node.test.right]; @@ -279,6 +301,22 @@ export default util.createRule({ return; } + const ignorableFlags = [ + ignorePrimitives!.bigint && ts.TypeFlags.BigInt, + ignorePrimitives!.boolean && ts.TypeFlags.BooleanLiteral, + ignorePrimitives!.number && ts.TypeFlags.Number, + ignorePrimitives!.string && ts.TypeFlags.String, + ] + .filter((flag): flag is number => flag !== undefined) + .reduce((previous, flag) => previous | flag, 0); + if ( + (type as ts.UnionOrIntersectionType).types.some(t => + tsutils.isTypeFlagSet(t, ignorableFlags), + ) + ) { + return; + } + const barBarOperator = util.nullThrows( sourceCode.getTokenAfter( node.left, diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/PreferOptionalChainOptions.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/PreferOptionalChainOptions.ts new file mode 100644 index 00000000000..b755c946395 --- /dev/null +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/PreferOptionalChainOptions.ts @@ -0,0 +1,14 @@ +export type PreferOptionalChainMessageIds = + | 'preferOptionalChain' + | 'optionalChainSuggest'; + +export interface PreferOptionalChainOptions { + checkAny?: boolean; + checkUnknown?: boolean; + checkString?: boolean; + checkNumber?: boolean; + checkBoolean?: boolean; + checkBigInt?: boolean; + requireNullish?: boolean; + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing?: boolean; +} diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts new file mode 100644 index 00000000000..39b04504965 --- /dev/null +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/analyzeChain.ts @@ -0,0 +1,568 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import type { + ReportDescriptor, + ReportFixFunction, + RuleContext, + SourceCode, +} from '@typescript-eslint/utils/ts-eslint'; +import { unionTypeParts } from 'ts-api-utils'; +import * as ts from 'typescript'; + +import * as util from '../../util'; +import { compareNodes, NodeComparisonResult } from './compareNodes'; +import type { ValidOperand } from './gatherLogicalOperands'; +import { NullishComparisonType } from './gatherLogicalOperands'; +import type { + PreferOptionalChainMessageIds, + PreferOptionalChainOptions, +} from './PreferOptionalChainOptions'; + +function includesType( + parserServices: ParserServicesWithTypeInformation, + node: TSESTree.Node, + typeFlagIn: ts.TypeFlags, +): boolean { + const typeFlag = typeFlagIn | ts.TypeFlags.Any | ts.TypeFlags.Unknown; + const types = unionTypeParts(parserServices.getTypeAtLocation(node)); + for (const type of types) { + if (util.isTypeFlagSet(type, typeFlag)) { + return true; + } + } + return false; +} + +// I hate that these functions are identical aside from the enum values used +// I can't think of a good way to reuse the code here in a way that will preserve +// the type safety and simplicity. + +type OperandAnalyzer = ( + parserServices: ParserServicesWithTypeInformation, + operand: ValidOperand, + index: number, + chain: readonly ValidOperand[], +) => readonly [ValidOperand] | readonly [ValidOperand, ValidOperand] | null; +const analyzeAndChainOperand: OperandAnalyzer = ( + parserServices, + operand, + index, + chain, +) => { + switch (operand.comparisonType) { + case NullishComparisonType.Boolean: + case NullishComparisonType.NotEqualNullOrUndefined: + return [operand]; + + case NullishComparisonType.NotStrictEqualNull: { + // handle `x !== null && x !== undefined` + const nextOperand = chain[index + 1] as ValidOperand | undefined; + if ( + nextOperand?.comparisonType === + NullishComparisonType.NotStrictEqualUndefined && + compareNodes(operand.comparedName, nextOperand.comparedName) === + NodeComparisonResult.Equal + ) { + return [operand, nextOperand]; + } + if ( + includesType( + parserServices, + operand.comparedName, + ts.TypeFlags.Undefined, + ) + ) { + // we know the next operand is not an `undefined` check and that this + // operand includes `undefined` - which means that making this an + // optional chain would change the runtime behavior of the expression + return null; + } + + return [operand]; + } + + case NullishComparisonType.NotStrictEqualUndefined: { + // handle `x !== undefined && x !== null` + const nextOperand = chain[index + 1] as ValidOperand | undefined; + if ( + nextOperand?.comparisonType === + NullishComparisonType.NotStrictEqualNull && + compareNodes(operand.comparedName, nextOperand.comparedName) === + NodeComparisonResult.Equal + ) { + return [operand, nextOperand]; + } + if ( + includesType(parserServices, operand.comparedName, ts.TypeFlags.Null) + ) { + // we know the next operand is not a `null` check and that this + // operand includes `null` - which means that making this an + // optional chain would change the runtime behavior of the expression + return null; + } + + return [operand]; + } + + default: + return null; + } +}; +const analyzeOrChainOperand: OperandAnalyzer = ( + parserServices, + operand, + index, + chain, +) => { + switch (operand.comparisonType) { + case NullishComparisonType.NotBoolean: + case NullishComparisonType.EqualNullOrUndefined: + return [operand]; + + case NullishComparisonType.StrictEqualNull: { + // handle `x === null || x === undefined` + const nextOperand = chain[index + 1] as ValidOperand | undefined; + if ( + nextOperand?.comparisonType === + NullishComparisonType.StrictEqualUndefined && + compareNodes(operand.comparedName, nextOperand.comparedName) === + NodeComparisonResult.Equal + ) { + return [operand, nextOperand]; + } + if ( + includesType( + parserServices, + operand.comparedName, + ts.TypeFlags.Undefined, + ) + ) { + // we know the next operand is not an `undefined` check and that this + // operand includes `undefined` - which means that making this an + // optional chain would change the runtime behavior of the expression + return null; + } + + return [operand]; + } + + case NullishComparisonType.StrictEqualUndefined: { + // handle `x === undefined || x === null` + const nextOperand = chain[index + 1] as ValidOperand | undefined; + if ( + nextOperand?.comparisonType === NullishComparisonType.StrictEqualNull && + compareNodes(operand.comparedName, nextOperand.comparedName) === + NodeComparisonResult.Equal + ) { + return [operand, nextOperand]; + } + if ( + includesType(parserServices, operand.comparedName, ts.TypeFlags.Null) + ) { + // we know the next operand is not a `null` check and that this + // operand includes `null` - which means that making this an + // optional chain would change the runtime behavior of the expression + return null; + } + + return [operand]; + } + + default: + return null; + } +}; + +function getFixer( + sourceCode: SourceCode, + parserServices: ParserServicesWithTypeInformation, + operator: '&&' | '||', + options: PreferOptionalChainOptions, + chain: ValidOperand[], +): + | { + suggest: NonNullable< + ReportDescriptor['suggest'] + >; + } + | { + fix: NonNullable['fix']>; + } { + const lastOperand = chain[chain.length - 1]; + + let useSuggestionFixer: boolean; + if ( + options.allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing === + true + ) { + // user has opted-in to the unsafe behavior + useSuggestionFixer = false; + } else { + // optional chain specifically will union `undefined` into the final type + // so we need to make sure that there is at least one operand that includes + // `undefined`, or else we're going to change the final type - which is + // unsafe and might cause downstream type errors. + + if ( + lastOperand.comparisonType === + NullishComparisonType.EqualNullOrUndefined || + lastOperand.comparisonType === + NullishComparisonType.NotEqualNullOrUndefined || + lastOperand.comparisonType === + NullishComparisonType.StrictEqualUndefined || + lastOperand.comparisonType === + NullishComparisonType.NotStrictEqualUndefined || + (operator === '||' && + lastOperand.comparisonType === NullishComparisonType.NotBoolean) + ) { + // we know the last operand is an equality check - so the change in types + // DOES NOT matter and will not change the runtime result or cause a type + // check error + useSuggestionFixer = false; + } else { + useSuggestionFixer = true; + + for (const operand of chain) { + if ( + includesType(parserServices, operand.node, ts.TypeFlags.Undefined) + ) { + useSuggestionFixer = false; + break; + } + } + + // TODO - we could further reduce the false-positive rate of this check by + // checking for cases where the change in types don't matter like + // the test location of an if/while/etc statement. + // but it's quite complex to do this without false-negatives, so + // for now we'll just be over-eager with our matching. + // + // it's MUCH better to false-positive here and only provide a + // suggestion fixer, rather than false-negative and autofix to + // broken code. + } + } + + // In its most naive form we could just slap `?.` for every single part of the + // chain. However this would be undesirable because it'd create unnecessary + // conditions in the user's code where there were none before - and it would + // cause errors with rules like our `no-unnecessary-condition`. + // + // Instead we want to include the minimum number of `?.` required to correctly + // unify the code into a single chain. Naively you might think that we can + // just take the final operand add `?.` after the locations from the previous + // operands - however this won't be correct either because earlier operands + // can include a necessary `?.` that's not needed or included in a later + // operand. + // + // So instead what we need to do is to start at the first operand and + // iteratively diff it against the next operand, and add the difference to the + // first operand. + // + // eg + // `foo && foo.bar && foo.bar.baz?.bam && foo.bar.baz.bam()` + // 1) `foo` + // 2) diff(`foo`, `foo.bar`) = `.bar` + // 3) result = `foo?.bar` + // 4) diff(`foo.bar`, `foo.bar.baz?.bam`) = `.baz?.bam` + // 5) result = `foo?.bar?.baz?.bam` + // 6) diff(`foo.bar.baz?.bam`, `foo.bar.baz.bam()`) = `()` + // 7) result = `foo?.bar?.baz?.bam?.()` + + const parts = []; + for (const current of chain) { + const nextOperand = flattenChainExpression( + sourceCode, + current.comparedName, + ); + const diff = nextOperand.slice(parts.length); + if (diff.length > 0) { + if (parts.length > 0) { + // we need to make the first operand of the diff optional so it matches the + // logic before merging + // foo.bar && foo.bar.baz + // diff = .baz + // result = foo.bar?.baz + diff[0].optional = true; + } + parts.push(...diff); + } + } + + let newCode = parts + .map(part => { + let str = ''; + if (part.optional) { + str += '?.'; + } else { + if (part.nonNull) { + str += '!'; + } + if (part.requiresDot) { + str += '.'; + } + } + if ( + part.precedence !== util.OperatorPrecedence.Invalid && + part.precedence < util.OperatorPrecedence.Member + ) { + str += `(${part.text})`; + } else { + str += part.text; + } + return str; + }) + .join(''); + + if (lastOperand.node.type === AST_NODE_TYPES.BinaryExpression) { + // retain the ending comparison for cases like + // x && x.a != null + // x && typeof x.a !== 'undefined' + const operator = lastOperand.node.operator; + const { left, right } = (() => { + if (lastOperand.isYoda) { + const unaryOperator = + lastOperand.node.right.type === AST_NODE_TYPES.UnaryExpression + ? lastOperand.node.right.operator + ' ' + : ''; + + return { + left: sourceCode.getText(lastOperand.node.left), + right: unaryOperator + newCode, + }; + } else { + const unaryOperator = + lastOperand.node.left.type === AST_NODE_TYPES.UnaryExpression + ? lastOperand.node.left.operator + ' ' + : ''; + return { + left: unaryOperator + newCode, + right: sourceCode.getText(lastOperand.node.right), + }; + } + })(); + + newCode = `${left} ${operator} ${right}`; + } else if (lastOperand.comparisonType === NullishComparisonType.NotBoolean) { + newCode = `!${newCode}`; + } + + const fix: ReportFixFunction = fixer => + fixer.replaceTextRange( + [chain[0].node.range[0], lastOperand.node.range[1]], + newCode, + ); + + return useSuggestionFixer + ? { suggest: [{ fix, messageId: 'optionalChainSuggest' }] } + : { fix }; + + interface FlattenedChain { + nonNull: boolean; + optional: boolean; + precedence: util.OperatorPrecedence; + requiresDot: boolean; + text: string; + } + function flattenChainExpression( + sourceCode: SourceCode, + node: TSESTree.Node, + ): FlattenedChain[] { + switch (node.type) { + case AST_NODE_TYPES.ChainExpression: + return flattenChainExpression(sourceCode, node.expression); + + case AST_NODE_TYPES.CallExpression: { + const argumentsText = (() => { + const closingParenToken = util.nullThrows( + sourceCode.getLastToken(node), + util.NullThrowsReasons.MissingToken( + 'closing parenthesis', + node.type, + ), + ); + const openingParenToken = util.nullThrows( + sourceCode.getFirstTokenBetween( + node.typeArguments ?? node.callee, + closingParenToken, + util.isOpeningParenToken, + ), + util.NullThrowsReasons.MissingToken( + 'opening parenthesis', + node.type, + ), + ); + return sourceCode.text.substring( + openingParenToken.range[0], + closingParenToken.range[1], + ); + })(); + + const typeArgumentsText = (() => { + if (node.typeArguments == null) { + return ''; + } + + return sourceCode.getText(node.typeArguments); + })(); + + return [ + ...flattenChainExpression(sourceCode, node.callee), + { + nonNull: false, + optional: node.optional, + // no precedence for this + precedence: util.OperatorPrecedence.Invalid, + requiresDot: false, + text: typeArgumentsText + argumentsText, + }, + ]; + } + + case AST_NODE_TYPES.MemberExpression: { + const propertyText = sourceCode.getText(node.property); + return [ + ...flattenChainExpression(sourceCode, node.object), + { + nonNull: node.object.type === AST_NODE_TYPES.TSNonNullExpression, + optional: node.optional, + precedence: node.computed + ? // computed is already wrapped in [] so no need to wrap in () as well + util.OperatorPrecedence.Invalid + : util.getOperatorPrecedenceForNode(node.property), + requiresDot: !node.computed, + text: node.computed ? `[${propertyText}]` : propertyText, + }, + ]; + } + + case AST_NODE_TYPES.TSNonNullExpression: + return flattenChainExpression(sourceCode, node.expression); + + default: + return [ + { + nonNull: false, + optional: false, + precedence: util.getOperatorPrecedenceForNode(node), + requiresDot: false, + text: sourceCode.getText(node), + }, + ]; + } + } +} + +export function analyzeChain( + context: RuleContext< + PreferOptionalChainMessageIds, + [PreferOptionalChainOptions] + >, + sourceCode: SourceCode, + parserServices: ParserServicesWithTypeInformation, + options: PreferOptionalChainOptions, + operator: TSESTree.LogicalExpression['operator'], + chain: ValidOperand[], +): void { + // need at least 2 operands in a chain for it to be a chain + if ( + chain.length <= 1 || + /* istanbul ignore next -- previous checks make this unreachable, but keep it for exhaustiveness check */ + operator === '??' + ) { + return; + } + + const analyzeOperand = (() => { + switch (operator) { + case '&&': + return analyzeAndChainOperand; + + case '||': + return analyzeOrChainOperand; + } + })(); + + let subChain: ValidOperand[] = []; + const maybeReportThenReset = ( + newChainSeed?: readonly ValidOperand[], + ): void => { + if (subChain.length > 1) { + context.report({ + messageId: 'preferOptionalChain', + loc: { + start: subChain[0].node.loc.start, + end: subChain[subChain.length - 1].node.loc.end, + }, + ...getFixer(sourceCode, parserServices, operator, options, subChain), + }); + } + + // we've reached the end of a chain of logical expressions + // i.e. the current operand doesn't belong to the previous chain. + // + // we don't want to throw away the current operand otherwise we will skip it + // and that can cause us to miss chains. So instead we seed the new chain + // with the current operand + // + // eg this means we can catch cases like: + // unrelated != null && foo != null && foo.bar != null; + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ first "chain" + // ^^^^^^^^^^^ newChainSeed + // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ second chain + subChain = newChainSeed ? [...newChainSeed] : []; + }; + + for (let i = 0; i < chain.length; i += 1) { + const lastOperand = subChain[subChain.length - 1] as + | ValidOperand + | undefined; + const operand = chain[i]; + + const validatedOperands = analyzeOperand(parserServices, operand, i, chain); + if (!validatedOperands) { + // TODO - #7170 + // check if the name is a superset/equal - if it is, then it likely + // intended to be part of the chain and something we should include in the + // report, eg + // foo == null || foo.bar; + // ^^^^^^^^^^^ valid OR chain + // ^^^^^^^ invalid OR chain logical, but still part of + // the chain for combination purposes + + maybeReportThenReset(); + continue; + } + // in case multiple operands were consumed - make sure to correctly increment the index + i += validatedOperands.length - 1; + + const currentOperand = validatedOperands[0]; + if (lastOperand) { + const comparisonResult = compareNodes( + lastOperand.comparedName, + // purposely inspect and push the last operand because the prior operands don't matter + // this also means we won't false-positive in cases like + // foo !== null && foo !== undefined + validatedOperands[validatedOperands.length - 1].comparedName, + ); + if (comparisonResult === NodeComparisonResult.Subset) { + // the operands are comparable, so we can continue searching + subChain.push(currentOperand); + } else if (comparisonResult === NodeComparisonResult.Invalid) { + maybeReportThenReset(validatedOperands); + } else if (comparisonResult === NodeComparisonResult.Equal) { + // purposely don't push this case because the node is a no-op and if + // we consider it then we might report on things like + // foo && foo + } + } else { + subChain.push(currentOperand); + } + } + + // check the leftovers + maybeReportThenReset(); +} diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/compareNodes.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/compareNodes.ts new file mode 100644 index 00000000000..d9dce486ec9 --- /dev/null +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/compareNodes.ts @@ -0,0 +1,412 @@ +import type { TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { visitorKeys } from '@typescript-eslint/visitor-keys'; + +export const enum NodeComparisonResult { + /** the two nodes are comparably the same */ + Equal = 'Equal', + /** the left node is a subset of the right node */ + Subset = 'Subset', + /** the left node is not the same or is a superset of the right node */ + Invalid = 'Invalid', +} + +function compareArrays( + arrayA: unknown[], + arrayB: unknown[], +): NodeComparisonResult.Equal | NodeComparisonResult.Invalid { + if (arrayA.length !== arrayB.length) { + return NodeComparisonResult.Invalid; + } + + const result = arrayA.every((elA, idx) => { + const elB = arrayB[idx]; + if (elA == null || elB == null) { + return elA === elB; + } + return compareUnknownValues(elA, elB) === NodeComparisonResult.Equal; + }); + if (result) { + return NodeComparisonResult.Equal; + } + return NodeComparisonResult.Invalid; +} + +function isValidNode(x: unknown): x is TSESTree.Node { + return ( + typeof x === 'object' && + x != null && + 'type' in x && + typeof x.type === 'string' + ); +} +function isValidChainExpressionToLookThrough( + node: TSESTree.Node, +): node is TSESTree.ChainExpression { + return ( + !( + node.parent?.type === AST_NODE_TYPES.MemberExpression && + node.parent.object === node + ) && + !( + node.parent?.type === AST_NODE_TYPES.CallExpression && + node.parent.callee === node + ) && + node.type === AST_NODE_TYPES.ChainExpression + ); +} +function compareUnknownValues( + valueA: unknown, + valueB: unknown, +): NodeComparisonResult { + /* istanbul ignore if -- not possible for us to test this - it's just a sanity safeguard */ + if (valueA == null || valueB == null) { + if (valueA !== valueB) { + return NodeComparisonResult.Invalid; + } + return NodeComparisonResult.Equal; + } + + /* istanbul ignore if -- not possible for us to test this - it's just a sanity safeguard */ + if (!isValidNode(valueA) || !isValidNode(valueB)) { + return NodeComparisonResult.Invalid; + } + + return compareNodes(valueA, valueB); +} +function compareByVisiting( + nodeA: TSESTree.Node, + nodeB: TSESTree.Node, +): NodeComparisonResult.Equal | NodeComparisonResult.Invalid { + const currentVisitorKeys = visitorKeys[nodeA.type]; + /* istanbul ignore if -- not possible for us to test this - it's just a sanity safeguard */ + if (currentVisitorKeys == null) { + // we don't know how to visit this node, so assume it's invalid to avoid false-positives / broken fixers + return NodeComparisonResult.Invalid; + } + + if (currentVisitorKeys.length === 0) { + // assume nodes with no keys are constant things like keywords + return NodeComparisonResult.Equal; + } + + for (const key of currentVisitorKeys) { + // @ts-expect-error - dynamic access but it's safe + const nodeAChildOrChildren = nodeA[key] as unknown; + // @ts-expect-error - dynamic access but it's safe + const nodeBChildOrChildren = nodeB[key] as unknown; + + if (Array.isArray(nodeAChildOrChildren)) { + const arrayA = nodeAChildOrChildren as unknown[]; + const arrayB = nodeBChildOrChildren as unknown[]; + + const result = compareArrays(arrayA, arrayB); + if (result !== NodeComparisonResult.Equal) { + return NodeComparisonResult.Invalid; + } + // fallthrough to the next key as the key was "equal" + } else { + const result = compareUnknownValues( + nodeAChildOrChildren, + nodeBChildOrChildren, + ); + if (result !== NodeComparisonResult.Equal) { + return NodeComparisonResult.Invalid; + } + // fallthrough to the next key as the key was "equal" + } + } + + return NodeComparisonResult.Equal; +} +type CompareNodesArgument = TSESTree.Node | null | undefined; +function compareNodesUncached( + nodeA: TSESTree.Node, + nodeB: TSESTree.Node, +): NodeComparisonResult { + if (nodeA.type !== nodeB.type) { + // special cases where nodes are allowed to be non-equal + + // look through a chain expression node at the top-level because it only + // exists to delimit the end of an optional chain + // + // a?.b && a.b.c + // ^^^^ ChainExpression, MemberExpression + // ^^^^^ MemberExpression + // + // except for in this class of cases + // (a?.b).c && a.b.c + // because the parentheses have runtime meaning (sad face) + if (isValidChainExpressionToLookThrough(nodeA)) { + return compareNodes(nodeA.expression, nodeB); + } + if (isValidChainExpressionToLookThrough(nodeB)) { + return compareNodes(nodeA, nodeB.expression); + } + + // look through the type-only non-null assertion because its existence could + // possibly be replaced by an optional chain instead + // + // a.b! && a.b.c + // ^^^^ TSNonNullExpression + if (nodeA.type === AST_NODE_TYPES.TSNonNullExpression) { + return compareNodes(nodeA.expression, nodeB); + } + if (nodeB.type === AST_NODE_TYPES.TSNonNullExpression) { + return compareNodes(nodeA, nodeB.expression); + } + + // special case for subset optional chains where the node types don't match, + // but we want to try comparing by discarding the "extra" code + // + // a && a.b + // ^ compare this + // a && a() + // ^ compare this + // a.b && a.b() + // ^^^ compare this + // a() && a().b + // ^^^ compare this + // import.meta && import.meta.b + // ^^^^^^^^^^^ compare this + if ( + nodeA.type === AST_NODE_TYPES.CallExpression || + nodeA.type === AST_NODE_TYPES.Identifier || + nodeA.type === AST_NODE_TYPES.MemberExpression || + nodeA.type === AST_NODE_TYPES.MetaProperty + ) { + switch (nodeB.type) { + case AST_NODE_TYPES.MemberExpression: + if (nodeB.property.type === AST_NODE_TYPES.PrivateIdentifier) { + // Private identifiers in optional chaining is not currently allowed + // TODO - handle this once TS supports it (https://github.com/microsoft/TypeScript/issues/42734) + return NodeComparisonResult.Invalid; + } + if ( + compareNodes(nodeA, nodeB.object) !== NodeComparisonResult.Invalid + ) { + return NodeComparisonResult.Subset; + } + return NodeComparisonResult.Invalid; + + case AST_NODE_TYPES.CallExpression: + if ( + compareNodes(nodeA, nodeB.callee) !== NodeComparisonResult.Invalid + ) { + return NodeComparisonResult.Subset; + } + return NodeComparisonResult.Invalid; + + default: + return NodeComparisonResult.Invalid; + } + } + + return NodeComparisonResult.Invalid; + } + + switch (nodeA.type) { + // these expressions create a new instance each time - so it makes no sense to compare the chain + case AST_NODE_TYPES.ArrayExpression: + case AST_NODE_TYPES.ArrowFunctionExpression: + case AST_NODE_TYPES.ClassExpression: + case AST_NODE_TYPES.FunctionExpression: + case AST_NODE_TYPES.JSXElement: + case AST_NODE_TYPES.JSXFragment: + case AST_NODE_TYPES.NewExpression: + case AST_NODE_TYPES.ObjectExpression: + return NodeComparisonResult.Invalid; + + // chaining from assignments could change the value irrevocably - so it makes no sense to compare the chain + case AST_NODE_TYPES.AssignmentExpression: + return NodeComparisonResult.Invalid; + + case AST_NODE_TYPES.CallExpression: { + const nodeBCall = nodeB as typeof nodeA; + + // check for cases like + // foo() && foo()(bar) + // ^^^^^ nodeA + // ^^^^^^^^^^ nodeB + // we don't want to check the arguments in this case + const aSubsetOfB = compareNodes(nodeA, nodeBCall.callee); + if (aSubsetOfB !== NodeComparisonResult.Invalid) { + return NodeComparisonResult.Subset; + } + + const calleeCompare = compareNodes(nodeA.callee, nodeBCall.callee); + if (calleeCompare !== NodeComparisonResult.Equal) { + return NodeComparisonResult.Invalid; + } + + // NOTE - we purposely ignore optional flag because for our purposes + // foo?.bar() && foo.bar?.()?.baz + // or + // foo.bar() && foo?.bar?.()?.baz + // are going to be exactly the same + + const argumentCompare = compareArrays( + nodeA.arguments, + nodeBCall.arguments, + ); + if (argumentCompare !== NodeComparisonResult.Equal) { + return NodeComparisonResult.Invalid; + } + + const typeParamCompare = compareNodes( + nodeA.typeArguments, + nodeBCall.typeArguments, + ); + if (typeParamCompare === NodeComparisonResult.Equal) { + return NodeComparisonResult.Equal; + } + + return NodeComparisonResult.Invalid; + } + + case AST_NODE_TYPES.ChainExpression: + // special case handling for ChainExpression because it's allowed to be a subset + return compareNodes(nodeA, (nodeB as typeof nodeA).expression); + + case AST_NODE_TYPES.Identifier: + case AST_NODE_TYPES.PrivateIdentifier: + if (nodeA.name === (nodeB as typeof nodeA).name) { + return NodeComparisonResult.Equal; + } + return NodeComparisonResult.Invalid; + + case AST_NODE_TYPES.Literal: { + const nodeBLiteral = nodeB as typeof nodeA; + if ( + nodeA.raw === nodeBLiteral.raw && + nodeA.value === nodeBLiteral.value + ) { + return NodeComparisonResult.Equal; + } + return NodeComparisonResult.Invalid; + } + + case AST_NODE_TYPES.MemberExpression: { + const nodeBMember = nodeB as typeof nodeA; + + if (nodeBMember.property.type === AST_NODE_TYPES.PrivateIdentifier) { + // Private identifiers in optional chaining is not currently allowed + // TODO - handle this once TS supports it (https://github.com/microsoft/TypeScript/issues/42734) + return NodeComparisonResult.Invalid; + } + + // check for cases like + // foo.bar && foo.bar.baz + // ^^^^^^^ nodeA + // ^^^^^^^^^^^ nodeB + // result === Equal + // + // foo.bar && foo.bar.baz.bam + // ^^^^^^^ nodeA + // ^^^^^^^^^^^^^^^ nodeB + // result === Subset + // + // we don't want to check the property in this case + const aSubsetOfB = compareNodes(nodeA, nodeBMember.object); + if (aSubsetOfB !== NodeComparisonResult.Invalid) { + return NodeComparisonResult.Subset; + } + + if (nodeA.computed !== nodeBMember.computed) { + return NodeComparisonResult.Invalid; + } + + // NOTE - we purposely ignore optional flag because for our purposes + // foo?.bar && foo.bar?.baz + // or + // foo.bar && foo?.bar?.baz + // are going to be exactly the same + + const objectCompare = compareNodes(nodeA.object, nodeBMember.object); + if (objectCompare !== NodeComparisonResult.Equal) { + return NodeComparisonResult.Invalid; + } + + return compareNodes(nodeA.property, nodeBMember.property); + } + case AST_NODE_TYPES.TSTemplateLiteralType: + case AST_NODE_TYPES.TemplateLiteral: { + const nodeBTemplate = nodeB as typeof nodeA; + const areQuasisEqual = + nodeA.quasis.length === nodeBTemplate.quasis.length && + nodeA.quasis.every((elA, idx) => { + const elB = nodeBTemplate.quasis[idx]; + return elA.value.cooked === elB.value.cooked; + }); + if (!areQuasisEqual) { + return NodeComparisonResult.Invalid; + } + + return NodeComparisonResult.Equal; + } + + case AST_NODE_TYPES.TemplateElement: { + const nodeBElement = nodeB as typeof nodeA; + if (nodeA.value.cooked === nodeBElement.value.cooked) { + return NodeComparisonResult.Equal; + } + return NodeComparisonResult.Invalid; + } + + // these aren't actually valid expressions. + // https://github.com/typescript-eslint/typescript-eslint/blob/20d7caee35ab84ae6381fdf04338c9e2b9e2bc48/packages/ast-spec/src/unions/Expression.ts#L37-L43 + case AST_NODE_TYPES.ArrayPattern: + case AST_NODE_TYPES.ObjectPattern: + /* istanbul ignore next */ + return NodeComparisonResult.Invalid; + + // update expression returns a number and also changes the value each time - so it makes no sense to compare the chain + case AST_NODE_TYPES.UpdateExpression: + return NodeComparisonResult.Invalid; + + // yield returns the value passed to the `next` function, so it may not be the same each time - so it makes no sense to compare the chain + case AST_NODE_TYPES.YieldExpression: + return NodeComparisonResult.Invalid; + + // general-case automatic handling of nodes to save us implementing every + // single case by hand. This just iterates the visitor keys to recursively + // check the children. + // + // Any specific logic cases or short-circuits should be listed as separate + // cases so that they don't fall into this generic handling + default: + return compareByVisiting(nodeA, nodeB); + } +} +const COMPARE_NODES_CACHE = new WeakMap< + TSESTree.Node, + WeakMap +>(); +/** + * Compares two nodes' ASTs to determine if the A is equal to or a subset of B + */ +export function compareNodes( + nodeA: CompareNodesArgument, + nodeB: CompareNodesArgument, +): NodeComparisonResult { + if (nodeA == null || nodeB == null) { + if (nodeA !== nodeB) { + return NodeComparisonResult.Invalid; + } + return NodeComparisonResult.Equal; + } + + const cached = COMPARE_NODES_CACHE.get(nodeA)?.get(nodeB); + if (cached) { + return cached; + } + + const result = compareNodesUncached(nodeA, nodeB); + let mapA = COMPARE_NODES_CACHE.get(nodeA); + if (mapA == null) { + mapA = new WeakMap(); + COMPARE_NODES_CACHE.set(nodeA, mapA); + } + mapA.set(nodeB, result); + return result; +} diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts new file mode 100644 index 00000000000..39f3a96f32d --- /dev/null +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain-utils/gatherLogicalOperands.ts @@ -0,0 +1,371 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; +import { + isBigIntLiteralType, + isBooleanLiteralType, + isNumberLiteralType, + isStringLiteralType, + unionTypeParts, +} from 'ts-api-utils'; +import * as ts from 'typescript'; + +import * as util from '../../util'; +import type { PreferOptionalChainOptions } from './PreferOptionalChainOptions'; + +const enum ComparisonValueType { + Null = 'Null', // eslint-disable-line @typescript-eslint/internal/prefer-ast-types-enum + Undefined = 'Undefined', + UndefinedStringLiteral = 'UndefinedStringLiteral', +} +export const enum OperandValidity { + Valid = 'Valid', + Invalid = 'Invalid', +} +export const enum NullishComparisonType { + /** `x != null`, `x != undefined` */ + NotEqualNullOrUndefined = 'NotEqualNullOrUndefined', + /** `x == null`, `x == undefined` */ + EqualNullOrUndefined = 'EqualNullOrUndefined', + + /** `x !== null` */ + NotStrictEqualNull = 'NotStrictEqualNull', + /** `x === null` */ + StrictEqualNull = 'StrictEqualNull', + + /** `x !== undefined`, `typeof x !== 'undefined'` */ + NotStrictEqualUndefined = 'NotStrictEqualUndefined', + /** `x === undefined`, `typeof x === 'undefined'` */ + StrictEqualUndefined = 'StrictEqualUndefined', + + /** `!x` */ + NotBoolean = 'NotBoolean', + /** `x` */ + Boolean = 'Boolean', // eslint-disable-line @typescript-eslint/internal/prefer-ast-types-enum +} +export interface ValidOperand { + type: OperandValidity.Valid; + comparedName: TSESTree.Node; + comparisonType: NullishComparisonType; + isYoda: boolean; + node: TSESTree.Expression; +} +export interface InvalidOperand { + type: OperandValidity.Invalid; +} +type Operand = ValidOperand | InvalidOperand; + +const NULLISH_FLAGS = ts.TypeFlags.Null | ts.TypeFlags.Undefined; +function isValidFalseBooleanCheckType( + node: TSESTree.Node, + operator: TSESTree.LogicalExpression['operator'], + checkType: 'true' | 'false', + parserServices: ParserServicesWithTypeInformation, + options: PreferOptionalChainOptions, +): boolean { + const type = parserServices.getTypeAtLocation(node); + const types = unionTypeParts(type); + + const disallowFalseyLiteral = + (operator === '||' && checkType === 'false') || + (operator === '&&' && checkType === 'true'); + if (disallowFalseyLiteral) { + /* + ``` + declare const x: false | {a: string}; + x && x.a; + !x || x.a; + ``` + + We don't want to consider these two cases because the boolean expression + narrows out the non-nullish falsy cases - so converting the chain to `x?.a` + would introduce a build error + */ + if ( + types.some(t => isBooleanLiteralType(t) && t.intrinsicName === 'false') || + types.some(t => isStringLiteralType(t) && t.value === '') || + types.some(t => isNumberLiteralType(t) && t.value === 0) || + types.some(t => isBigIntLiteralType(t) && t.value.base10Value === '0') + ) { + return false; + } + } + + if (options.requireNullish === true) { + return types.some(t => util.isTypeFlagSet(t, NULLISH_FLAGS)); + } + + let allowedFlags = NULLISH_FLAGS | ts.TypeFlags.Object; + if (options.checkAny === true) { + allowedFlags |= ts.TypeFlags.Any; + } + if (options.checkUnknown === true) { + allowedFlags |= ts.TypeFlags.Unknown; + } + if (options.checkString === true) { + allowedFlags |= ts.TypeFlags.StringLike; + } + if (options.checkNumber === true) { + allowedFlags |= ts.TypeFlags.NumberLike; + } + if (options.checkBoolean === true) { + allowedFlags |= ts.TypeFlags.BooleanLike; + } + if (options.checkBigInt === true) { + allowedFlags |= ts.TypeFlags.BigIntLike; + } + return types.every(t => util.isTypeFlagSet(t, allowedFlags)); +} + +export function gatherLogicalOperands( + node: TSESTree.LogicalExpression, + parserServices: ParserServicesWithTypeInformation, + options: PreferOptionalChainOptions, +): { + operands: Operand[]; + newlySeenLogicals: Set; +} { + const result: Operand[] = []; + const { operands, newlySeenLogicals } = flattenLogicalOperands(node); + + for (const operand of operands) { + switch (operand.type) { + case AST_NODE_TYPES.BinaryExpression: { + // check for "yoda" style logical: null != x + + const { comparedExpression, comparedValue, isYoda } = (() => { + // non-yoda checks are by far the most common, so check for them first + const comparedValueRight = getComparisonValueType(operand.right); + if (comparedValueRight) { + return { + comparedExpression: operand.left, + comparedValue: comparedValueRight, + isYoda: false, + }; + } else { + return { + comparedExpression: operand.right, + comparedValue: getComparisonValueType(operand.left), + isYoda: true, + }; + } + })(); + + if (comparedValue === ComparisonValueType.UndefinedStringLiteral) { + if ( + comparedExpression.type === AST_NODE_TYPES.UnaryExpression && + comparedExpression.operator === 'typeof' + ) { + // typeof x === 'undefined' + result.push({ + type: OperandValidity.Valid, + comparedName: comparedExpression.argument, + comparisonType: operand.operator.startsWith('!') + ? NullishComparisonType.NotStrictEqualUndefined + : NullishComparisonType.StrictEqualUndefined, + isYoda, + node: operand, + }); + continue; + } + + // y === 'undefined' + result.push({ type: OperandValidity.Invalid }); + continue; + } + + switch (operand.operator) { + case '!=': + case '==': + if ( + comparedValue === ComparisonValueType.Null || + comparedValue === ComparisonValueType.Undefined + ) { + // x == null, x == undefined + result.push({ + type: OperandValidity.Valid, + comparedName: comparedExpression, + comparisonType: operand.operator.startsWith('!') + ? NullishComparisonType.NotEqualNullOrUndefined + : NullishComparisonType.EqualNullOrUndefined, + isYoda, + node: operand, + }); + continue; + } + // x == something :( + result.push({ type: OperandValidity.Invalid }); + continue; + + case '!==': + case '===': { + const comparedName = comparedExpression; + switch (comparedValue) { + case ComparisonValueType.Null: + result.push({ + type: OperandValidity.Valid, + comparedName, + comparisonType: operand.operator.startsWith('!') + ? NullishComparisonType.NotStrictEqualNull + : NullishComparisonType.StrictEqualNull, + isYoda, + node: operand, + }); + continue; + + case ComparisonValueType.Undefined: + result.push({ + type: OperandValidity.Valid, + comparedName, + comparisonType: operand.operator.startsWith('!') + ? NullishComparisonType.NotStrictEqualUndefined + : NullishComparisonType.StrictEqualUndefined, + isYoda, + node: operand, + }); + continue; + + default: + // x === something :( + result.push({ type: OperandValidity.Invalid }); + continue; + } + } + } + + result.push({ type: OperandValidity.Invalid }); + continue; + } + + case AST_NODE_TYPES.UnaryExpression: + if ( + operand.operator === '!' && + isValidFalseBooleanCheckType( + operand.argument, + node.operator, + 'false', + parserServices, + options, + ) + ) { + result.push({ + type: OperandValidity.Valid, + comparedName: operand.argument, + comparisonType: NullishComparisonType.NotBoolean, + isYoda: false, + node: operand, + }); + continue; + } + result.push({ type: OperandValidity.Invalid }); + continue; + + case AST_NODE_TYPES.LogicalExpression: + // explicitly ignore the mixed logical expression cases + result.push({ type: OperandValidity.Invalid }); + continue; + + default: + if ( + isValidFalseBooleanCheckType( + operand, + node.operator, + 'true', + parserServices, + options, + ) + ) { + result.push({ + type: OperandValidity.Valid, + comparedName: operand, + comparisonType: NullishComparisonType.Boolean, + isYoda: false, + node: operand, + }); + } else { + result.push({ type: OperandValidity.Invalid }); + } + continue; + } + } + + return { + operands: result, + newlySeenLogicals, + }; + + /* + The AST is always constructed such the first element is always the deepest element. + I.e. for this code: `foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz` + The AST will look like this: + { + left: { + left: { + left: foo + right: foo.bar + } + right: foo.bar.baz + } + right: foo.bar.baz.buzz + } + + So given any logical expression, we can perform a depth-first traversal to get + the operands in order. + + Note that this function purposely does not inspect mixed logical expressions + like `foo || foo.bar && foo.bar.baz` - separate selector + */ + function flattenLogicalOperands(node: TSESTree.LogicalExpression): { + operands: TSESTree.Expression[]; + newlySeenLogicals: Set; + } { + const operands: TSESTree.Expression[] = []; + const newlySeenLogicals = new Set([node]); + + const stack: TSESTree.Expression[] = [node.right, node.left]; + let current: TSESTree.Expression | undefined; + while ((current = stack.pop())) { + if ( + current.type === AST_NODE_TYPES.LogicalExpression && + current.operator === node.operator + ) { + newlySeenLogicals.add(current); + stack.push(current.right); + stack.push(current.left); + } else { + operands.push(current); + } + } + + return { + operands, + newlySeenLogicals, + }; + } + + function getComparisonValueType( + node: TSESTree.Node, + ): ComparisonValueType | null { + switch (node.type) { + case AST_NODE_TYPES.Literal: + // eslint-disable-next-line eqeqeq -- intentional exact comparison against null + if (node.value === null && node.raw === 'null') { + return ComparisonValueType.Null; + } + if (node.value === 'undefined') { + return ComparisonValueType.UndefinedStringLiteral; + } + return null; + + case AST_NODE_TYPES.Identifier: + if (node.name === 'undefined') { + return ComparisonValueType.Undefined; + } + return null; + } + + return null; + } +} diff --git a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts index efccc2ccfd2..f88e37cb737 100644 --- a/packages/eslint-plugin/src/rules/prefer-optional-chain.ts +++ b/packages/eslint-plugin/src/rules/prefer-optional-chain.ts @@ -1,59 +1,109 @@ -import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import { isBinaryExpression } from 'tsutils'; +import type { RuleFix } from '@typescript-eslint/utils/ts-eslint'; import * as ts from 'typescript'; import * as util from '../util'; - -type ValidChainTarget = - | TSESTree.BinaryExpression - | TSESTree.CallExpression - | TSESTree.ChainExpression - | TSESTree.Identifier - | TSESTree.PrivateIdentifier - | TSESTree.MemberExpression - | TSESTree.ThisExpression - | TSESTree.MetaProperty; - -/* -The AST is always constructed such the first element is always the deepest element. -I.e. for this code: `foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz` -The AST will look like this: -{ - left: { - left: { - left: foo - right: foo.bar - } - right: foo.bar.baz - } - right: foo.bar.baz.buzz -} -*/ - -export default util.createRule({ +import { analyzeChain } from './prefer-optional-chain-utils/analyzeChain'; +import type { ValidOperand } from './prefer-optional-chain-utils/gatherLogicalOperands'; +import { + gatherLogicalOperands, + OperandValidity, +} from './prefer-optional-chain-utils/gatherLogicalOperands'; +import type { + PreferOptionalChainMessageIds, + PreferOptionalChainOptions, +} from './prefer-optional-chain-utils/PreferOptionalChainOptions'; + +export default util.createRule< + [PreferOptionalChainOptions], + PreferOptionalChainMessageIds +>({ name: 'prefer-optional-chain', meta: { type: 'suggestion', docs: { description: 'Enforce using concise optional chain expressions instead of chained logical ands, negated logical ors, or empty objects', - recommended: 'strict', + recommended: 'stylistic', + requiresTypeChecking: true, }, + fixable: 'code', hasSuggestions: true, messages: { preferOptionalChain: "Prefer using an optional chain expression instead, as it's more concise and easier to read.", optionalChainSuggest: 'Change to an optional chain.', }, - schema: [], + schema: [ + { + type: 'object', + additionalProperties: false, + properties: { + checkAny: { + type: 'boolean', + description: + 'Check operands that are typed as `any` when inspecting "loose boolean" operands.', + }, + checkUnknown: { + type: 'boolean', + description: + 'Check operands that are typed as `unknown` when inspecting "loose boolean" operands.', + }, + checkString: { + type: 'boolean', + description: + 'Check operands that are typed as `string` when inspecting "loose boolean" operands.', + }, + checkNumber: { + type: 'boolean', + description: + 'Check operands that are typed as `number` when inspecting "loose boolean" operands.', + }, + checkBoolean: { + type: 'boolean', + description: + 'Check operands that are typed as `boolean` when inspecting "loose boolean" operands.', + }, + checkBigInt: { + type: 'boolean', + description: + 'Check operands that are typed as `bigint` when inspecting "loose boolean" operands.', + }, + requireNullish: { + type: 'boolean', + description: + 'Skip operands that are not typed with `null` and/or `undefined` when inspecting "loose boolean" operands.', + }, + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: { + type: 'boolean', + description: + 'Allow autofixers that will change the return type of the expression. This option is considered unsafe as it may break the build.', + }, + }, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [ + { + checkAny: true, + checkUnknown: true, + checkString: true, + checkNumber: true, + checkBoolean: true, + checkBigInt: true, + requireNullish: false, + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: false, + }, + ], + create(context, [options]) { const sourceCode = context.getSourceCode(); - const parserServices = util.getParserServices(context, true); + const parserServices = util.getParserServices(context); + + const seenLogicals = new Set(); return { + // specific handling for `(foo ?? {}).bar` / `(foo || {}).bar` 'LogicalExpression[operator="||"], LogicalExpression[operator="??"]'( node: TSESTree.LogicalExpression, ): void { @@ -72,11 +122,13 @@ export default util.createRule({ return; } + seenLogicals.add(node); + function isLeftSideLowerPrecedence(): boolean { const logicalTsNode = parserServices.esTreeNodeToTSNodeMap.get(node); const leftTsNode = parserServices.esTreeNodeToTSNodeMap.get(leftNode); - const operator = isBinaryExpression(logicalTsNode) + const operator = ts.isBinaryExpression(logicalTsNode) ? logicalTsNode.operatorToken.kind : ts.SyntaxKind.Unknown; const leftPrecedence = util.getOperatorPrecedence( @@ -88,11 +140,11 @@ export default util.createRule({ } context.report({ node: parentNode, - messageId: 'optionalChainSuggest', + messageId: 'preferOptionalChain', suggest: [ { messageId: 'optionalChainSuggest', - fix: (fixer): TSESLint.RuleFix => { + fix: (fixer): RuleFix => { const leftNodeText = sourceCode.getText(leftNode); // Any node that is made of an operator with higher or equal precedence, const maybeWrappedLeftNode = isLeftSideLowerPrecedence() @@ -113,558 +165,53 @@ export default util.createRule({ ], }); }, - [[ - 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > Identifier', - 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > MemberExpression', - 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > ChainExpression > MemberExpression', - 'LogicalExpression[operator="||"] > UnaryExpression[operator="!"] > MetaProperty', - ].join(',')]( - initialIdentifierOrNotEqualsExpr: - | TSESTree.Identifier - | TSESTree.MemberExpression - | TSESTree.MetaProperty, - ): void { - // selector guarantees this cast - const initialExpression = ( - initialIdentifierOrNotEqualsExpr.parent!.type === - AST_NODE_TYPES.ChainExpression - ? initialIdentifierOrNotEqualsExpr.parent.parent - : initialIdentifierOrNotEqualsExpr.parent - )!.parent as TSESTree.LogicalExpression; - - if ( - initialExpression.left.type !== AST_NODE_TYPES.UnaryExpression || - initialExpression.left.argument !== initialIdentifierOrNotEqualsExpr - ) { - // the node(identifier or member expression) is not the deepest left node - return; - } - - // walk up the tree to figure out how many logical expressions we can include - let previous: TSESTree.LogicalExpression = initialExpression; - let current: TSESTree.Node = initialExpression; - let previousLeftText = getText(initialIdentifierOrNotEqualsExpr); - let optionallyChainedCode = previousLeftText; - let expressionCount = 1; - while (current.type === AST_NODE_TYPES.LogicalExpression) { - if ( - current.right.type !== AST_NODE_TYPES.UnaryExpression || - !isValidChainTarget( - current.right.argument, - // only allow unary '!' with identifiers for the first chain - !foo || !foo() - expressionCount === 1, - ) - ) { - break; - } - const { rightText, shouldBreak } = breakIfInvalid({ - rightNode: current.right.argument, - previousLeftText, - }); - if (shouldBreak) { - break; - } - let invalidOptionallyChainedPrivateProperty; - ({ - invalidOptionallyChainedPrivateProperty, - expressionCount, - previousLeftText, - optionallyChainedCode, - previous, - current, - } = normalizeRepeatingPatterns( - rightText, - expressionCount, - previousLeftText, - optionallyChainedCode, - previous, - current, - )); - if (invalidOptionallyChainedPrivateProperty) { - return; - } - } - - reportIfMoreThanOne({ - expressionCount, - previous, - optionallyChainedCode, - sourceCode, - context, - shouldHandleChainedAnds: false, - }); - }, - [[ - 'LogicalExpression[operator="&&"] > Identifier', - 'LogicalExpression[operator="&&"] > MemberExpression', - 'LogicalExpression[operator="&&"] > ChainExpression > MemberExpression', - 'LogicalExpression[operator="&&"] > MetaProperty', - 'LogicalExpression[operator="&&"] > BinaryExpression[operator="!=="]', - 'LogicalExpression[operator="&&"] > BinaryExpression[operator="!="]', - ].join(',')]( - initialIdentifierOrNotEqualsExpr: - | TSESTree.BinaryExpression - | TSESTree.Identifier - | TSESTree.MemberExpression - | TSESTree.MetaProperty, + 'LogicalExpression[operator!="??"]'( + node: TSESTree.LogicalExpression, ): void { - // selector guarantees this cast - const initialExpression = ( - initialIdentifierOrNotEqualsExpr.parent?.type === - AST_NODE_TYPES.ChainExpression - ? initialIdentifierOrNotEqualsExpr.parent.parent - : initialIdentifierOrNotEqualsExpr.parent - ) as TSESTree.LogicalExpression; - - if (initialExpression.left !== initialIdentifierOrNotEqualsExpr) { - // the node(identifier or member expression) is not the deepest left node - return; - } - if (!isValidChainTarget(initialIdentifierOrNotEqualsExpr, true)) { + if (seenLogicals.has(node)) { return; } - // walk up the tree to figure out how many logical expressions we can include - let previous: TSESTree.LogicalExpression = initialExpression; - let current: TSESTree.Node = initialExpression; - let previousLeftText = getText(initialIdentifierOrNotEqualsExpr); - let optionallyChainedCode = previousLeftText; - let expressionCount = 1; - while (current.type === AST_NODE_TYPES.LogicalExpression) { - if ( - !isValidChainTarget( - current.right, - // only allow identifiers for the first chain - foo && foo() - expressionCount === 1, - ) - ) { - break; - } - const { rightText, shouldBreak } = breakIfInvalid({ - rightNode: current.right, - previousLeftText, - }); - if (shouldBreak) { - break; - } - - let invalidOptionallyChainedPrivateProperty; - ({ - invalidOptionallyChainedPrivateProperty, - expressionCount, - previousLeftText, - optionallyChainedCode, - previous, - current, - } = normalizeRepeatingPatterns( - rightText, - expressionCount, - previousLeftText, - optionallyChainedCode, - previous, - current, - )); - if (invalidOptionallyChainedPrivateProperty) { - return; - } - } - - reportIfMoreThanOne({ - expressionCount, - previous, - optionallyChainedCode, - sourceCode, - context, - shouldHandleChainedAnds: true, - }); - }, - }; - - interface BreakIfInvalidResult { - leftText: string; - rightText: string; - shouldBreak: boolean; - } - - interface BreakIfInvalidOptions { - previousLeftText: string; - rightNode: ValidChainTarget; - } - - function breakIfInvalid({ - previousLeftText, - rightNode, - }: BreakIfInvalidOptions): BreakIfInvalidResult { - let shouldBreak = false; - - const rightText = getText(rightNode); - // can't just use startsWith because of cases like foo && fooBar.baz; - const matchRegex = new RegExp( - `^${ - // escape regex characters - previousLeftText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - }[^a-zA-Z0-9_$]`, - ); - if ( - !matchRegex.test(rightText) && - // handle redundant cases like foo.bar && foo.bar - previousLeftText !== rightText - ) { - shouldBreak = true; - } - return { shouldBreak, leftText: previousLeftText, rightText }; - } - - function getText(node: ValidChainTarget): string { - if (node.type === AST_NODE_TYPES.BinaryExpression) { - return getText( - // isValidChainTarget ensures this is type safe - node.left as ValidChainTarget, - ); - } - - if (node.type === AST_NODE_TYPES.CallExpression) { - const calleeText = getText( - // isValidChainTarget ensures this is type safe - node.callee as ValidChainTarget, - ); - - // ensure that the call arguments are left untouched, or else we can break cases that _need_ whitespace: - // - JSX: - // - Unary Operators: typeof foo, await bar, delete baz - const closingParenToken = util.nullThrows( - sourceCode.getLastToken(node), - util.NullThrowsReasons.MissingToken('closing parenthesis', node.type), + const { operands, newlySeenLogicals } = gatherLogicalOperands( + node, + parserServices, + options, ); - const openingParenToken = util.nullThrows( - sourceCode.getFirstTokenBetween( - node.callee, - closingParenToken, - util.isOpeningParenToken, - ), - util.NullThrowsReasons.MissingToken('opening parenthesis', node.type), - ); - - const argumentsText = sourceCode.text.substring( - openingParenToken.range[0], - closingParenToken.range[1], - ); - - return `${calleeText}${argumentsText}`; - } - - if ( - node.type === AST_NODE_TYPES.Identifier || - node.type === AST_NODE_TYPES.PrivateIdentifier - ) { - return node.name; - } - - if (node.type === AST_NODE_TYPES.MetaProperty) { - return `${node.meta.name}.${node.property.name}`; - } - if (node.type === AST_NODE_TYPES.ThisExpression) { - return 'this'; - } - - if (node.type === AST_NODE_TYPES.ChainExpression) { - /* istanbul ignore if */ if ( - node.expression.type === AST_NODE_TYPES.TSNonNullExpression - ) { - // this shouldn't happen - return ''; + for (const logical of newlySeenLogicals) { + seenLogicals.add(logical); } - return getText(node.expression); - } - - if (node.object.type === AST_NODE_TYPES.TSNonNullExpression) { - // Not supported mixing with TSNonNullExpression - return ''; - } - - return getMemberExpressionText(node); - } - - /** - * Gets a normalized representation of the given MemberExpression - */ - function getMemberExpressionText(node: TSESTree.MemberExpression): string { - let objectText: string; - // cases should match the list in ALLOWED_MEMBER_OBJECT_TYPES - switch (node.object.type) { - case AST_NODE_TYPES.MemberExpression: - objectText = getMemberExpressionText(node.object); - break; - - case AST_NODE_TYPES.CallExpression: - case AST_NODE_TYPES.Identifier: - case AST_NODE_TYPES.MetaProperty: - case AST_NODE_TYPES.ThisExpression: - objectText = getText(node.object); - break; - - /* istanbul ignore next */ - default: - return ''; - } - - let propertyText: string; - if (node.computed) { - // cases should match the list in ALLOWED_COMPUTED_PROP_TYPES - switch (node.property.type) { - case AST_NODE_TYPES.Identifier: - propertyText = getText(node.property); - break; - - case AST_NODE_TYPES.Literal: - case AST_NODE_TYPES.TemplateLiteral: - case AST_NODE_TYPES.BinaryExpression: - propertyText = sourceCode.getText(node.property); - break; - - case AST_NODE_TYPES.MemberExpression: - propertyText = getMemberExpressionText(node.property); - break; - - /* istanbul ignore next */ - default: - return ''; + let currentChain: ValidOperand[] = []; + for (const operand of operands) { + if (operand.type === OperandValidity.Invalid) { + analyzeChain( + context, + sourceCode, + parserServices, + options, + node.operator, + currentChain, + ); + currentChain = []; + } else { + currentChain.push(operand); + } } - return `${objectText}${node.optional ? '?.' : ''}[${propertyText}]`; - } else { - // cases should match the list in ALLOWED_NON_COMPUTED_PROP_TYPES - switch (node.property.type) { - case AST_NODE_TYPES.Identifier: - propertyText = getText(node.property); - break; - case AST_NODE_TYPES.PrivateIdentifier: - propertyText = '#' + getText(node.property); - break; - - default: - propertyText = sourceCode.getText(node.property); + // make sure to check whatever's left + if (currentChain.length > 0) { + analyzeChain( + context, + sourceCode, + parserServices, + options, + node.operator, + currentChain, + ); } - - return `${objectText}${node.optional ? '?.' : '.'}${propertyText}`; - } - } + }, + }; }, }); - -const ALLOWED_MEMBER_OBJECT_TYPES: ReadonlySet = new Set([ - AST_NODE_TYPES.CallExpression, - AST_NODE_TYPES.Identifier, - AST_NODE_TYPES.MemberExpression, - AST_NODE_TYPES.ThisExpression, - AST_NODE_TYPES.MetaProperty, -]); -const ALLOWED_COMPUTED_PROP_TYPES: ReadonlySet = new Set([ - AST_NODE_TYPES.Identifier, - AST_NODE_TYPES.Literal, - AST_NODE_TYPES.MemberExpression, - AST_NODE_TYPES.TemplateLiteral, -]); -const ALLOWED_NON_COMPUTED_PROP_TYPES: ReadonlySet = new Set([ - AST_NODE_TYPES.Identifier, - AST_NODE_TYPES.PrivateIdentifier, -]); - -interface ReportIfMoreThanOneOptions { - expressionCount: number; - previous: TSESTree.LogicalExpression; - optionallyChainedCode: string; - sourceCode: Readonly; - context: Readonly< - TSESLint.RuleContext< - 'preferOptionalChain' | 'optionalChainSuggest', - never[] - > - >; - shouldHandleChainedAnds: boolean; -} - -function reportIfMoreThanOne({ - expressionCount, - previous, - optionallyChainedCode, - sourceCode, - context, - shouldHandleChainedAnds, -}: ReportIfMoreThanOneOptions): void { - if (expressionCount > 1) { - if ( - shouldHandleChainedAnds && - previous.right.type === AST_NODE_TYPES.BinaryExpression - ) { - let operator = previous.right.operator; - if ( - previous.right.operator === '!==' && - // TODO(#4820): Use the type checker to know whether this is `null` - previous.right.right.type === AST_NODE_TYPES.Literal && - previous.right.right.raw === 'null' - ) { - // case like foo !== null && foo.bar !== null - operator = '!='; - } - // case like foo && foo.bar !== someValue - optionallyChainedCode += ` ${operator} ${sourceCode.getText( - previous.right.right, - )}`; - } - - context.report({ - node: previous, - messageId: 'preferOptionalChain', - suggest: [ - { - messageId: 'optionalChainSuggest', - fix: (fixer): TSESLint.RuleFix[] => [ - fixer.replaceText( - previous, - `${shouldHandleChainedAnds ? '' : '!'}${optionallyChainedCode}`, - ), - ], - }, - ], - }); - } -} - -interface NormalizedPattern { - invalidOptionallyChainedPrivateProperty: boolean; - expressionCount: number; - previousLeftText: string; - optionallyChainedCode: string; - previous: TSESTree.LogicalExpression; - current: TSESTree.Node; -} - -function normalizeRepeatingPatterns( - rightText: string, - expressionCount: number, - previousLeftText: string, - optionallyChainedCode: string, - previous: TSESTree.Node, - current: TSESTree.Node, -): NormalizedPattern { - const leftText = previousLeftText; - let invalidOptionallyChainedPrivateProperty = false; - // omit weird doubled up expression that make no sense like foo.bar && foo.bar - if (rightText !== previousLeftText) { - expressionCount += 1; - previousLeftText = rightText; - - /* - Diff the left and right text to construct the fix string - There are the following cases: - - 1) - rightText === 'foo.bar.baz.buzz' - leftText === 'foo.bar.baz' - diff === '.buzz' - - 2) - rightText === 'foo.bar.baz.buzz()' - leftText === 'foo.bar.baz' - diff === '.buzz()' - - 3) - rightText === 'foo.bar.baz.buzz()' - leftText === 'foo.bar.baz.buzz' - diff === '()' - - 4) - rightText === 'foo.bar.baz[buzz]' - leftText === 'foo.bar.baz' - diff === '[buzz]' - - 5) - rightText === 'foo.bar.baz?.buzz' - leftText === 'foo.bar.baz' - diff === '?.buzz' - */ - const diff = rightText.replace(leftText, ''); - if (diff.startsWith('.#')) { - // Do not handle direct optional chaining on private properties because of a typescript bug (https://github.com/microsoft/TypeScript/issues/42734) - // We still allow in computed properties - invalidOptionallyChainedPrivateProperty = true; - } - if (diff.startsWith('?')) { - // item was "pre optional chained" - optionallyChainedCode += diff; - } else { - const needsDot = diff.startsWith('(') || diff.startsWith('['); - optionallyChainedCode += `?${needsDot ? '.' : ''}${diff}`; - } - } - - previous = current as TSESTree.LogicalExpression; - current = util.nullThrows( - current.parent, - util.NullThrowsReasons.MissingParent, - ); - return { - invalidOptionallyChainedPrivateProperty, - expressionCount, - previousLeftText, - optionallyChainedCode, - previous, - current, - }; -} - -function isValidChainTarget( - node: TSESTree.Node, - allowIdentifier: boolean, -): node is ValidChainTarget { - if (node.type === AST_NODE_TYPES.ChainExpression) { - return isValidChainTarget(node.expression, allowIdentifier); - } - - if (node.type === AST_NODE_TYPES.MemberExpression) { - const isObjectValid = - ALLOWED_MEMBER_OBJECT_TYPES.has(node.object.type) && - // make sure to validate the expression is of our expected structure - isValidChainTarget(node.object, true); - const isPropertyValid = node.computed - ? ALLOWED_COMPUTED_PROP_TYPES.has(node.property.type) && - // make sure to validate the member expression is of our expected structure - (node.property.type === AST_NODE_TYPES.MemberExpression - ? isValidChainTarget(node.property, allowIdentifier) - : true) - : ALLOWED_NON_COMPUTED_PROP_TYPES.has(node.property.type); - - return isObjectValid && isPropertyValid; - } - - if (node.type === AST_NODE_TYPES.CallExpression) { - return isValidChainTarget(node.callee, allowIdentifier); - } - - if ( - allowIdentifier && - (node.type === AST_NODE_TYPES.Identifier || - node.type === AST_NODE_TYPES.ThisExpression || - node.type === AST_NODE_TYPES.MetaProperty) - ) { - return true; - } - - /* - special case for the following, where we only want the left - - foo !== null - - foo != null - - foo !== undefined - - foo != undefined - */ - return ( - node.type === AST_NODE_TYPES.BinaryExpression && - ['!==', '!='].includes(node.operator) && - isValidChainTarget(node.left, allowIdentifier) && - (util.isUndefinedIdentifier(node.right) || util.isNullLiteral(node.right)) - ); -} diff --git a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts index 4ba01de52b2..e22ab9885e4 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly-parameter-types.ts @@ -5,9 +5,11 @@ import * as util from '../util'; type Options = [ { + allow?: util.TypeOrValueSpecifier[]; checkParameterProperties?: boolean; ignoreInferredTypes?: boolean; - } & util.ReadonlynessOptions, + treatMethodsAsReadonly?: boolean; + }, ]; type MessageIds = 'shouldBeReadonly'; @@ -18,7 +20,6 @@ export default util.createRule({ docs: { description: 'Require function parameters to be typed as `readonly` to prevent accidental mutation of inputs', - recommended: false, requiresTypeChecking: true, }, schema: [ @@ -26,13 +27,15 @@ export default util.createRule({ type: 'object', additionalProperties: false, properties: { + allow: util.readonlynessOptionsSchema.properties.allow, checkParameterProperties: { type: 'boolean', }, ignoreInferredTypes: { type: 'boolean', }, - ...util.readonlynessOptionsSchema.properties, + treatMethodsAsReadonly: + util.readonlynessOptionsSchema.properties.treatMethodsAsReadonly, }, }, ], @@ -42,17 +45,25 @@ export default util.createRule({ }, defaultOptions: [ { + allow: util.readonlynessOptionsDefaults.allow, checkParameterProperties: true, ignoreInferredTypes: false, - ...util.readonlynessOptionsDefaults, + treatMethodsAsReadonly: + util.readonlynessOptionsDefaults.treatMethodsAsReadonly, }, ], create( context, - [{ checkParameterProperties, ignoreInferredTypes, treatMethodsAsReadonly }], + [ + { + allow, + checkParameterProperties, + ignoreInferredTypes, + treatMethodsAsReadonly, + }, + ], ) { - const { esTreeNodeToTSNodeMap, program } = util.getParserServices(context); - const checker = program.getTypeChecker(); + const services = util.getParserServices(context); return { [[ @@ -94,10 +105,10 @@ export default util.createRule({ continue; } - const tsNode = esTreeNodeToTSNodeMap.get(actualParam); - const type = checker.getTypeAtLocation(tsNode); - const isReadOnly = util.isTypeReadonly(checker, type, { + const type = services.getTypeAtLocation(actualParam); + const isReadOnly = util.isTypeReadonly(services.program, type, { treatMethodsAsReadonly: treatMethodsAsReadonly!, + allow, }); if (!isReadOnly) { diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 3a9e6cdca66..713a703a56f 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -26,7 +26,6 @@ export default util.createRule({ docs: { description: "Require private members to be marked as `readonly` if they're never modified outside of the constructor", - recommended: false, requiresTypeChecking: true, }, fixable: 'code', @@ -36,7 +35,7 @@ export default util.createRule({ }, schema: [ { - allowAdditionalProperties: false, + additionalProperties: false, properties: { onlyInlineLambdas: { type: 'boolean', @@ -49,8 +48,8 @@ export default util.createRule({ }, defaultOptions: [{ onlyInlineLambdas: false }], create(context, [{ onlyInlineLambdas }]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const classScopeStack: ClassScope[] = []; function handlePropertyAccessExpression( @@ -141,12 +140,12 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression | TSESTree.MethodDefinition, - ): boolean | tsutils.ScopeBoundary { + ): boolean { if (classScopeStack.length === 0) { return false; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); if (ts.isConstructorDeclaration(tsNode)) { return false; } @@ -161,16 +160,14 @@ export default util.createRule({ ts.isParameterPropertyDeclaration(violatingNode, violatingNode.parent) ) { return { - esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), - nameNode: parserServices.tsNodeToESTreeNodeMap.get( - violatingNode.name, - ), + esNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name), + nameNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name), }; } return { - esNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode), - nameNode: parserServices.tsNodeToESTreeNodeMap.get(violatingNode.name), + esNode: services.tsNodeToESTreeNodeMap.get(violatingNode), + nameNode: services.tsNodeToESTreeNodeMap.get(violatingNode.name), }; } @@ -181,7 +178,7 @@ export default util.createRule({ classScopeStack.push( new ClassScope( checker, - parserServices.esTreeNodeToTSNodeMap.get(node), + services.esTreeNodeToTSNodeMap.get(node), onlyInlineLambdas, ), ); @@ -205,7 +202,7 @@ export default util.createRule({ }, MemberExpression(node): void { if (classScopeStack.length !== 0 && !node.computed) { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get( + const tsNode = services.esTreeNodeToTSNodeMap.get( node, ) as ts.PropertyAccessExpression; handlePropertyAccessExpression( @@ -224,7 +221,7 @@ export default util.createRule({ ): void { if (ASTUtils.isConstructor(node)) { classScopeStack[classScopeStack.length - 1].enterConstructor( - parserServices.esTreeNodeToTSNodeMap.get(node), + services.esTreeNodeToTSNodeMap.get(node), ); } else if (isFunctionScopeBoundaryInStack(node)) { classScopeStack[classScopeStack.length - 1].enterNonConstructor(); @@ -339,10 +336,10 @@ class ClassScope { public enterConstructor( node: + | ts.ConstructorDeclaration | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration | ts.MethodDeclaration - | ts.ConstructorDeclaration, + | ts.SetAccessorDeclaration, ): void { this.constructorScopeDepth = DIRECTLY_INSIDE_CONSTRUCTOR; diff --git a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts index 7d27a014653..8c966eeea97 100644 --- a/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts +++ b/packages/eslint-plugin/src/rules/prefer-reduce-type-parameter.ts @@ -43,8 +43,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const service = util.getParserServices(context); - const checker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); return { 'CallExpression > MemberExpression.callee'( @@ -64,10 +64,9 @@ export default util.createRule({ } // Get the symbol of the `reduce` method. - const tsNode = service.esTreeNodeToTSNodeMap.get(callee.object); const calleeObjType = util.getConstrainedTypeAtLocation( - checker, - tsNode, + services, + callee.object, ); // Check the owner type of the `reduce` method. @@ -87,7 +86,7 @@ export default util.createRule({ ]), ]; - if (!callee.parent.typeParameters) { + if (!callee.parent.typeArguments) { fixes.push( fixer.insertTextAfter( callee, diff --git a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts index 60bf310947f..8e61a735c13 100644 --- a/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts +++ b/packages/eslint-plugin/src/rules/prefer-regexp-exec.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import type * as ts from 'typescript'; import { @@ -28,7 +28,6 @@ export default createRule({ docs: { description: 'Enforce `RegExp#exec` over `String#match` if no global flag is provided', - recommended: false, requiresTypeChecking: true, }, messages: { @@ -39,8 +38,8 @@ export default createRule({ create(context) { const globalScope = context.getScope(); - const parserServices = getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); /** @@ -48,7 +47,7 @@ export default createRule({ * @param node The node type to check. */ function isStringType(type: ts.Type): boolean { - return getTypeName(typeChecker, type) === 'string'; + return getTypeName(checker, type) === 'string'; } /** @@ -56,7 +55,7 @@ export default createRule({ * @param node The node type to check. */ function isRegExpType(type: ts.Type): boolean { - return getTypeName(typeChecker, type) === 'RegExp'; + return getTypeName(checker, type) === 'RegExp'; } function collectArgumentTypes(types: ts.Type[]): ArgumentType { @@ -101,13 +100,7 @@ export default createRule({ const [argumentNode] = callNode.arguments; const argumentValue = getStaticValue(argumentNode, globalScope); - if ( - !isStringType( - typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(objectNode), - ), - ) - ) { + if (!isStringType(services.getTypeAtLocation(objectNode))) { return; } @@ -125,7 +118,12 @@ export default createRule({ argumentNode.type === AST_NODE_TYPES.Literal && typeof argumentNode.value === 'string' ) { - const regExp = RegExp(argumentNode.value); + let regExp: RegExp; + try { + regExp = RegExp(argumentNode.value); + } catch { + return; + } return context.report({ node: memberNode.property, messageId: 'regExpExecOverStringMatch', @@ -138,9 +136,7 @@ export default createRule({ }); } - const argumentType = typeChecker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(argumentNode), - ); + const argumentType = services.getTypeAtLocation(argumentNode); const argumentTypes = collectArgumentTypes( tsutils.unionTypeParts(argumentType), ); diff --git a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts index 59a5c85b2bd..bc8375d7a7d 100644 --- a/packages/eslint-plugin/src/rules/prefer-return-this-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-return-this-type.ts @@ -9,8 +9,8 @@ type ClassLikeDeclaration = | TSESTree.ClassExpression; type FunctionLike = - | TSESTree.MethodDefinition['value'] - | TSESTree.ArrowFunctionExpression; + | TSESTree.ArrowFunctionExpression + | TSESTree.MethodDefinition['value']; export default createRule({ name: 'prefer-return-this-type', @@ -32,8 +32,8 @@ export default createRule({ }, create(context) { - const parserServices = getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); function tryGetNameInType( name: string, @@ -76,14 +76,14 @@ export default createRule({ return false; } - const func = parserServices.esTreeNodeToTSNodeMap.get(originalFunc); + const func = services.esTreeNodeToTSNodeMap.get(originalFunc); if (!func.body) { return false; } - const classType = checker.getTypeAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(originalClass), + const classType = services.getTypeAtLocation( + originalClass, ) as ts.InterfaceType; if (func.body.kind !== ts.SyntaxKind.Block) { @@ -151,7 +151,7 @@ export default createRule({ return { 'ClassBody > MethodDefinition'(node: TSESTree.MethodDefinition): void { - checkFunction(node.value, node.parent!.parent as ClassLikeDeclaration); + checkFunction(node.value, node.parent.parent as ClassLikeDeclaration); }, 'ClassBody > PropertyDefinition'( node: TSESTree.PropertyDefinition, @@ -165,7 +165,7 @@ export default createRule({ return; } - checkFunction(node.value, node.parent!.parent as ClassLikeDeclaration); + checkFunction(node.value, node.parent.parent as ClassLikeDeclaration); }, }; }, diff --git a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts index 6548468430c..d6afab60146 100644 --- a/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts +++ b/packages/eslint-plugin/src/rules/prefer-string-starts-ends-with.ts @@ -26,7 +26,7 @@ export default createRule({ docs: { description: 'Enforce using `String#startsWith` and `String#endsWith` over other equivalent methods of checking substrings', - recommended: 'strict', + recommended: 'stylistic', requiresTypeChecking: true, }, messages: { @@ -40,18 +40,16 @@ export default createRule({ create(context) { const globalScope = context.getScope(); const sourceCode = context.getSourceCode(); - const service = getParserServices(context); - const typeChecker = service.program.getTypeChecker(); + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); /** * Check if a given node is a string. * @param node The node to check. */ function isStringType(node: TSESTree.Expression): boolean { - const objectType = typeChecker.getTypeAtLocation( - service.esTreeNodeToTSNodeMap.get(node), - ); - return getTypeName(typeChecker, objectType) === 'string'; + const objectType = services.getTypeAtLocation(node); + return getTypeName(checker, objectType) === 'string'; } /** @@ -317,7 +315,7 @@ export default createRule({ function* fixWithRightOperand( fixer: TSESLint.RuleFixer, node: TSESTree.BinaryExpression, - kind: 'start' | 'end', + kind: 'end' | 'start', isNegative: boolean, isOptional: boolean, ): IterableIterator { @@ -348,7 +346,7 @@ export default createRule({ node: TSESTree.BinaryExpression, callNode: TSESTree.CallExpression, calleeNode: TSESTree.MemberExpression, - kind: 'start' | 'end', + kind: 'end' | 'start', negative: boolean, isOptional: boolean, ): IterableIterator { diff --git a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts index 55b5d2c56eb..8ef1c7ad927 100644 --- a/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts +++ b/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts @@ -1,9 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; -import type { - RuleFix, - RuleFixer, -} from '@typescript-eslint/utils/dist/ts-eslint'; +import type { RuleFix, RuleFixer } from '@typescript-eslint/utils/ts-eslint'; import * as util from '../util'; diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 34fbc7ee672..ba671d5929b 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -24,7 +24,6 @@ export default util.createRule({ docs: { description: 'Require any function or method that returns a Promise to be marked async', - recommended: false, requiresTypeChecking: true, }, messages: { @@ -91,8 +90,8 @@ export default util.createRule({ 'Promise', ...allowedPromiseNames!, ]); - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); function validateNode( @@ -101,10 +100,7 @@ export default util.createRule({ | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, ): void { - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const signatures = checker - .getTypeAtLocation(originalNode) - .getCallSignatures(); + const signatures = services.getTypeAtLocation(node).getCallSignatures(); if (!signatures.length) { return; } @@ -123,13 +119,12 @@ export default util.createRule({ return; } - if (node.parent?.type === AST_NODE_TYPES.TSAbstractMethodDefinition) { + if (node.parent.type === AST_NODE_TYPES.TSAbstractMethodDefinition) { // Abstract method can't be async return; } if ( - node.parent && (node.parent.type === AST_NODE_TYPES.Property || node.parent.type === AST_NODE_TYPES.MethodDefinition) && (node.parent.kind === 'get' || node.parent.kind === 'set') @@ -155,10 +150,8 @@ export default util.createRule({ loc: util.getFunctionHeadLoc(node, sourceCode), fix: fixer => { if ( - node.parent && - (node.parent.type === AST_NODE_TYPES.MethodDefinition || - (node.parent.type === AST_NODE_TYPES.Property && - node.parent.method)) + node.parent.type === AST_NODE_TYPES.MethodDefinition || + (node.parent.type === AST_NODE_TYPES.Property && node.parent.method) ) { // this function is a class method or object function property shorthand const method = node.parent; @@ -169,7 +162,7 @@ export default util.createRule({ // if there are decorators then skip past them if ( method.type === AST_NODE_TYPES.MethodDefinition && - method.decorators + method.decorators.length ) { const lastDecorator = method.decorators[method.decorators.length - 1]; @@ -221,7 +214,6 @@ export default util.createRule({ node: TSESTree.FunctionExpression, ): void { if ( - node.parent && node.parent.type === AST_NODE_TYPES.MethodDefinition && node.parent.kind === 'method' ) { diff --git a/packages/eslint-plugin/src/rules/quotes.ts b/packages/eslint-plugin/src/rules/quotes.ts index 4a23e9632d7..b5f2f7f57b0 100644 --- a/packages/eslint-plugin/src/rules/quotes.ts +++ b/packages/eslint-plugin/src/rules/quotes.ts @@ -16,15 +16,11 @@ export default util.createRule({ docs: { description: 'Enforce the consistent use of either backticks, double, or single quotes', - recommended: false, extendsBaseRule: true, }, fixable: 'code', hasSuggestions: baseRule.meta.hasSuggestions, - // TODO: this rule has only had messages since v7.0 - remove this when we remove support for v6 - messages: baseRule.meta.messages ?? { - wrongQuotes: 'Strings must use {{description}}.', - }, + messages: baseRule.meta.messages, schema: baseRule.meta.schema, }, defaultOptions: [ diff --git a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts index aafd46e690d..a3617894ee7 100644 --- a/packages/eslint-plugin/src/rules/require-array-sort-compare.ts +++ b/packages/eslint-plugin/src/rules/require-array-sort-compare.ts @@ -13,7 +13,7 @@ export default util.createRule({ name: 'require-array-sort-compare', defaultOptions: [ { - ignoreStringArrays: false, + ignoreStringArrays: true, }, ], @@ -22,7 +22,6 @@ export default util.createRule({ docs: { description: 'Require `Array#sort` calls to always provide a `compareFunction`', - recommended: false, requiresTypeChecking: true, }, messages: { @@ -31,6 +30,7 @@ export default util.createRule({ schema: [ { type: 'object', + additionalProperties: false, properties: { ignoreStringArrays: { description: @@ -43,19 +43,18 @@ export default util.createRule({ }, create(context, [options]) { - const service = util.getParserServices(context); - const checker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); /** * Check if a given node is an array which all elements are string. * @param node */ function isStringArrayNode(node: TSESTree.Expression): boolean { - const type = checker.getTypeAtLocation( - service.esTreeNodeToTSNodeMap.get(node), - ); + const type = services.getTypeAtLocation(node); + if (checker.isArrayType(type) || checker.isTupleType(type)) { - const typeArgs = checker.getTypeArguments(type); + const typeArgs = util.getTypeArguments(type, checker); return typeArgs.every( arg => util.getTypeName(checker, arg) === 'string', ); @@ -67,10 +66,9 @@ export default util.createRule({ "CallExpression[arguments.length=0] > MemberExpression[property.name='sort'][computed=false]"( callee: TSESTree.MemberExpression, ): void { - const tsNode = service.esTreeNodeToTSNodeMap.get(callee.object); const calleeObjType = util.getConstrainedTypeAtLocation( - checker, - tsNode, + services, + callee.object, ); if (options.ignoreStringArrays && isStringArrayNode(callee.object)) { @@ -78,7 +76,7 @@ export default util.createRule({ } if (util.isTypeArrayTypeOrUnionOfArrayTypes(calleeObjType, checker)) { - context.report({ node: callee.parent!, messageId: 'requireCompare' }); + context.report({ node: callee.parent, messageId: 'requireCompare' }); } }, }; diff --git a/packages/eslint-plugin/src/rules/require-await.ts b/packages/eslint-plugin/src/rules/require-await.ts index 076cd6077a0..de3624ecbf7 100644 --- a/packages/eslint-plugin/src/rules/require-await.ts +++ b/packages/eslint-plugin/src/rules/require-await.ts @@ -1,6 +1,6 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import type * as ts from 'typescript'; import * as util from '../util'; @@ -13,9 +13,9 @@ interface ScopeInfo { isAsyncYield: boolean; } type FunctionNode = + | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression; + | TSESTree.FunctionExpression; export default util.createRule({ name: 'require-await', @@ -23,7 +23,7 @@ export default util.createRule({ type: 'suggestion', docs: { description: 'Disallow async functions which have no `await` expression', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, extendsBaseRule: true, }, @@ -34,8 +34,8 @@ export default util.createRule({ }, defaultOptions: [], create(context) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); let scopeInfo: ScopeInfo | null = null; @@ -110,14 +110,13 @@ export default util.createRule({ return; } - if (node?.argument?.type === AST_NODE_TYPES.Literal) { + if (node.argument.type === AST_NODE_TYPES.Literal) { // making this `false` as for literals we don't need to check the definition // eg : async function* run() { yield* 1 } scopeInfo.isAsyncYield ||= false; } - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node?.argument); - const type = checker.getTypeAtLocation(tsNode); + const type = services.getTypeAtLocation(node.argument); const typesToCheck = expandUnionOrIntersectionType(type); for (const type of typesToCheck) { const asyncIterator = tsutils.getWellKnownSymbolPropertyOfType( @@ -149,10 +148,10 @@ export default util.createRule({ 'ArrowFunctionExpression[async = true] > :not(BlockStatement, AwaitExpression)'( node: Exclude< TSESTree.Node, - TSESTree.BlockStatement | TSESTree.AwaitExpression + TSESTree.AwaitExpression | TSESTree.BlockStatement >, ): void { - const expression = parserServices.esTreeNodeToTSNodeMap.get(node); + const expression = services.esTreeNodeToTSNodeMap.get(node); if (expression && isThenableType(expression)) { markAsHasAwait(); } @@ -163,7 +162,7 @@ export default util.createRule({ return; } - const { expression } = parserServices.esTreeNodeToTSNodeMap.get(node); + const { expression } = services.esTreeNodeToTSNodeMap.get(node); if (expression && isThenableType(expression)) { markAsHasAwait(); } diff --git a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts index ad5d0a832b7..6d2cc2222ea 100644 --- a/packages/eslint-plugin/src/rules/restrict-plus-operands.ts +++ b/packages/eslint-plugin/src/rules/restrict-plus-operands.ts @@ -1,20 +1,21 @@ import type { TSESTree } from '@typescript-eslint/utils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; type Options = [ { - checkCompoundAssignments?: boolean; allowAny?: boolean; + allowBoolean?: boolean; + allowNullish?: boolean; + allowNumberAndString?: boolean; + allowRegExp?: boolean; + skipCompoundAssignments?: boolean; }, ]; -type MessageIds = - | 'notNumbers' - | 'notStrings' - | 'notBigInts' - | 'notValidAnys' - | 'notValidTypes'; + +type MessageIds = 'bigintAndNumber' | 'invalid' | 'mismatched'; export default util.createRule({ name: 'restrict-plus-operands', @@ -23,176 +24,216 @@ export default util.createRule({ docs: { description: 'Require both operands of addition to be the same type and be `bigint`, `number`, or `string`', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { - notNumbers: - "Operands of '+' operation must either be both strings or both numbers.", - notStrings: - "Operands of '+' operation must either be both strings or both numbers. Consider using a template literal.", - notBigInts: "Operands of '+' operation must be both bigints.", - notValidAnys: - "Operands of '+' operation with any is possible only with string, number, bigint or any", - notValidTypes: - "Operands of '+' operation must either be one of string, number, bigint or any (if allowed by option)", + bigintAndNumber: + "Numeric '+' operations must either be both bigints or both numbers. Got `{{left}}` + `{{right}}`.", + invalid: + "Invalid operand for a '+' operation. Operands must each be a number or {{stringLike}}. Got `{{type}}`.", + mismatched: + "Operands of '+' operations must be a number or {{stringLike}}. Got `{{left}}` + `{{right}}`.", }, schema: [ { type: 'object', additionalProperties: false, properties: { - checkCompoundAssignments: { - description: 'Whether to check compound assignments such as `+=`.', - type: 'boolean', - }, allowAny: { description: 'Whether to allow `any` typed values.', type: 'boolean', }, + allowBoolean: { + description: 'Whether to allow `boolean` typed values.', + type: 'boolean', + }, + allowNullish: { + description: + 'Whether to allow potentially `null` or `undefined` typed values.', + type: 'boolean', + }, + allowNumberAndString: { + description: + 'Whether to allow `bigint`/`number` typed values and `string` typed values to be added together.', + type: 'boolean', + }, + allowRegExp: { + description: 'Whether to allow `regexp` typed values.', + type: 'boolean', + }, + skipCompoundAssignments: { + description: 'Whether to skip compound assignments such as `+=`.', + type: 'boolean', + }, }, }, ], }, defaultOptions: [ { - checkCompoundAssignments: false, - allowAny: false, + allowAny: true, + allowBoolean: true, + allowNullish: true, + allowNumberAndString: true, + allowRegExp: true, + skipCompoundAssignments: false, }, ], - create(context, [{ checkCompoundAssignments, allowAny }]) { - const service = util.getParserServices(context); - const typeChecker = service.program.getTypeChecker(); - - type BaseLiteral = 'string' | 'number' | 'bigint' | 'invalid' | 'any'; - - /** - * Helper function to get base type of node - */ - function getBaseTypeOfLiteralType(type: ts.Type): BaseLiteral { - if (type.isNumberLiteral()) { - return 'number'; - } - if ( - type.isStringLiteral() || - util.isTypeFlagSet(type, ts.TypeFlags.TemplateLiteral) - ) { - return 'string'; - } - // is BigIntLiteral - if (type.flags & ts.TypeFlags.BigIntLiteral) { - return 'bigint'; - } - if (type.isUnion()) { - const types = type.types.map(getBaseTypeOfLiteralType); - - return types.every(value => value === types[0]) ? types[0] : 'invalid'; - } - - if (type.isIntersection()) { - const types = type.types.map(getBaseTypeOfLiteralType); - - if (types.some(value => value === 'string')) { - return 'string'; - } - - if (types.some(value => value === 'number')) { - return 'number'; - } - - if (types.some(value => value === 'bigint')) { - return 'bigint'; - } - - return 'invalid'; - } + create( + context, + [ + { + allowAny, + allowBoolean, + allowNullish, + allowNumberAndString, + allowRegExp, + skipCompoundAssignments, + }, + ], + ) { + const services = util.getParserServices(context); + const typeChecker = services.program.getTypeChecker(); + + const stringLikes = [ + allowAny && '`any`', + allowBoolean && '`boolean`', + allowNullish && '`null`', + allowRegExp && '`RegExp`', + allowNullish && '`undefined`', + ].filter((value): value is string => typeof value === 'string'); + const stringLike = stringLikes.length + ? stringLikes.length === 1 + ? `string, allowing a string + ${stringLikes[0]}` + : `string, allowing a string + any of: ${stringLikes.join(', ')}` + : 'string'; + + function getTypeConstrained(node: TSESTree.Node): ts.Type { + return typeChecker.getBaseTypeOfLiteralType( + util.getConstrainedTypeAtLocation(services, node), + ); + } - const stringType = typeChecker.typeToString(type); + function checkPlusOperands( + node: TSESTree.AssignmentExpression | TSESTree.BinaryExpression, + ): void { + const leftType = getTypeConstrained(node.left); + const rightType = getTypeConstrained(node.right); if ( - stringType === 'number' || - stringType === 'string' || - stringType === 'bigint' || - stringType === 'any' + leftType === rightType && + tsutils.isTypeFlagSet( + leftType, + ts.TypeFlags.BigIntLike | + ts.TypeFlags.NumberLike | + ts.TypeFlags.StringLike, + ) ) { - return stringType; + return; } - return 'invalid'; - } - /** - * Helper function to get base type of node - * @param node the node to be evaluated. - */ - function getNodeType( - node: TSESTree.Expression | TSESTree.PrivateIdentifier, - ): BaseLiteral { - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(typeChecker, tsNode); - - return getBaseTypeOfLiteralType(type); - } - - function checkPlusOperands( - node: TSESTree.BinaryExpression | TSESTree.AssignmentExpression, - ): void { - const leftType = getNodeType(node.left); - const rightType = getNodeType(node.right); - - if (leftType === rightType) { - if (leftType === 'invalid') { + let hadIndividualComplaint = false; + + for (const [baseNode, baseType, otherType] of [ + [node.left, leftType, rightType], + [node.right, rightType, leftType], + ] as const) { + if ( + isTypeFlagSetInUnion( + baseType, + ts.TypeFlags.ESSymbolLike | + ts.TypeFlags.Never | + ts.TypeFlags.Unknown, + ) || + (!allowAny && isTypeFlagSetInUnion(baseType, ts.TypeFlags.Any)) || + (!allowBoolean && + isTypeFlagSetInUnion(baseType, ts.TypeFlags.BooleanLike)) || + (!allowNullish && + util.isTypeFlagSet( + baseType, + ts.TypeFlags.Null | ts.TypeFlags.Undefined, + )) + ) { context.report({ - node, - messageId: 'notValidTypes', + data: { + stringLike, + type: typeChecker.typeToString(baseType), + }, + messageId: 'invalid', + node: baseNode, }); + hadIndividualComplaint = true; + continue; } - if (!allowAny && leftType === 'any') { - context.report({ - node, - messageId: 'notValidAnys', - }); + // RegExps also contain ts.TypeFlags.Any & ts.TypeFlags.Object + for (const subBaseType of tsutils.unionTypeParts(baseType)) { + const typeName = util.getTypeName(typeChecker, subBaseType); + if ( + typeName === 'RegExp' + ? !allowRegExp || + tsutils.isTypeFlagSet(otherType, ts.TypeFlags.NumberLike) + : (!allowAny && util.isTypeAnyType(subBaseType)) || + isDeeplyObjectType(subBaseType) + ) { + context.report({ + data: { + stringLike, + type: typeChecker.typeToString(subBaseType), + }, + messageId: 'invalid', + node: baseNode, + }); + hadIndividualComplaint = true; + continue; + } } + } + if (hadIndividualComplaint) { return; } - if (leftType === 'any' || rightType === 'any') { - if (!allowAny || leftType === 'invalid' || rightType === 'invalid') { - context.report({ + for (const [baseType, otherType] of [ + [leftType, rightType], + [rightType, leftType], + ] as const) { + if ( + !allowNumberAndString && + isTypeFlagSetInUnion(baseType, ts.TypeFlags.StringLike) && + isTypeFlagSetInUnion(otherType, ts.TypeFlags.NumberLike) + ) { + return context.report({ + data: { + stringLike, + left: typeChecker.typeToString(leftType), + right: typeChecker.typeToString(rightType), + }, + messageId: 'mismatched', node, - messageId: 'notValidAnys', }); } - return; - } - - if (leftType === 'string' || rightType === 'string') { - return context.report({ - node, - messageId: 'notStrings', - }); - } - - if (leftType === 'bigint' || rightType === 'bigint') { - return context.report({ - node, - messageId: 'notBigInts', - }); - } - - if (leftType === 'number' || rightType === 'number') { - return context.report({ - node, - messageId: 'notNumbers', - }); + if ( + isTypeFlagSetInUnion(baseType, ts.TypeFlags.NumberLike) && + isTypeFlagSetInUnion(otherType, ts.TypeFlags.BigIntLike) + ) { + return context.report({ + data: { + left: typeChecker.typeToString(leftType), + right: typeChecker.typeToString(rightType), + }, + messageId: 'bigintAndNumber', + node, + }); + } } } return { "BinaryExpression[operator='+']": checkPlusOperands, - ...(checkCompoundAssignments && { + ...(!skipCompoundAssignments && { "AssignmentExpression[operator='+=']"(node): void { checkPlusOperands(node); }, @@ -200,3 +241,15 @@ export default util.createRule({ }; }, }); + +function isDeeplyObjectType(type: ts.Type): boolean { + return type.isIntersection() + ? tsutils.intersectionTypeParts(type).every(tsutils.isObjectType) + : tsutils.unionTypeParts(type).every(tsutils.isObjectType); +} + +function isTypeFlagSetInUnion(type: ts.Type, flag: ts.TypeFlags): boolean { + return tsutils + .unionTypeParts(type) + .some(subType => tsutils.isTypeFlagSet(subType, flag)); +} diff --git a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts index 485ba42378b..5da963a8219 100644 --- a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts +++ b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts @@ -6,10 +6,10 @@ import * as util from '../util'; type Options = [ { - allowNumber?: boolean; - allowBoolean?: boolean; allowAny?: boolean; + allowBoolean?: boolean; allowNullish?: boolean; + allowNumber?: boolean; allowRegExp?: boolean; allowNever?: boolean; }, @@ -24,7 +24,7 @@ export default util.createRule({ docs: { description: 'Enforce template literal expressions to be of `string` type', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -33,10 +33,11 @@ export default util.createRule({ schema: [ { type: 'object', + additionalProperties: false, properties: { - allowNumber: { + allowAny: { description: - 'Whether to allow `number` typed values in template expressions.', + 'Whether to allow `any` typed values in template expressions.', type: 'boolean', }, allowBoolean: { @@ -44,14 +45,14 @@ export default util.createRule({ 'Whether to allow `boolean` typed values in template expressions.', type: 'boolean', }, - allowAny: { + allowNullish: { description: - 'Whether to allow `any` typed values in template expressions.', + 'Whether to allow `nullish` typed values in template expressions.', type: 'boolean', }, - allowNullish: { + allowNumber: { description: - 'Whether to allow `nullish` typed values in template expressions.', + 'Whether to allow `number` typed values in template expressions.', type: 'boolean', }, allowRegExp: { @@ -70,12 +71,16 @@ export default util.createRule({ }, defaultOptions: [ { + allowAny: true, + allowBoolean: true, + allowNullish: true, allowNumber: true, + allowRegExp: true, }, ], create(context, [options]) { - const service = util.getParserServices(context); - const typeChecker = service.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); function isUnderlyingTypePrimitive(type: ts.Type): boolean { if (util.isTypeFlagSet(type, ts.TypeFlags.StringLike)) { @@ -103,10 +108,7 @@ export default util.createRule({ return true; } - if ( - options.allowRegExp && - util.getTypeName(typeChecker, type) === 'RegExp' - ) { + if (options.allowRegExp && util.getTypeName(checker, type) === 'RegExp') { return true; } @@ -127,14 +129,14 @@ export default util.createRule({ return { TemplateLiteral(node: TSESTree.TemplateLiteral): void { // don't check tagged template literals - if (node.parent!.type === AST_NODE_TYPES.TaggedTemplateExpression) { + if (node.parent.type === AST_NODE_TYPES.TaggedTemplateExpression) { return; } for (const expression of node.expressions) { const expressionType = util.getConstrainedTypeAtLocation( - typeChecker, - service.esTreeNodeToTSNodeMap.get(expression), + services, + expression, ); if ( @@ -146,7 +148,7 @@ export default util.createRule({ context.report({ node: expression, messageId: 'invalidType', - data: { type: typeChecker.typeToString(expressionType) }, + data: { type: checker.typeToString(expressionType) }, }); } } diff --git a/packages/eslint-plugin/src/rules/return-await.ts b/packages/eslint-plugin/src/rules/return-await.ts index 1797e47e127..35863976ce6 100644 --- a/packages/eslint-plugin/src/rules/return-await.ts +++ b/packages/eslint-plugin/src/rules/return-await.ts @@ -1,16 +1,15 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; -import { isBinaryExpression } from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; import { getOperatorPrecedence } from '../util/getOperatorPrecedence'; type FunctionNode = + | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression; + | TSESTree.FunctionExpression; interface ScopeInfo { hasAsync: boolean; @@ -22,7 +21,6 @@ export default util.createRule({ meta: { docs: { description: 'Enforce consistent returning of awaited values', - recommended: false, requiresTypeChecking: true, extendsBaseRule: 'no-return-await', }, @@ -39,6 +37,7 @@ export default util.createRule({ }, schema: [ { + type: 'string', enum: ['in-try-catch', 'always', 'never'], }, ], @@ -46,8 +45,8 @@ export default util.createRule({ defaultOptions: ['in-try-catch'], create(context, [option]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); const sourceCode = context.getSourceCode(); const scopeInfoStack: ScopeInfo[] = []; @@ -166,7 +165,7 @@ export default util.createRule({ } function isHigherPrecedenceThanAwait(node: ts.Node): boolean { - const operator = isBinaryExpression(node) + const operator = ts.isBinaryExpression(node) ? node.operatorToken.kind : ts.SyntaxKind.Unknown; const nodePrecedence = getOperatorPrecedence(node.kind, operator); @@ -301,7 +300,7 @@ export default util.createRule({ ): void { if (node.body.type !== AST_NODE_TYPES.BlockStatement) { findPossiblyReturnedNodes(node.body).forEach(node => { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); test(node, tsNode); }); } @@ -312,7 +311,7 @@ export default util.createRule({ return; } findPossiblyReturnedNodes(node.argument).forEach(node => { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); + const tsNode = services.esTreeNodeToTSNodeMap.get(node); test(node, tsNode); }); }, diff --git a/packages/eslint-plugin/src/rules/semi.ts b/packages/eslint-plugin/src/rules/semi.ts index c6da7c7912e..1719bc24700 100644 --- a/packages/eslint-plugin/src/rules/semi.ts +++ b/packages/eslint-plugin/src/rules/semi.ts @@ -16,17 +16,12 @@ export default util.createRule({ docs: { description: 'Require or disallow semicolons instead of ASI', // too opinionated to be recommended - recommended: false, extendsBaseRule: true, }, fixable: 'code', hasSuggestions: baseRule.meta.hasSuggestions, schema: baseRule.meta.schema, - // TODO: this rule has only had messages since v7.0 - remove this when we remove support for v6 - messages: baseRule.meta.messages ?? { - missingSemi: 'Missing semicolon.', - extraSemi: 'Extra semicolon.', - }, + messages: baseRule.meta.messages, }, defaultOptions: [ 'always', diff --git a/packages/eslint-plugin/src/rules/sort-type-constituents.ts b/packages/eslint-plugin/src/rules/sort-type-constituents.ts index 848b2ce0722..fd975d42073 100644 --- a/packages/eslint-plugin/src/rules/sort-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/sort-type-constituents.ts @@ -112,7 +112,6 @@ export default util.createRule({ docs: { description: 'Enforce constituents of a type union/intersection to be sorted alphabetically', - recommended: false, }, fixable: 'code', hasSuggestions: true, @@ -124,6 +123,7 @@ export default util.createRule({ schema: [ { type: 'object', + additionalProperties: false, properties: { checkIntersections: { description: 'Whether to check intersection types.', diff --git a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts b/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts deleted file mode 100644 index cbfa7a51594..00000000000 --- a/packages/eslint-plugin/src/rules/sort-type-union-intersection-members.ts +++ /dev/null @@ -1,271 +0,0 @@ -import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import { AST_NODE_TYPES } from '@typescript-eslint/utils'; - -import * as util from '../util'; -import { getEnumNames, typeNodeRequiresParentheses } from '../util'; - -enum Group { - conditional = 'conditional', - function = 'function', - import = 'import', - intersection = 'intersection', - keyword = 'keyword', - nullish = 'nullish', - literal = 'literal', - named = 'named', - object = 'object', - operator = 'operator', - tuple = 'tuple', - union = 'union', -} - -function getGroup(node: TSESTree.TypeNode): Group { - switch (node.type) { - case AST_NODE_TYPES.TSConditionalType: - return Group.conditional; - - case AST_NODE_TYPES.TSConstructorType: - case AST_NODE_TYPES.TSFunctionType: - return Group.function; - - case AST_NODE_TYPES.TSImportType: - return Group.import; - - case AST_NODE_TYPES.TSIntersectionType: - return Group.intersection; - - case AST_NODE_TYPES.TSAnyKeyword: - case AST_NODE_TYPES.TSBigIntKeyword: - case AST_NODE_TYPES.TSBooleanKeyword: - case AST_NODE_TYPES.TSNeverKeyword: - case AST_NODE_TYPES.TSNumberKeyword: - case AST_NODE_TYPES.TSObjectKeyword: - case AST_NODE_TYPES.TSStringKeyword: - case AST_NODE_TYPES.TSSymbolKeyword: - case AST_NODE_TYPES.TSThisType: - case AST_NODE_TYPES.TSUnknownKeyword: - case AST_NODE_TYPES.TSIntrinsicKeyword: - return Group.keyword; - - case AST_NODE_TYPES.TSNullKeyword: - case AST_NODE_TYPES.TSUndefinedKeyword: - case AST_NODE_TYPES.TSVoidKeyword: - return Group.nullish; - - case AST_NODE_TYPES.TSLiteralType: - case AST_NODE_TYPES.TSTemplateLiteralType: - return Group.literal; - - case AST_NODE_TYPES.TSArrayType: - case AST_NODE_TYPES.TSIndexedAccessType: - case AST_NODE_TYPES.TSInferType: - case AST_NODE_TYPES.TSTypeReference: - case AST_NODE_TYPES.TSQualifiedName: - return Group.named; - - case AST_NODE_TYPES.TSMappedType: - case AST_NODE_TYPES.TSTypeLiteral: - return Group.object; - - case AST_NODE_TYPES.TSTypeOperator: - case AST_NODE_TYPES.TSTypeQuery: - return Group.operator; - - case AST_NODE_TYPES.TSTupleType: - return Group.tuple; - - case AST_NODE_TYPES.TSUnionType: - return Group.union; - - // These types should never occur as part of a union/intersection - case AST_NODE_TYPES.TSAbstractKeyword: - case AST_NODE_TYPES.TSAsyncKeyword: - case AST_NODE_TYPES.TSDeclareKeyword: - case AST_NODE_TYPES.TSExportKeyword: - case AST_NODE_TYPES.TSNamedTupleMember: - case AST_NODE_TYPES.TSOptionalType: - case AST_NODE_TYPES.TSPrivateKeyword: - case AST_NODE_TYPES.TSProtectedKeyword: - case AST_NODE_TYPES.TSPublicKeyword: - case AST_NODE_TYPES.TSReadonlyKeyword: - case AST_NODE_TYPES.TSRestType: - case AST_NODE_TYPES.TSStaticKeyword: - case AST_NODE_TYPES.TSTypePredicate: - /* istanbul ignore next */ - throw new Error(`Unexpected Type ${node.type}`); - } -} - -export type Options = [ - { - checkIntersections?: boolean; - checkUnions?: boolean; - groupOrder?: string[]; - }, -]; -export type MessageIds = 'notSorted' | 'notSortedNamed' | 'suggestFix'; - -export default util.createRule({ - name: 'sort-type-union-intersection-members', - meta: { - deprecated: true, - type: 'suggestion', - docs: { - description: - 'Enforce members of a type union/intersection to be sorted alphabetically', - recommended: false, - }, - fixable: 'code', - hasSuggestions: true, - messages: { - notSorted: '{{type}} type members must be sorted.', - notSortedNamed: '{{type}} type {{name}} members must be sorted.', - suggestFix: 'Sort members of type (removes all comments).', - }, - replacedBy: ['@typescript-eslint/sort-type-constituents'], - schema: [ - { - type: 'object', - properties: { - checkIntersections: { - description: 'Whether to check intersection types.', - type: 'boolean', - }, - checkUnions: { - description: 'Whether to check union types.', - type: 'boolean', - }, - groupOrder: { - description: 'Ordering of the groups.', - type: 'array', - items: { - type: 'string', - enum: getEnumNames(Group), - }, - }, - }, - }, - ], - }, - defaultOptions: [ - { - checkIntersections: true, - checkUnions: true, - groupOrder: [ - Group.named, - Group.keyword, - Group.operator, - Group.literal, - Group.function, - Group.import, - Group.conditional, - Group.object, - Group.tuple, - Group.intersection, - Group.union, - Group.nullish, - ], - }, - ], - create(context, [{ checkIntersections, checkUnions, groupOrder }]) { - const sourceCode = context.getSourceCode(); - - const collator = new Intl.Collator('en', { - sensitivity: 'base', - numeric: true, - }); - - function checkSorting( - node: TSESTree.TSIntersectionType | TSESTree.TSUnionType, - ): void { - const sourceOrder = node.types.map(type => { - const group = groupOrder?.indexOf(getGroup(type)) ?? -1; - return { - group: group === -1 ? Number.MAX_SAFE_INTEGER : group, - node: type, - text: sourceCode.getText(type), - }; - }); - const expectedOrder = [...sourceOrder].sort((a, b) => { - if (a.group !== b.group) { - return a.group - b.group; - } - - return ( - collator.compare(a.text, b.text) || - (a.text < b.text ? -1 : a.text > b.text ? 1 : 0) - ); - }); - - const hasComments = node.types.some(type => { - const count = - sourceCode.getCommentsBefore(type).length + - sourceCode.getCommentsAfter(type).length; - return count > 0; - }); - - for (let i = 0; i < expectedOrder.length; i += 1) { - if (expectedOrder[i].node !== sourceOrder[i].node) { - let messageId: MessageIds = 'notSorted'; - const data = { - name: '', - type: - node.type === AST_NODE_TYPES.TSIntersectionType - ? 'Intersection' - : 'Union', - }; - if (node.parent?.type === AST_NODE_TYPES.TSTypeAliasDeclaration) { - messageId = 'notSortedNamed'; - data.name = node.parent.id.name; - } - - const fix: TSESLint.ReportFixFunction = fixer => { - const sorted = expectedOrder - .map(t => - typeNodeRequiresParentheses(t.node, t.text) || - (node.type === AST_NODE_TYPES.TSIntersectionType && - t.node.type === AST_NODE_TYPES.TSUnionType) - ? `(${t.text})` - : t.text, - ) - .join( - node.type === AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ', - ); - - return fixer.replaceText(node, sorted); - }; - return context.report({ - node, - messageId, - data, - // don't autofix if any of the types have leading/trailing comments - // the logic for preserving them correctly is a pain - we may implement this later - ...(hasComments - ? { - suggest: [ - { - messageId: 'suggestFix', - fix, - }, - ], - } - : { fix }), - }); - } - } - } - - return { - ...(checkIntersections && { - TSIntersectionType(node): void { - checkSorting(node); - }, - }), - ...(checkUnions && { - TSUnionType(node): void { - checkSorting(node); - }, - }), - }; - }, -}); diff --git a/packages/eslint-plugin/src/rules/space-before-blocks.ts b/packages/eslint-plugin/src/rules/space-before-blocks.ts index 5f16929aa52..4f82bb785a1 100644 --- a/packages/eslint-plugin/src/rules/space-before-blocks.ts +++ b/packages/eslint-plugin/src/rules/space-before-blocks.ts @@ -14,7 +14,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Enforce consistent spacing before blocks', - recommended: false, extendsBaseRule: true, }, fixable: baseRule.meta.fixable, diff --git a/packages/eslint-plugin/src/rules/space-before-function-paren.ts b/packages/eslint-plugin/src/rules/space-before-function-paren.ts index 5ff33aeb4fe..e6015783a67 100644 --- a/packages/eslint-plugin/src/rules/space-before-function-paren.ts +++ b/packages/eslint-plugin/src/rules/space-before-function-paren.ts @@ -3,7 +3,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; -type Option = 'never' | 'always'; +type Option = 'always' | 'never'; type FuncOption = Option | 'ignore'; export type Options = [ @@ -14,7 +14,7 @@ export type Options = [ asyncArrow?: FuncOption; }, ]; -export type MessageIds = 'unexpected' | 'missing'; +export type MessageIds = 'missing' | 'unexpected'; export default util.createRule({ name: 'space-before-function-paren', @@ -22,7 +22,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Enforce consistent spacing before function parenthesis', - recommended: false, extendsBaseRule: true, }, fixable: 'whitespace', @@ -30,18 +29,22 @@ export default util.createRule({ { oneOf: [ { + type: 'string', enum: ['always', 'never'], }, { type: 'object', properties: { anonymous: { + type: 'string', enum: ['always', 'never', 'ignore'], }, named: { + type: 'string', enum: ['always', 'never', 'ignore'], }, asyncArrow: { + type: 'string', enum: ['always', 'never', 'ignore'], }, }, @@ -72,14 +75,14 @@ export default util.createRule({ | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression - | TSESTree.TSEmptyBodyFunctionExpression - | TSESTree.TSDeclareFunction, + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression, ): boolean { if (node.id != null) { return true; } - const parent = node.parent!; + const parent = node.parent; return ( parent.type === AST_NODE_TYPES.MethodDefinition || @@ -99,8 +102,8 @@ export default util.createRule({ | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression - | TSESTree.TSEmptyBodyFunctionExpression - | TSESTree.TSDeclareFunction, + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression, ): FuncOption { if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { // Always ignore non-async functions and arrow functions without parens, e.g. async foo => bar @@ -131,8 +134,8 @@ export default util.createRule({ | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression - | TSESTree.TSEmptyBodyFunctionExpression - | TSESTree.TSDeclareFunction, + | TSESTree.TSDeclareFunction + | TSESTree.TSEmptyBodyFunctionExpression, ): void { const functionConfig = getConfigForFunction(node); diff --git a/packages/eslint-plugin/src/rules/space-infix-ops.ts b/packages/eslint-plugin/src/rules/space-infix-ops.ts index 678cd2c4c8a..c1df490436f 100644 --- a/packages/eslint-plugin/src/rules/space-infix-ops.ts +++ b/packages/eslint-plugin/src/rules/space-infix-ops.ts @@ -16,7 +16,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require spacing around infix operators', - recommended: false, extendsBaseRule: true, }, fixable: baseRule.meta.fixable, @@ -71,8 +70,8 @@ export default util.createRule({ } function checkAndReportAssignmentSpace( - leftNode: TSESTree.Token | TSESTree.Node | null, - rightNode?: TSESTree.Token | TSESTree.Node | null, + leftNode: TSESTree.Node | TSESTree.Token | null, + rightNode?: TSESTree.Node | TSESTree.Token | null, ): void { if (!rightNode || !leftNode) { return; diff --git a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts index dc6d09c75a6..6ea73c6e299 100644 --- a/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts +++ b/packages/eslint-plugin/src/rules/strict-boolean-expressions.ts @@ -1,6 +1,9 @@ -import type { ParserServices, TSESTree } from '@typescript-eslint/utils'; +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -20,29 +23,29 @@ export type Options = [ ]; export type MessageId = - | 'conditionErrorOther' | 'conditionErrorAny' - | 'conditionErrorNullish' | 'conditionErrorNullableBoolean' - | 'conditionErrorString' + | 'conditionErrorNullableEnum' + | 'conditionErrorNullableNumber' + | 'conditionErrorNullableObject' | 'conditionErrorNullableString' + | 'conditionErrorNullish' | 'conditionErrorNumber' - | 'conditionErrorNullableNumber' | 'conditionErrorObject' - | 'conditionErrorNullableObject' - | 'conditionErrorNullableEnum' - | 'noStrictNullCheck' - | 'conditionFixDefaultFalse' - | 'conditionFixDefaultEmptyString' - | 'conditionFixDefaultZero' - | 'conditionFixCompareNullish' + | 'conditionErrorOther' + | 'conditionErrorString' | 'conditionFixCastBoolean' - | 'conditionFixCompareTrue' + | 'conditionFixCompareEmptyString' | 'conditionFixCompareFalse' + | 'conditionFixCompareNaN' + | 'conditionFixCompareNullish' | 'conditionFixCompareStringLength' - | 'conditionFixCompareEmptyString' + | 'conditionFixCompareTrue' | 'conditionFixCompareZero' - | 'conditionFixCompareNaN'; + | 'conditionFixDefaultEmptyString' + | 'conditionFixDefaultFalse' + | 'conditionFixDefaultZero' + | 'noStrictNullCheck'; export default util.createRule({ name: 'strict-boolean-expressions', @@ -52,7 +55,6 @@ export default util.createRule({ hasSuggestions: true, docs: { description: 'Disallow certain types in boolean expressions', - recommended: false, requiresTypeChecking: true, }, schema: [ @@ -143,15 +145,15 @@ export default util.createRule({ allowNullableBoolean: false, allowNullableString: false, allowNullableNumber: false, - allowNullableEnum: true, + allowNullableEnum: false, allowAny: false, allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false, }, ], create(context, [options]) { - const parserServices = util.getParserServices(context); - const typeChecker = parserServices.program.getTypeChecker(); - const compilerOptions = parserServices.program.getCompilerOptions(); + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); const sourceCode = context.getSourceCode(); const isStrictNullChecks = tsutils.isStrictCompilerOptionEnabled( compilerOptions, @@ -265,8 +267,7 @@ export default util.createRule({ * It analyzes the type of a node and checks if it is allowed in a boolean context. */ function checkNode(node: TSESTree.Node): void { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node); - const type = util.getConstrainedTypeAtLocation(typeChecker, tsNode); + const type = util.getConstrainedTypeAtLocation(services, node); const types = inspectVariantTypes(tsutils.unionTypeParts(type)); const is = (...wantedTypes: readonly VariantType[]): boolean => @@ -514,8 +515,8 @@ export default util.createRule({ // number if (is('number') || is('truthy number')) { if (!options.allowNumber) { - if (isArrayLengthExpression(node, typeChecker, parserServices)) { - if (isLogicalNegationExpression(node.parent!)) { + if (isArrayLengthExpression(node, checker, services)) { + if (isLogicalNegationExpression(node.parent)) { // if (!array.length) context.report({ node, @@ -730,7 +731,12 @@ export default util.createRule({ is('nullish', 'number', 'enum') || is('nullish', 'string', 'enum') || is('nullish', 'truthy number', 'enum') || - is('nullish', 'truthy string', 'enum') + is('nullish', 'truthy string', 'enum') || + // mixed enums + is('nullish', 'truthy number', 'truthy string', 'enum') || + is('nullish', 'truthy number', 'string', 'enum') || + is('nullish', 'truthy string', 'number', 'enum') || + is('nullish', 'number', 'string', 'enum') ) { if (!options.allowNullableEnum) { if (isLogicalNegationExpression(node.parent!)) { @@ -786,17 +792,17 @@ export default util.createRule({ /** The types we care about */ type VariantType = - | 'nullish' + | 'any' | 'boolean' - | 'truthy boolean' - | 'string' - | 'truthy string' + | 'enum' + | 'never' + | 'nullish' | 'number' - | 'truthy number' | 'object' - | 'enum' - | 'any' - | 'never'; + | 'string' + | 'truthy boolean' + | 'truthy number' + | 'truthy string'; /** * Check union variants for the types we care about @@ -821,9 +827,9 @@ export default util.createRule({ // If incoming type is either "true" or "false", there will be one type // object with intrinsicName set accordingly // If incoming type is boolean, there will be two type objects with - // intrinsicName set "true" and "false" each because of tsutils.unionTypeParts() + // intrinsicName set "true" and "false" each because of ts-api-utils.unionTypeParts() if (booleans.length === 1) { - tsutils.isBooleanLiteralType(booleans[0], true) + tsutils.isTrueLiteralType(booleans[0]) ? variantTypes.add('truthy boolean') : variantTypes.add('boolean'); } else if (booleans.length === 2) { @@ -918,7 +924,7 @@ function isLogicalNegationExpression( function isArrayLengthExpression( node: TSESTree.Node, typeChecker: ts.TypeChecker, - parserServices: ParserServices, + services: ParserServicesWithTypeInformation, ): node is TSESTree.MemberExpressionNonComputedName { if (node.type !== AST_NODE_TYPES.MemberExpression) { return false; @@ -929,10 +935,6 @@ function isArrayLengthExpression( if (node.property.name !== 'length') { return false; } - const objectTsNode = parserServices.esTreeNodeToTSNodeMap.get(node.object); - const objectType = util.getConstrainedTypeAtLocation( - typeChecker, - objectTsNode, - ); + const objectType = util.getConstrainedTypeAtLocation(services, node.object); return util.isTypeArrayTypeOrUnionOfArrayTypes(objectType, typeChecker); } diff --git a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts index 43d4913b4ca..6abdbf27fc6 100644 --- a/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts +++ b/packages/eslint-plugin/src/rules/switch-exhaustiveness-check.ts @@ -1,5 +1,5 @@ import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import { isTypeFlagSet, unionTypeParts } from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import { @@ -18,7 +18,6 @@ export default createRule({ docs: { description: 'Require switch-case statements to be exhaustive with union type', - recommended: false, requiresTypeChecking: true, }, hasSuggestions: true, @@ -32,19 +31,14 @@ export default createRule({ defaultOptions: [], create(context) { const sourceCode = context.getSourceCode(); - const service = getParserServices(context); - const checker = service.program.getTypeChecker(); - const compilerOptions = service.program.getCompilerOptions(); - - function getNodeType(node: TSESTree.Node): ts.Type { - const tsNode = service.esTreeNodeToTSNodeMap.get(node); - return getConstrainedTypeAtLocation(checker, tsNode); - } + const services = getParserServices(context); + const checker = services.program.getTypeChecker(); + const compilerOptions = services.program.getCompilerOptions(); function fixSwitch( fixer: TSESLint.RuleFixer, node: TSESTree.SwitchStatement, - missingBranchTypes: Array, + missingBranchTypes: ts.Type[], symbolName?: string, ): TSESLint.RuleFix | null { const lastCase = @@ -114,19 +108,24 @@ export default createRule({ } function checkSwitchExhaustive(node: TSESTree.SwitchStatement): void { - const discriminantType = getNodeType(node.discriminant); + const discriminantType = getConstrainedTypeAtLocation( + services, + node.discriminant, + ); const symbolName = discriminantType.getSymbol()?.escapedName; if (discriminantType.isUnion()) { - const unionTypes = unionTypeParts(discriminantType); - const caseTypes: Set = new Set(); + const unionTypes = tsutils.unionTypeParts(discriminantType); + const caseTypes = new Set(); for (const switchCase of node.cases) { if (switchCase.test == null) { // Switch has 'default' branch - do nothing. return; } - caseTypes.add(getNodeType(switchCase.test)); + caseTypes.add( + getConstrainedTypeAtLocation(services, switchCase.test), + ); } const missingBranchTypes = unionTypes.filter( @@ -144,7 +143,7 @@ export default createRule({ data: { missingBranches: missingBranchTypes .map(missingType => - isTypeFlagSet(missingType, ts.TypeFlags.ESSymbolLike) + tsutils.isTypeFlagSet(missingType, ts.TypeFlags.ESSymbolLike) ? `typeof ${missingType.getSymbol()?.escapedName as string}` : checker.typeToString(missingType), ) diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 4425e666338..10f85b6cc6e 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -19,7 +19,7 @@ export default util.createRule({ docs: { description: 'Disallow certain triple slash directives in favor of ES6-style import declarations', - recommended: 'error', + recommended: 'recommended', }, messages: { tripleSlashReference: @@ -30,12 +30,15 @@ export default util.createRule({ type: 'object', properties: { lib: { + type: 'string', enum: ['always', 'never'], }, path: { + type: 'string', enum: ['always', 'never'], }, types: { + type: 'string', enum: ['always', 'never', 'prefer-import'], }, }, diff --git a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts index cdc77c22903..f3ad45e9dc5 100644 --- a/packages/eslint-plugin/src/rules/type-annotation-spacing.ts +++ b/packages/eslint-plugin/src/rules/type-annotation-spacing.ts @@ -39,15 +39,6 @@ type MessageIds = | 'unexpectedSpaceBefore' | 'unexpectedSpaceBetween'; -const definition = { - type: 'object', - properties: { - before: { type: 'boolean' }, - after: { type: 'boolean' }, - }, - additionalProperties: false, -}; - function createRules(options?: Config): WhitespaceRules { const globals = { ...(options?.before !== undefined ? { before: options.before } : {}), @@ -115,7 +106,6 @@ export default util.createRule({ type: 'layout', docs: { description: 'Require consistent spacing around type annotations', - recommended: false, }, fixable: 'whitespace', messages: { @@ -128,6 +118,16 @@ export default util.createRule({ }, schema: [ { + $defs: { + spacingConfig: { + type: 'object', + properties: { + before: { type: 'boolean' }, + after: { type: 'boolean' }, + }, + additionalProperties: false, + }, + }, type: 'object', properties: { before: { type: 'boolean' }, @@ -135,12 +135,12 @@ export default util.createRule({ overrides: { type: 'object', properties: { - colon: definition, - arrow: definition, - variable: definition, - parameter: definition, - property: definition, - returnType: definition, + colon: { $ref: '#/items/0/$defs/spacingConfig' }, + arrow: { $ref: '#/items/0/$defs/spacingConfig' }, + variable: { $ref: '#/items/0/$defs/spacingConfig' }, + parameter: { $ref: '#/items/0/$defs/spacingConfig' }, + property: { $ref: '#/items/0/$defs/spacingConfig' }, + returnType: { $ref: '#/items/0/$defs/spacingConfig' }, }, additionalProperties: false, }, diff --git a/packages/eslint-plugin/src/rules/typedef.ts b/packages/eslint-plugin/src/rules/typedef.ts index dd1f6ed871b..595081906af 100644 --- a/packages/eslint-plugin/src/rules/typedef.ts +++ b/packages/eslint-plugin/src/rules/typedef.ts @@ -23,7 +23,6 @@ export default util.createRule<[Options], MessageIds>({ meta: { docs: { description: 'Require type annotations in certain places', - recommended: false, }, messages: { expectedTypedef: 'Expected a type annotation.', @@ -32,6 +31,7 @@ export default util.createRule<[Options], MessageIds>({ schema: [ { type: 'object', + additionalProperties: false, properties: { [OptionKeys.ArrayDestructuring]: { type: 'boolean' }, [OptionKeys.ArrowParameter]: { type: 'boolean' }, @@ -152,9 +152,9 @@ export default util.createRule<[Options], MessageIds>({ } function isAncestorHasTypeAnnotation( - node: TSESTree.ObjectPattern | TSESTree.ArrayPattern, + node: TSESTree.ArrayPattern | TSESTree.ObjectPattern, ): boolean { - let ancestor = node.parent; + let ancestor: TSESTree.Node | undefined = node.parent; while (ancestor) { if ( diff --git a/packages/eslint-plugin/src/rules/unbound-method.ts b/packages/eslint-plugin/src/rules/unbound-method.ts index 6741f4df09f..ce2ec6ccd73 100644 --- a/packages/eslint-plugin/src/rules/unbound-method.ts +++ b/packages/eslint-plugin/src/rules/unbound-method.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import * as tsutils from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import * as util from '../util'; @@ -130,7 +130,7 @@ export default util.createRule({ docs: { description: 'Enforce unbound methods are called with their expected scope', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -161,9 +161,8 @@ export default util.createRule({ }, ], create(context, [{ ignoreStatic }]) { - const parserServices = util.getParserServices(context); - const checker = parserServices.program.getTypeChecker(); - const currentSourceFile = parserServices.program.getSourceFile( + const services = util.getParserServices(context); + const currentSourceFile = services.program.getSourceFile( context.getFilename(), ); @@ -193,9 +192,7 @@ export default util.createRule({ return; } - const objectSymbol = checker.getSymbolAtLocation( - parserServices.esTreeNodeToTSNodeMap.get(node.object), - ); + const objectSymbol = services.getSymbolAtLocation(node.object); if ( objectSymbol && @@ -205,12 +202,10 @@ export default util.createRule({ return; } - const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node); - - checkMethodAndReport(node, checker.getSymbolAtLocation(originalNode)); + checkMethodAndReport(node, services.getSymbolAtLocation(node)); }, 'VariableDeclarator, AssignmentExpression'( - node: TSESTree.VariableDeclarator | TSESTree.AssignmentExpression, + node: TSESTree.AssignmentExpression | TSESTree.VariableDeclarator, ): void { const [idNode, initNode] = node.type === AST_NODE_TYPES.VariableDeclarator @@ -218,9 +213,8 @@ export default util.createRule({ : [node.left, node.right]; if (initNode && idNode.type === AST_NODE_TYPES.ObjectPattern) { - const tsNode = parserServices.esTreeNodeToTSNodeMap.get(initNode); - const rightSymbol = checker.getSymbolAtLocation(tsNode); - const initTypes = checker.getTypeAtLocation(tsNode); + const rightSymbol = services.getSymbolAtLocation(initNode); + const initTypes = services.getTypeAtLocation(initNode); const notImported = rightSymbol && isNotImported(rightSymbol, currentSourceFile); @@ -277,6 +271,7 @@ function checkMethod( const firstParam = decl.parameters[0]; const firstParamIsThis = firstParam?.name.kind === ts.SyntaxKind.Identifier && + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison firstParam?.name.escapedText === 'this'; const thisArgIsVoid = firstParamIsThis && @@ -287,7 +282,7 @@ function checkMethod( !thisArgIsVoid && !( ignoreStatic && - tsutils.hasModifier( + tsutils.includesModifier( getModifiers(valueDeclaration), ts.SyntaxKind.StaticKeyword, ) diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 3e5d8fefb07..1a033f905ba 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -9,15 +9,15 @@ interface Failure { } type Unify = - | { - kind: 'single-parameter-difference'; - p0: TSESTree.Parameter; - p1: TSESTree.Parameter; - } | { kind: 'extra-parameter'; extraParameter: TSESTree.Parameter; otherSignature: SignatureDefinition; + } + | { + kind: 'single-parameter-difference'; + p0: TSESTree.Parameter; + p1: TSESTree.Parameter; }; /** @@ -27,16 +27,16 @@ type Unify = type IsTypeParameter = (typeName: string) => boolean; type ScopeNode = + | TSESTree.ClassBody | TSESTree.Program - | TSESTree.TSModuleBlock | TSESTree.TSInterfaceBody - | TSESTree.ClassBody + | TSESTree.TSModuleBlock | TSESTree.TSTypeLiteral; type OverloadNode = MethodDefinition | SignatureDefinition; type ContainingNode = - | TSESTree.ExportNamedDeclaration - | TSESTree.ExportDefaultDeclaration; + | TSESTree.ExportDefaultDeclaration + | TSESTree.ExportNamedDeclaration; type SignatureDefinition = | TSESTree.FunctionExpression @@ -212,11 +212,9 @@ export default util.createRule({ const bTypeParams = b.typeParameters !== undefined ? b.typeParameters.params : undefined; - if ( - ignoreDifferentlyNamedParameters && - a.params.length === b.params.length - ) { - for (let i = 0; i < a.params.length; i += 1) { + if (ignoreDifferentlyNamedParameters) { + const commonParamsLength = Math.min(a.params.length, b.params.length); + for (let i = 0; i < commonParamsLength; i += 1) { if ( a.params[i].type === b.params[i].type && getStaticParameterName(a.params[i]) !== @@ -424,8 +422,7 @@ export default util.createRule({ return ( (a.type === AST_NODE_TYPES.RestElement) === - (b.type === AST_NODE_TYPES.RestElement) && - (optionalA !== undefined) === (optionalB !== undefined) + (b.type === AST_NODE_TYPES.RestElement) && optionalA === optionalB ); } @@ -585,12 +582,11 @@ export default util.createRule({ function getExportingNode( node: TSESTree.TSDeclareFunction, ): - | TSESTree.ExportNamedDeclaration | TSESTree.ExportDefaultDeclaration + | TSESTree.ExportNamedDeclaration | undefined { - return node.parent && - (node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration || - node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration) + return node.parent.type === AST_NODE_TYPES.ExportNamedDeclaration || + node.parent.type === AST_NODE_TYPES.ExportDefaultDeclaration ? node.parent : undefined; } diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index 9140443390c..c104a5b6476 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -4,7 +4,7 @@ import * as ts from 'typescript'; import { escapeRegExp } from './escapeRegExp'; // deeply re-export, for convenience -export * from '@typescript-eslint/utils/dist/ast-utils'; +export * from '@typescript-eslint/utils/ast-utils'; // The following is copied from `eslint`'s source code since it doesn't exist in eslint@5. // https://github.com/eslint/eslint/blob/145aec1ab9052fbca96a44d04927c595951b1536/lib/rules/utils/ast-utils.js#L1751-L1779 @@ -56,7 +56,7 @@ export function forEachReturnStatement( function traverse(node: ts.Node): T | undefined { switch (node.kind) { case ts.SyntaxKind.ReturnStatement: - return visitor(node); + return visitor(node as ts.ReturnStatement); case ts.SyntaxKind.CaseBlock: case ts.SyntaxKind.Block: case ts.SyntaxKind.IfStatement: diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index ba3beb6861d..4df1a178fbd 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -1,5 +1,8 @@ -import { ImplicitLibVariable } from '@typescript-eslint/scope-manager'; -import { Visitor } from '@typescript-eslint/scope-manager/dist/referencer/Visitor'; +import { + ImplicitLibVariable, + ScopeType, + Visitor, +} from '@typescript-eslint/scope-manager'; import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES, @@ -98,7 +101,7 @@ class UnusedVarsVisitor< const scope = this.#scopeManager.acquire(node, inner); if (scope) { - if (scope.type === 'function-expression-name') { + if (scope.type === ScopeType.functionExpressionName) { return scope.childScopes[0] as T; } return scope as T; @@ -321,7 +324,7 @@ class UnusedVarsVisitor< protected TSModuleDeclaration(node: TSESTree.TSModuleDeclaration): void { // -- global augmentation can be in any file, and they do not need exports if (node.global === true) { - this.markVariableAsUsed('global', node.parent!); + this.markVariableAsUsed('global', node.parent); } } @@ -423,9 +426,7 @@ function isMergableExported(variable: TSESLint.Scope.Variable): boolean { * @returns True if the variable is exported, false if not. */ function isExported(variable: TSESLint.Scope.Variable): boolean { - const definition = variable.defs[0]; - - if (definition) { + return variable.defs.some(definition => { let node = definition.node; if (node.type === AST_NODE_TYPES.VariableDeclarator) { @@ -435,8 +436,7 @@ function isExported(variable: TSESLint.Scope.Variable): boolean { } return node.parent!.type.indexOf('Export') === 0; - } - return false; + }); } /** @@ -561,7 +561,7 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean { } const id = ref.identifier; - const parent = id.parent!; + const parent = id.parent; const grandparent = parent.parent!; const refScope = ref.from.variableScope; const varScope = ref.resolved!.scope.variableScope; @@ -694,7 +694,7 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean { } const id = ref.identifier; - const parent = id.parent!; + const parent = id.parent; const grandparent = parent.parent!; return ( diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts index 3ba5f4fac64..a47b101e07c 100644 --- a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -294,7 +294,7 @@ function checkFunctionExpressionReturnType( * Check whether any ancestor of the provided function has a valid return type. */ function ancestorHasReturnType(node: FunctionNode): boolean { - let ancestor = node.parent; + let ancestor: TSESTree.Node | undefined = node.parent; if (ancestor?.type === AST_NODE_TYPES.Property) { ancestor = ancestor.value; diff --git a/packages/eslint-plugin/src/util/getESLintCoreRule.ts b/packages/eslint-plugin/src/util/getESLintCoreRule.ts index 96785ad6f15..30de8347c0d 100644 --- a/packages/eslint-plugin/src/util/getESLintCoreRule.ts +++ b/packages/eslint-plugin/src/util/getESLintCoreRule.ts @@ -19,7 +19,6 @@ interface RuleMap { 'lines-between-class-members': typeof import('eslint/lib/rules/lines-between-class-members'); 'no-dupe-args': typeof import('eslint/lib/rules/no-dupe-args'); 'no-dupe-class-members': typeof import('eslint/lib/rules/no-dupe-class-members'); - 'no-duplicate-imports': typeof import('eslint/lib/rules/no-duplicate-imports'); 'no-empty-function': typeof import('eslint/lib/rules/no-empty-function'); 'no-extra-parens': typeof import('eslint/lib/rules/no-extra-parens'); 'no-extra-semi': typeof import('eslint/lib/rules/no-extra-semi'); diff --git a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts index 48c25b38f0d..ddc004d0397 100644 --- a/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts +++ b/packages/eslint-plugin/src/util/getFunctionHeadLoc.ts @@ -3,8 +3,8 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; type FunctionNode = | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionExpression - | TSESTree.FunctionDeclaration; + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression; /** * Creates a report location for the given function. @@ -28,7 +28,7 @@ export function getFunctionHeadLoc( sourceCode: TSESLint.SourceCode, ): TSESTree.SourceLocation { function getLocStart(): TSESTree.Position { - if (node.parent && node.parent.type === AST_NODE_TYPES.MethodDefinition) { + if (node.parent.type === AST_NODE_TYPES.MethodDefinition) { // return the start location for class method if (node.parent.decorators && node.parent.decorators.length > 0) { @@ -41,11 +41,7 @@ export function getFunctionHeadLoc( return node.parent.loc.start; } - if ( - node.parent && - node.parent.type === AST_NODE_TYPES.Property && - node.parent.method - ) { + if (node.parent.type === AST_NODE_TYPES.Property && node.parent.method) { // return the start location for object method shorthand return node.parent.loc.start; } diff --git a/packages/eslint-plugin/src/util/getOperatorPrecedence.ts b/packages/eslint-plugin/src/util/getOperatorPrecedence.ts index b7a9d75fb15..abbcb9191a5 100644 --- a/packages/eslint-plugin/src/util/getOperatorPrecedence.ts +++ b/packages/eslint-plugin/src/util/getOperatorPrecedence.ts @@ -1,3 +1,5 @@ +import type { TSESTree } from '@typescript-eslint/utils'; +import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { SyntaxKind } from 'typescript'; export enum OperatorPrecedence { @@ -192,12 +194,115 @@ export enum OperatorPrecedence { Invalid = -1, } +export function getOperatorPrecedenceForNode( + node: TSESTree.Node, +): OperatorPrecedence { + switch (node.type) { + case AST_NODE_TYPES.SpreadElement: + case AST_NODE_TYPES.RestElement: + return OperatorPrecedence.Spread; + + case AST_NODE_TYPES.YieldExpression: + return OperatorPrecedence.Yield; + + case AST_NODE_TYPES.ConditionalExpression: + return OperatorPrecedence.Conditional; + + case AST_NODE_TYPES.SequenceExpression: + return OperatorPrecedence.Comma; + + case AST_NODE_TYPES.AssignmentExpression: + case AST_NODE_TYPES.BinaryExpression: + case AST_NODE_TYPES.LogicalExpression: + switch (node.operator) { + case '==': + case '+=': + case '-=': + case '**=': + case '*=': + case '/=': + case '%=': + case '<<=': + case '>>=': + case '>>>=': + case '&=': + case '^=': + case '|=': + case '||=': + case '&&=': + case '??=': + return OperatorPrecedence.Assignment; + + default: + return getBinaryOperatorPrecedence(node.operator); + } + + case AST_NODE_TYPES.TSTypeAssertion: + case AST_NODE_TYPES.TSNonNullExpression: + case AST_NODE_TYPES.UnaryExpression: + case AST_NODE_TYPES.AwaitExpression: + return OperatorPrecedence.Unary; + + case AST_NODE_TYPES.UpdateExpression: + // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? + if (node.prefix) { + return OperatorPrecedence.Unary; + } + return OperatorPrecedence.Update; + + case AST_NODE_TYPES.ChainExpression: + return getOperatorPrecedenceForNode(node.expression); + + case AST_NODE_TYPES.CallExpression: + return OperatorPrecedence.LeftHandSide; + + case AST_NODE_TYPES.NewExpression: + return node.arguments.length > 0 + ? OperatorPrecedence.Member + : OperatorPrecedence.LeftHandSide; + + case AST_NODE_TYPES.TaggedTemplateExpression: + case AST_NODE_TYPES.MemberExpression: + case AST_NODE_TYPES.MetaProperty: + return OperatorPrecedence.Member; + + case AST_NODE_TYPES.TSAsExpression: + return OperatorPrecedence.Relational; + + case AST_NODE_TYPES.ThisExpression: + case AST_NODE_TYPES.Super: + case AST_NODE_TYPES.Identifier: + case AST_NODE_TYPES.PrivateIdentifier: + case AST_NODE_TYPES.Literal: + case AST_NODE_TYPES.ArrayExpression: + case AST_NODE_TYPES.ObjectExpression: + case AST_NODE_TYPES.FunctionExpression: + case AST_NODE_TYPES.ArrowFunctionExpression: + case AST_NODE_TYPES.ClassExpression: + case AST_NODE_TYPES.TemplateLiteral: + case AST_NODE_TYPES.JSXElement: + case AST_NODE_TYPES.JSXFragment: + // we don't have nodes for these cases + // case SyntaxKind.ParenthesizedExpression: + // case SyntaxKind.OmittedExpression: + return OperatorPrecedence.Primary; + + default: + return OperatorPrecedence.Invalid; + } +} + +type ValueOf = T[keyof T]; +type TSESTreeOperatorKind = + | ValueOf + | ValueOf; export function getOperatorPrecedence( nodeKind: SyntaxKind, operatorKind: SyntaxKind, hasArguments?: boolean, ): OperatorPrecedence { switch (nodeKind) { + // A list of comma-separated expressions. This node is only created by transformations. case SyntaxKind.CommaListExpression: return OperatorPrecedence.Comma; @@ -298,46 +403,83 @@ export function getOperatorPrecedence( } export function getBinaryOperatorPrecedence( - kind: SyntaxKind, + kind: SyntaxKind | TSESTreeOperatorKind, ): OperatorPrecedence { switch (kind) { case SyntaxKind.QuestionQuestionToken: + case '??': return OperatorPrecedence.Coalesce; + case SyntaxKind.BarBarToken: + case '||': return OperatorPrecedence.LogicalOR; + case SyntaxKind.AmpersandAmpersandToken: + case '&&': return OperatorPrecedence.LogicalAND; + case SyntaxKind.BarToken: + case '|': return OperatorPrecedence.BitwiseOR; + case SyntaxKind.CaretToken: + case '^': return OperatorPrecedence.BitwiseXOR; + case SyntaxKind.AmpersandToken: + case '&': return OperatorPrecedence.BitwiseAND; + case SyntaxKind.EqualsEqualsToken: + case '==': case SyntaxKind.ExclamationEqualsToken: + case '!=': case SyntaxKind.EqualsEqualsEqualsToken: + case '===': case SyntaxKind.ExclamationEqualsEqualsToken: + case '!==': return OperatorPrecedence.Equality; + case SyntaxKind.LessThanToken: + case '<': case SyntaxKind.GreaterThanToken: + case '>': case SyntaxKind.LessThanEqualsToken: + case '<=': case SyntaxKind.GreaterThanEqualsToken: + case '>=': case SyntaxKind.InstanceOfKeyword: + case 'instanceof': case SyntaxKind.InKeyword: + case 'in': case SyntaxKind.AsKeyword: + // case 'as': -- we don't have a token for this return OperatorPrecedence.Relational; + case SyntaxKind.LessThanLessThanToken: + case '<<': case SyntaxKind.GreaterThanGreaterThanToken: + case '>>': case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case '>>>': return OperatorPrecedence.Shift; + case SyntaxKind.PlusToken: + case '+': case SyntaxKind.MinusToken: + case '-': return OperatorPrecedence.Additive; + case SyntaxKind.AsteriskToken: + case '*': case SyntaxKind.SlashToken: + case '/': case SyntaxKind.PercentToken: + case '%': return OperatorPrecedence.Multiplicative; + case SyntaxKind.AsteriskAsteriskToken: + case '**': return OperatorPrecedence.Exponentiation; } diff --git a/packages/eslint-plugin/src/util/getStringLength.ts b/packages/eslint-plugin/src/util/getStringLength.ts index 65a22551949..6bec9f4e1ad 100644 --- a/packages/eslint-plugin/src/util/getStringLength.ts +++ b/packages/eslint-plugin/src/util/getStringLength.ts @@ -1,6 +1,6 @@ -import GraphemeSplitter from 'grapheme-splitter'; +import Graphemer from 'graphemer'; -let splitter: GraphemeSplitter; +let splitter: Graphemer; function isASCII(value: string): boolean { return /^[\u0020-\u007f]*$/u.test(value); @@ -11,7 +11,7 @@ export function getStringLength(value: string): number { return value.length; } - splitter ??= new GraphemeSplitter(); + splitter ??= new Graphemer(); return splitter.countGraphemes(value); } diff --git a/packages/eslint-plugin/src/util/getWrappingFixer.ts b/packages/eslint-plugin/src/util/getWrappingFixer.ts index 73203cf8cdf..e43ff3e142b 100644 --- a/packages/eslint-plugin/src/util/getWrappingFixer.ts +++ b/packages/eslint-plugin/src/util/getWrappingFixer.ts @@ -136,7 +136,7 @@ function isMissingSemicolonBefore( const parent = node.parent!; if (parent.type === AST_NODE_TYPES.ExpressionStatement) { - const block = parent.parent!; + const block = parent.parent; if ( block.type === AST_NODE_TYPES.Program || block.type === AST_NODE_TYPES.BlockStatement diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 8362736bd62..4c4823cf504 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -32,7 +32,7 @@ function upperCaseFirst(str: string): string { return str[0].toUpperCase() + str.slice(1); } -function arrayGroupByToMap( +function arrayGroupByToMap( array: T[], getKey: (item: T) => Key, ): Map { @@ -108,11 +108,11 @@ enum MemberNameType { function getNameFromMember( member: | TSESTree.MethodDefinition - | TSESTree.TSMethodSignature - | TSESTree.TSAbstractMethodDefinition + | TSESTree.Property | TSESTree.PropertyDefinition + | TSESTree.TSAbstractMethodDefinition | TSESTree.TSAbstractPropertyDefinition - | TSESTree.Property + | TSESTree.TSMethodSignature | TSESTree.TSPropertySignature, sourceCode: TSESLint.SourceCode, ): { type: MemberNameType; name: string } { @@ -188,7 +188,7 @@ function formatWordList(words: string[]): string { */ function findLastIndex( members: T[], - predicate: (member: T) => boolean | undefined | null, + predicate: (member: T) => boolean | null | undefined, ): number { let idx = members.length - 1; diff --git a/packages/eslint-plugin/tests/RuleTester.ts b/packages/eslint-plugin/tests/RuleTester.ts index 7c46b9a12f5..741b33e0260 100644 --- a/packages/eslint-plugin/tests/RuleTester.ts +++ b/packages/eslint-plugin/tests/RuleTester.ts @@ -1,15 +1,80 @@ -import { ESLintUtils } from '@typescript-eslint/utils'; +import type { + InvalidTestCase, + ValidTestCase, +} from '@typescript-eslint/rule-tester'; import * as path from 'path'; -function getFixturesRootDir(): string { +export function getFixturesRootDir(): string { return path.join(__dirname, 'fixtures'); } -const { batchedSingleLineTests, RuleTester, noFormat } = ESLintUtils; -export { - RunTests, - ValidTestCase, - InvalidTestCase, -} from '@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester'; - -export { batchedSingleLineTests, getFixturesRootDir, noFormat, RuleTester }; +/** + * Converts a batch of single line tests into a number of separate test cases. + * This makes it easier to write tests which use the same options. + * + * Why wouldn't you just leave them as one test? + * Because it makes the test error messages harder to decipher. + * This way each line will fail separately, instead of them all failing together. + * + * @deprecated - DO NOT USE THIS FOR NEW RULES + */ +export function batchedSingleLineTests( + test: ValidTestCase, +): ValidTestCase[]; +/** + * Converts a batch of single line tests into a number of separate test cases. + * This makes it easier to write tests which use the same options. + * + * Why wouldn't you just leave them as one test? + * Because it makes the test error messages harder to decipher. + * This way each line will fail separately, instead of them all failing together. + * + * Make sure you have your line numbers correct for error reporting, as it will match + * the line numbers up with the split tests! + * + * @deprecated - DO NOT USE THIS FOR NEW RULES + */ +export function batchedSingleLineTests< + TMessageIds extends string, + TOptions extends readonly unknown[], +>( + test: InvalidTestCase, +): InvalidTestCase[]; +export function batchedSingleLineTests< + TMessageIds extends string, + TOptions extends readonly unknown[], +>( + options: InvalidTestCase | ValidTestCase, +): (InvalidTestCase | ValidTestCase)[] { + // -- eslint counts lines from 1 + const lineOffset = options.code.startsWith('\n') ? 2 : 1; + const output = + 'output' in options && options.output + ? options.output.trim().split('\n') + : null; + return options.code + .trim() + .split('\n') + .map((code, i) => { + const lineNum = i + lineOffset; + const errors = + 'errors' in options + ? options.errors.filter(e => e.line === lineNum) + : []; + const returnVal = { + ...options, + code, + errors: errors.map(e => ({ + ...e, + line: 1, + })), + }; + if (output?.[i]) { + return { + ...returnVal, + output: output[i], + }; + } + return returnVal; + }); +} diff --git a/packages/eslint-plugin/tests/areOptionsValid.test.ts b/packages/eslint-plugin/tests/areOptionsValid.test.ts new file mode 100644 index 00000000000..6ec3fd4dfca --- /dev/null +++ b/packages/eslint-plugin/tests/areOptionsValid.test.ts @@ -0,0 +1,32 @@ +import * as util from '../src/util'; +import { areOptionsValid } from './areOptionsValid'; + +const exampleRule = util.createRule<['value-a' | 'value-b'], never>({ + name: 'my-example-rule', + meta: { + type: 'layout', + docs: { + description: 'Detects something or other', + }, + schema: [{ type: 'string', enum: ['value-a', 'value-b'] }], + messages: {}, + }, + defaultOptions: ['value-a'], + create() { + return {}; + }, +}); + +test('returns true for valid options', () => { + expect(areOptionsValid(exampleRule, ['value-a'])).toBe(true); +}); + +describe('returns false for invalid options', () => { + test('bad enum value', () => { + expect(areOptionsValid(exampleRule, ['value-c'])).toBe(false); + }); + + test('bad type', () => { + expect(areOptionsValid(exampleRule, [true])).toBe(false); + }); +}); diff --git a/packages/eslint-plugin/tests/areOptionsValid.ts b/packages/eslint-plugin/tests/areOptionsValid.ts new file mode 100644 index 00000000000..807653deb2f --- /dev/null +++ b/packages/eslint-plugin/tests/areOptionsValid.ts @@ -0,0 +1,44 @@ +import { TSUtils } from '@typescript-eslint/utils'; +import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'; +import Ajv from 'ajv'; +import type { JSONSchema4 } from 'json-schema'; + +const ajv = new Ajv({ async: false }); + +export function areOptionsValid( + rule: RuleModule, + options: unknown, +): boolean { + const normalizedSchema = normalizeSchema(rule.meta.schema); + + const valid = ajv.validate(normalizedSchema, options); + if (typeof valid !== 'boolean') { + // Schema could not validate options synchronously. This is not allowed for ESLint rules. + return false; + } + + return valid; +} + +function normalizeSchema( + schema: JSONSchema4 | readonly JSONSchema4[], +): JSONSchema4 { + if (!TSUtils.isArray(schema)) { + return schema; + } + + if (schema.length === 0) { + return { + type: 'array', + minItems: 0, + maxItems: 0, + }; + } + + return { + type: 'array', + items: schema as JSONSchema4[], + minItems: 0, + maxItems: schema.length, + }; +} diff --git a/packages/eslint-plugin/tests/configs.test.ts b/packages/eslint-plugin/tests/configs.test.ts index a52f1d93ace..321b9792f8c 100644 --- a/packages/eslint-plugin/tests/configs.test.ts +++ b/packages/eslint-plugin/tests/configs.test.ts @@ -1,3 +1,5 @@ +import type { RuleRecommendation } from '@typescript-eslint/utils/ts-eslint'; + import plugin from '../src/index'; import rules from '../src/rules'; @@ -27,6 +29,36 @@ function filterRules(values: Record): [string, string][] { ); } +interface FilterAndMapRuleConfigsSettings { + excludeDeprecated?: boolean; + excludeTypeChecked?: boolean; + recommendations?: (RuleRecommendation | undefined)[]; +} + +function filterAndMapRuleConfigs({ + excludeDeprecated, + excludeTypeChecked, + recommendations, +}: FilterAndMapRuleConfigsSettings = {}): [string, string][] { + let result = Object.entries(rules); + + if (excludeDeprecated) { + result = result.filter(([, rule]) => !rule.meta.deprecated); + } + + if (excludeTypeChecked) { + result = result.filter(([, rule]) => !rule.meta.docs?.requiresTypeChecking); + } + + if (recommendations) { + result = result.filter(([, rule]) => + recommendations.includes(rule.meta.docs?.recommended), + ); + } + + return result.map(([name]) => [`${RULE_NAME_PREFIX}${name}`, 'error']); +} + function itHasBaseRulesOverriden( unfilteredConfigRules: Record, ): void { @@ -44,79 +76,122 @@ function itHasBaseRulesOverriden( }); } -describe('all.json config', () => { +describe('all.ts', () => { const unfilteredConfigRules: Record = plugin.configs.all.rules; - const configRules = filterRules(unfilteredConfigRules); - // note: exclude deprecated rules, this config is allowed to change between minor versions - const ruleConfigs = Object.entries(rules) - .filter(([, rule]) => !rule.meta.deprecated) - .map<[string, string]>(([name]) => [`${RULE_NAME_PREFIX}${name}`, 'error']); - it('contains all of the rules, excluding the deprecated ones', () => { + it('contains all of the rules', () => { + const configRules = filterRules(unfilteredConfigRules); + // note: exclude deprecated rules, this config is allowed to change between minor versions + const ruleConfigs = filterAndMapRuleConfigs({ + excludeDeprecated: true, + }); + expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); }); itHasBaseRulesOverriden(unfilteredConfigRules); }); -describe('recommended.json config', () => { +describe('recommended.ts', () => { const unfilteredConfigRules: Record = plugin.configs.recommended.rules; - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = Object.entries(rules) - .filter( - ([, rule]) => - rule.meta.docs?.recommended && - rule.meta.docs.recommended !== 'strict' && - rule.meta.docs?.requiresTypeChecking !== true, - ) - .map<[string, string]>(([name, rule]) => [ - `${RULE_NAME_PREFIX}${name}`, - rule.meta.docs?.recommended ? rule.meta.docs.recommended : 'off', - ]); - - it("contains all recommended rules that don't require typechecking, excluding the deprecated ones", () => { + + it('contains all recommended rules, excluding type checked ones', () => { + const configRules = filterRules(unfilteredConfigRules); + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + excludeTypeChecked: true, + recommendations: ['recommended'], + }); + expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); }); itHasBaseRulesOverriden(unfilteredConfigRules); }); -describe('recommended-requiring-type-checking.json config', () => { +describe('recommended-type-checked.ts', () => { const unfilteredConfigRules: Record = - plugin.configs['recommended-requiring-type-checking'].rules; - const configRules = filterRules(unfilteredConfigRules); - // note: include deprecated rules so that the config doesn't change between major bumps - const ruleConfigs = Object.entries(rules) - .filter( - ([, rule]) => - rule.meta.docs?.recommended && - rule.meta.docs.recommended !== 'strict' && - rule.meta.docs.requiresTypeChecking === true, - ) - .map<[string, string]>(([name, rule]) => [ - `${RULE_NAME_PREFIX}${name}`, - rule.meta.docs?.recommended ? rule.meta.docs.recommended : 'off', - ]); - - it('contains all recommended rules that require type checking, excluding the deprecated ones', () => { + plugin.configs['recommended-type-checked'].rules; + + it('contains all recommended rules', () => { + const configRules = filterRules(unfilteredConfigRules); + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['recommended'], + }); + + expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); + }); + + itHasBaseRulesOverriden(unfilteredConfigRules); +}); + +describe('strict.ts', () => { + const unfilteredConfigRules: Record = + plugin.configs.strict.rules; + + it('contains all strict rules, excluding type checked ones', () => { + const configRules = filterRules(unfilteredConfigRules); + // note: exclude deprecated rules, this config is allowed to change between minor versions + const ruleConfigs = filterAndMapRuleConfigs({ + excludeDeprecated: true, + excludeTypeChecked: true, + recommendations: ['recommended', 'strict'], + }); + expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); }); itHasBaseRulesOverriden(unfilteredConfigRules); }); -describe('strict.json config', () => { +describe('strict-type-checked.ts', () => { const unfilteredConfigRules: Record = - plugin.configs['strict'].rules; + plugin.configs['strict-type-checked'].rules; + + it('contains all strict rules', () => { + const configRules = filterRules(unfilteredConfigRules); + // note: exclude deprecated rules, this config is allowed to change between minor versions + const ruleConfigs = filterAndMapRuleConfigs({ + excludeDeprecated: true, + recommendations: ['recommended', 'strict'], + }); + expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); + }); + + itHasBaseRulesOverriden(unfilteredConfigRules); +}); + +describe('stylistic.ts', () => { + const unfilteredConfigRules: Record = + plugin.configs.stylistic.rules; + + it('contains all stylistic rules, excluding deprecated or type checked ones', () => { + const configRules = filterRules(unfilteredConfigRules); + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + excludeTypeChecked: true, + recommendations: ['stylistic'], + }); + + expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); + }); + + itHasBaseRulesOverriden(unfilteredConfigRules); +}); + +describe('stylistic-type-checked.ts', () => { + const unfilteredConfigRules: Record = + plugin.configs['stylistic-type-checked'].rules; const configRules = filterRules(unfilteredConfigRules); - const ruleConfigs = Object.entries(rules) - .filter(([, rule]) => rule.meta.docs?.recommended === 'strict') - .map<[string, string]>(([name]) => [`${RULE_NAME_PREFIX}${name}`, 'warn']); + // note: include deprecated rules so that the config doesn't change between major bumps + const ruleConfigs = filterAndMapRuleConfigs({ + recommendations: ['stylistic'], + }); - it('contains all recommended rules that require type checking, excluding the deprecated ones', () => { + it('contains all stylistic rules, excluding deprecated ones', () => { expect(entriesToObject(ruleConfigs)).toEqual(entriesToObject(configRules)); }); diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index e7872a962c9..a2bef8cac83 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -40,10 +40,11 @@ function tokenIsH2( describe('Validating rule docs', () => { const ignoredFiles = new Set([ - // this rule doc was left behind on purpose for legacy reasons - 'camelcase.md', 'README.md', 'TEMPLATE.md', + // these rule docs were left behind on purpose for legacy reasons + 'camelcase.md', + 'no-duplicate-imports.md', ]); it('All rules must have a corresponding rule doc', () => { const files = fs @@ -119,6 +120,10 @@ describe('Validating rule docs', () => { }); describe('Validating rule metadata', () => { + const rulesThatRequireTypeInformationInAWayThatsHardToDetect = new Set([ + // the core rule file doesn't use type information, instead it's used in `src/rules/naming-convention-utils/validator.ts` + 'naming-convention', + ]); function requiresFullTypeInformation(content: string): boolean { return /getParserServices(\(\s*[^,\s)]+)\s*(,\s*false\s*)?\)/.test(content); } @@ -134,6 +139,13 @@ describe('Validating rule metadata', () => { }); it('`requiresTypeChecking` should be set if the rule uses type information', () => { + if ( + rulesThatRequireTypeInformationInAWayThatsHardToDetect.has(ruleName) + ) { + expect(true).toEqual(rule.meta.docs?.requiresTypeChecking ?? false); + return; + } + // quick-and-dirty check to see if it uses parserServices // not perfect but should be good enough const ruleFileContents = fs.readFileSync( diff --git a/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts b/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts index 664392b0923..de6a73e536c 100644 --- a/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/arrow-parens.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { noFormat, RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('arrow-parens'); diff --git a/packages/eslint-plugin/tests/eslint-rules/no-dupe-args.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-dupe-args.test.ts index 5bc8d99490d..054d19140bf 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-dupe-args.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-dupe-args.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('no-dupe-args'); diff --git a/packages/eslint-plugin/tests/eslint-rules/no-implicit-globals.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-implicit-globals.test.ts index eb3fea348b5..ba4d5cc1a43 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-implicit-globals.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-implicit-globals.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('no-implicit-globals'); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts index 6061c8ebb4e..b015020fa5e 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-restricted-globals.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('no-restricted-globals'); diff --git a/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts index 3335e04e741..252b6fe2f32 100644 --- a/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('no-undef'); diff --git a/packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts b/packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts index d3bce8cfdee..e9d8350ff09 100644 --- a/packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/prefer-const.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('prefer-const'); diff --git a/packages/eslint-plugin/tests/eslint-rules/strict.test.ts b/packages/eslint-plugin/tests/eslint-rules/strict.test.ts index 83ad25a0605..a3146c36d7b 100644 --- a/packages/eslint-plugin/tests/eslint-rules/strict.test.ts +++ b/packages/eslint-plugin/tests/eslint-rules/strict.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import { getESLintCoreRule } from '../../src/util/getESLintCoreRule'; -import { RuleTester } from '../RuleTester'; const rule = getESLintCoreRule('strict'); diff --git a/packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts b/packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts new file mode 100644 index 00000000000..0c883cbef77 --- /dev/null +++ b/packages/eslint-plugin/tests/fixtures/consistent-type-exports.ts @@ -0,0 +1,4 @@ +export type Type1 = 1; +export type Type2 = 1; +export const value1 = 2; +export const value2 = 2; diff --git a/packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts b/packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts new file mode 100644 index 00000000000..df407073367 --- /dev/null +++ b/packages/eslint-plugin/tests/fixtures/mixed-enums-decl.ts @@ -0,0 +1,4 @@ +export enum Enum { + A = 'A', + B = 'B', +} diff --git a/packages/eslint-plugin/tests/fixtures/tsconfig-withmeta.json b/packages/eslint-plugin/tests/fixtures/tsconfig-withmeta.json index 4987fc7e174..a68de758522 100644 --- a/packages/eslint-plugin/tests/fixtures/tsconfig-withmeta.json +++ b/packages/eslint-plugin/tests/fixtures/tsconfig-withmeta.json @@ -1,6 +1,6 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "emitDecoratorMetadata": true, - } -} \ No newline at end of file + "extends": "./tsconfig.json", + "compilerOptions": { + "emitDecoratorMetadata": true + } +} diff --git a/packages/eslint-plugin/tests/fixtures/tsconfig.json b/packages/eslint-plugin/tests/fixtures/tsconfig.json index 7ff53268e42..6ae5e64730b 100644 --- a/packages/eslint-plugin/tests/fixtures/tsconfig.json +++ b/packages/eslint-plugin/tests/fixtures/tsconfig.json @@ -10,6 +10,8 @@ }, "include": [ "file.ts", + "consistent-type-exports.ts", + "mixed-enums-decl.ts", "react.tsx" ] } diff --git a/packages/eslint-plugin/tests/fixtures/unstrict/tsconfig.json b/packages/eslint-plugin/tests/fixtures/unstrict/tsconfig.json index 751747ef2f4..0c68dfe1f04 100644 --- a/packages/eslint-plugin/tests/fixtures/unstrict/tsconfig.json +++ b/packages/eslint-plugin/tests/fixtures/unstrict/tsconfig.json @@ -8,8 +8,5 @@ "lib": ["es2015", "es2017", "esnext"], "experimentalDecorators": true }, - "include": [ - "file.ts", - "react.tsx" - ] + "include": ["file.ts", "react.tsx"] } diff --git a/packages/eslint-plugin/tests/index.test.ts b/packages/eslint-plugin/tests/index.test.ts index 3cac8304e9c..9d791a99beb 100644 --- a/packages/eslint-plugin/tests/index.test.ts +++ b/packages/eslint-plugin/tests/index.test.ts @@ -19,6 +19,10 @@ describe('eslint-plugin ("./src/index.ts")', () => { }); it('exports all available configs', () => { - expect(configs).toEqual(expect.arrayContaining(eslintPluginConfigKeys)); + expect([ + ...configs, + // This config is deprecated eventually will be removed + 'recommended-requiring-type-checking', + ]).toEqual(expect.arrayContaining(eslintPluginConfigKeys)); }); }); diff --git a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts index 9a20771b4af..e834112f6ec 100644 --- a/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/adjacent-overload-signatures.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/adjacent-overload-signatures'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/array-type.test.ts b/packages/eslint-plugin/tests/rules/array-type.test.ts index 04ab47d0b8a..44be83ff63d 100644 --- a/packages/eslint-plugin/tests/rules/array-type.test.ts +++ b/packages/eslint-plugin/tests/rules/array-type.test.ts @@ -1,9 +1,10 @@ import * as parser from '@typescript-eslint/parser'; +import { RuleTester } from '@typescript-eslint/rule-tester'; import { TSESLint } from '@typescript-eslint/utils'; import type { OptionString } from '../../src/rules/array-type'; import rule from '../../src/rules/array-type'; -import { RuleTester } from '../RuleTester'; +import { areOptionsValid } from '../areOptionsValid'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -2156,3 +2157,19 @@ type BrokenArray = { ); }); }); + +describe('schema validation', () => { + // https://github.com/typescript-eslint/typescript-eslint/issues/6852 + test("array-type does not accept 'simple-array' option", () => { + if (areOptionsValid(rule, [{ default: 'simple-array' }])) { + throw new Error(`Options succeeded validation for bad options`); + } + }); + + // https://github.com/typescript-eslint/typescript-eslint/issues/6892 + test('array-type does not accept non object option', () => { + if (areOptionsValid(rule, ['array'])) { + throw new Error(`Options succeeded validation for bad options`); + } + }); +}); diff --git a/packages/eslint-plugin/tests/rules/await-thenable.test.ts b/packages/eslint-plugin/tests/rules/await-thenable.test.ts index 3dc786896c0..4b51a75ac8b 100644 --- a/packages/eslint-plugin/tests/rules/await-thenable.test.ts +++ b/packages/eslint-plugin/tests/rules/await-thenable.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/await-thenable'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const messageId = 'await'; diff --git a/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts b/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts index 54855f19cf3..271b2d27a03 100644 --- a/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/ban-ts-comment'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts b/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts index 654bb18c2c6..01f6ec078a8 100644 --- a/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-tslint-comment.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/ban-tslint-comment'; -import { RuleTester } from '../RuleTester'; interface Testable { code: string; diff --git a/packages/eslint-plugin/tests/rules/ban-types.test.ts b/packages/eslint-plugin/tests/rules/ban-types.test.ts index 7883f0f45df..c74df23f4f3 100644 --- a/packages/eslint-plugin/tests/rules/ban-types.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-types.test.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../src/rules/ban-types'; import rule, { TYPE_KEYWORDS } from '../../src/rules/ban-types'; import { objectReduceKey } from '../../src/util'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -136,6 +136,43 @@ ruleTester.run('ban-types', rule, { ], options, }, + { + code: 'let a: Object;', + errors: [ + { + messageId: 'bannedTypeMessage', + data: { + name: 'Object', + customMessage: [ + ' The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.', + '- If you want a type meaning "any object", you probably want `object` instead.', + '- If you want a type meaning "any value", you probably want `unknown` instead.', + '- If you really want a type meaning "any non-nullish value", you probably want `NonNullable` instead.', + ].join('\n'), + }, + line: 1, + column: 8, + suggestions: [ + { + messageId: 'bannedTypeReplacement', + data: { name: 'Object', replacement: 'object' }, + output: 'let a: object;', + }, + { + messageId: 'bannedTypeReplacement', + data: { name: 'Object', replacement: 'unknown' }, + output: 'let a: unknown;', + }, + { + messageId: 'bannedTypeReplacement', + data: { name: 'Object', replacement: 'NonNullable' }, + output: 'let a: NonNullable;', + }, + ], + }, + ], + options: [{}], + }, { code: 'let aa: Foo;', errors: [ @@ -620,6 +657,81 @@ let baz: object = {}; }, ], }, + { + code: 'type Baz = 1 & Foo;', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Foo: { message: '' }, + }, + }, + ], + }, + { + code: 'interface Foo extends Bar {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: '' }, + }, + }, + ], + }, + { + code: 'interface Foo extends Bar, Baz {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: '' }, + }, + }, + ], + }, + { + code: 'class Foo implements Bar {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: '' }, + }, + }, + ], + }, + { + code: 'class Foo implements Bar, Baz {}', + errors: [ + { + messageId: 'bannedTypeMessage', + }, + ], + options: [ + { + types: { + Bar: { message: 'Bla' }, + }, + }, + ], + }, ...objectReduceKey( TYPE_KEYWORDS, (acc: TSESLint.InvalidTestCase[], key) => { diff --git a/packages/eslint-plugin/tests/rules/block-spacing.test.ts b/packages/eslint-plugin/tests/rules/block-spacing.test.ts index 49578b8c061..dabb15e692f 100644 --- a/packages/eslint-plugin/tests/rules/block-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/block-spacing.test.ts @@ -1,15 +1,18 @@ +import type { + InvalidTestCase, + ValidTestCase, +} from '@typescript-eslint/rule-tester'; +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/block-spacing'; -import type { InvalidTestCase, ValidTestCase } from '../RuleTester'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); type InvalidBlockSpacingTestCase = InvalidTestCase< - 'missing' | 'extra', + 'extra' | 'missing', ['always' | 'never'] >; diff --git a/packages/eslint-plugin/tests/rules/brace-style.test.ts b/packages/eslint-plugin/tests/rules/brace-style.test.ts index 35bc5afe996..ec1ac6b3bc5 100644 --- a/packages/eslint-plugin/tests/rules/brace-style.test.ts +++ b/packages/eslint-plugin/tests/rules/brace-style.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/brace-style'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/class-literal-property-style.test.ts b/packages/eslint-plugin/tests/rules/class-literal-property-style.test.ts index af0aa203df7..6eeda2a62fb 100644 --- a/packages/eslint-plugin/tests/rules/class-literal-property-style.test.ts +++ b/packages/eslint-plugin/tests/rules/class-literal-property-style.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/class-literal-property-style'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -185,11 +186,6 @@ class Mx { get p1() { return 'hello world'; } -} - `, - output: ` -class Mx { - readonly p1 = 'hello world'; } `, errors: [ @@ -197,6 +193,16 @@ class Mx { messageId: 'preferFieldStyle', column: 7, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + readonly p1 = 'hello world'; +} + `, + }, + ], }, ], }, @@ -206,11 +212,6 @@ class Mx { get p1() { return \`hello world\`; } -} - `, - output: ` -class Mx { - readonly p1 = \`hello world\`; } `, errors: [ @@ -218,6 +219,16 @@ class Mx { messageId: 'preferFieldStyle', column: 7, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + readonly p1 = \`hello world\`; +} + `, + }, + ], }, ], }, @@ -227,11 +238,6 @@ class Mx { static get p1() { return 'hello world'; } -} - `, - output: ` -class Mx { - static readonly p1 = 'hello world'; } `, errors: [ @@ -239,6 +245,16 @@ class Mx { messageId: 'preferFieldStyle', column: 14, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + static readonly p1 = 'hello world'; +} + `, + }, + ], }, ], }, @@ -248,11 +264,6 @@ class Mx { public static get foo() { return 1; } -} - `, - output: ` -class Mx { - public static readonly foo = 1; } `, errors: [ @@ -260,6 +271,16 @@ class Mx { messageId: 'preferFieldStyle', column: 21, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + public static readonly foo = 1; +} + `, + }, + ], }, ], }, @@ -269,11 +290,6 @@ class Mx { public get [myValue]() { return 'a literal value'; } -} - `, - output: ` -class Mx { - public readonly [myValue] = 'a literal value'; } `, errors: [ @@ -281,6 +297,16 @@ class Mx { messageId: 'preferFieldStyle', column: 15, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + public readonly [myValue] = 'a literal value'; +} + `, + }, + ], }, ], }, @@ -290,11 +316,6 @@ class Mx { public get [myValue]() { return 12345n; } -} - `, - output: ` -class Mx { - public readonly [myValue] = 12345n; } `, errors: [ @@ -302,6 +323,16 @@ class Mx { messageId: 'preferFieldStyle', column: 15, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + public readonly [myValue] = 12345n; +} + `, + }, + ], }, ], }, @@ -309,11 +340,6 @@ class Mx { code: ` class Mx { public readonly [myValue] = 'a literal value'; -} - `, - output: ` -class Mx { - public get [myValue]() { return 'a literal value'; } } `, errors: [ @@ -321,6 +347,16 @@ class Mx { messageId: 'preferGetterStyle', column: 20, line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` +class Mx { + public get [myValue]() { return 'a literal value'; } +} + `, + }, + ], }, ], options: ['getters'], @@ -329,11 +365,6 @@ class Mx { code: ` class Mx { readonly p1 = 'hello world'; -} - `, - output: ` -class Mx { - get p1() { return 'hello world'; } } `, errors: [ @@ -341,6 +372,16 @@ class Mx { messageId: 'preferGetterStyle', column: 12, line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` +class Mx { + get p1() { return 'hello world'; } +} + `, + }, + ], }, ], options: ['getters'], @@ -349,11 +390,6 @@ class Mx { code: ` class Mx { readonly p1 = \`hello world\`; -} - `, - output: ` -class Mx { - get p1() { return \`hello world\`; } } `, errors: [ @@ -361,6 +397,16 @@ class Mx { messageId: 'preferGetterStyle', column: 12, line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` +class Mx { + get p1() { return \`hello world\`; } +} + `, + }, + ], }, ], options: ['getters'], @@ -369,11 +415,6 @@ class Mx { code: ` class Mx { static readonly p1 = 'hello world'; -} - `, - output: ` -class Mx { - static get p1() { return 'hello world'; } } `, errors: [ @@ -381,6 +422,16 @@ class Mx { messageId: 'preferGetterStyle', column: 19, line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` +class Mx { + static get p1() { return 'hello world'; } +} + `, + }, + ], }, ], options: ['getters'], @@ -391,11 +442,6 @@ class Mx { protected get p1() { return 'hello world'; } -} - `, - output: ` -class Mx { - protected readonly p1 = 'hello world'; } `, errors: [ @@ -403,6 +449,16 @@ class Mx { messageId: 'preferFieldStyle', column: 17, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + protected readonly p1 = 'hello world'; +} + `, + }, + ], }, ], options: ['fields'], @@ -411,11 +467,6 @@ class Mx { code: ` class Mx { protected readonly p1 = 'hello world'; -} - `, - output: ` -class Mx { - protected get p1() { return 'hello world'; } } `, errors: [ @@ -423,6 +474,16 @@ class Mx { messageId: 'preferGetterStyle', column: 22, line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` +class Mx { + protected get p1() { return 'hello world'; } +} + `, + }, + ], }, ], options: ['getters'], @@ -433,11 +494,6 @@ class Mx { public static get p1() { return 'hello world'; } -} - `, - output: ` -class Mx { - public static readonly p1 = 'hello world'; } `, errors: [ @@ -445,6 +501,16 @@ class Mx { messageId: 'preferFieldStyle', column: 21, line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` +class Mx { + public static readonly p1 = 'hello world'; +} + `, + }, + ], }, ], }, @@ -452,11 +518,6 @@ class Mx { code: ` class Mx { public static readonly p1 = 'hello world'; -} - `, - output: ` -class Mx { - public static get p1() { return 'hello world'; } } `, errors: [ @@ -464,6 +525,16 @@ class Mx { messageId: 'preferGetterStyle', column: 26, line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` +class Mx { + public static get p1() { return 'hello world'; } +} + `, + }, + ], }, ], options: ['getters'], @@ -483,7 +554,15 @@ class Mx { } } `, - output: ` + errors: [ + { + messageId: 'preferFieldStyle', + column: 14, + line: 3, + suggestions: [ + { + messageId: 'preferFieldStyleSuggestion', + output: ` class Mx { public readonly myValue = gql\` { @@ -495,11 +574,8 @@ class Mx { \`; } `, - errors: [ - { - messageId: 'preferFieldStyle', - column: 14, - line: 3, + }, + ], }, ], }, @@ -516,7 +592,15 @@ class Mx { \`; } `, - output: ` + errors: [ + { + messageId: 'preferGetterStyle', + column: 19, + line: 3, + suggestions: [ + { + messageId: 'preferGetterStyleSuggestion', + output: ` class Mx { public get myValue() { return gql\` { @@ -528,11 +612,8 @@ class Mx { \`; } } `, - errors: [ - { - messageId: 'preferGetterStyle', - column: 19, - line: 3, + }, + ], }, ], options: ['getters'], diff --git a/packages/eslint-plugin/tests/rules/comma-dangle.test.ts b/packages/eslint-plugin/tests/rules/comma-dangle.test.ts index 1e94e982971..148f05c0a77 100644 --- a/packages/eslint-plugin/tests/rules/comma-dangle.test.ts +++ b/packages/eslint-plugin/tests/rules/comma-dangle.test.ts @@ -2,8 +2,9 @@ // this rule tests the new lines, which prettier will want to fix and break the tests /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/comma-dangle'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -75,6 +76,9 @@ ruleTester.run('comma-dangle', rule, { { code: 'type Foo = [string\n]', options: [{ tuples: 'only-multiline' }] }, { code: 'type Foo = [string,\n]', options: [{ tuples: 'only-multiline' }] }, + // ignore + { code: 'const a = () => {}', options: [{ generics: 'ignore' }] }, + // each options { code: ` diff --git a/packages/eslint-plugin/tests/rules/comma-spacing.test.ts b/packages/eslint-plugin/tests/rules/comma-spacing.test.ts index 37eb6e2e3ad..d86edef2ae3 100644 --- a/packages/eslint-plugin/tests/rules/comma-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/comma-spacing.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/comma-spacing'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -282,6 +283,55 @@ ruleTester.run('comma-spacing', rule, { 'interface Foo{}', 'interface A<> {}', 'let foo,', + 'const arr = [,];', + 'const arr = [ ,];', + 'const arr = [ , ];', + 'const arr = [1,];', + 'const arr = [ , 2];', + 'const arr = [,,];', + 'const arr = [ ,,];', + 'const arr = [, ,];', + 'const arr = [,, ];', + 'const arr = [ , ,];', + 'const arr = [ ,, ];', + 'const arr = [ , , ];', + 'const arr = [,, 3];', + 'const arr = [1, 2, 3,];', + 'const arr = [1, 2, 3, ];', + "const obj = {'foo':'bar', 'baz':'qur', };", + "const obj = {'foo':'bar', 'baz':'qur',};", + { code: 'const arr = [ ,];', options: [{ before: true, after: false }] }, + { code: 'const arr = [, ];', options: [{ before: true, after: false }] }, + { code: 'const arr = [ , ];', options: [{ before: true, after: false }] }, + { code: 'const arr = [ ,,];', options: [{ before: true, after: false }] }, + { code: 'const arr = [, ,];', options: [{ before: true, after: false }] }, + { code: 'const arr = [,, ];', options: [{ before: true, after: false }] }, + { code: 'const arr = [ , ,];', options: [{ before: true, after: false }] }, + { code: 'const arr = [ ,, ];', options: [{ before: true, after: false }] }, + { code: 'const arr = [, , ];', options: [{ before: true, after: false }] }, + { code: 'const arr = [ , , ];', options: [{ before: true, after: false }] }, + { + code: 'const arr = [ , , ];', + options: [{ before: false, after: false }], + }, + { code: 'const [a, b,] = [1, 2];', parserOptions: { ecmaVersion: 6 } }, + { + code: 'Hello, world', + options: [{ before: true, after: false }], + parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } }, + }, + { code: '[a, /**/ , ]', options: [{ before: false, after: true }] }, + { code: '[a , /**/, ]', options: [{ before: true, after: true }] }, + { + code: '[a, /**/ , ] = foo', + options: [{ before: false, after: true }], + parserOptions: { ecmaVersion: 6 }, + }, + { + code: '[a , /**/, ] = foo', + options: [{ before: true, after: true }], + parserOptions: { ecmaVersion: 6 }, + }, ], invalid: [ diff --git a/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts b/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts index 6c53d13861c..f21dac8f639 100644 --- a/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-generic-constructors.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/consistent-generic-constructors'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts b/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts index 6bdc76362e0..2b1aa4661a9 100644 --- a/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-indexed-object-style.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/consistent-indexed-object-style'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts index 98fcdc02605..170aa8b1696 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-assertions.test.ts @@ -1,5 +1,13 @@ +/* eslint-disable deprecation/deprecation -- TODO - migrate this test away from `batchedSingleLineTests` */ + +import { RuleTester } from '@typescript-eslint/rule-tester'; + +import type { + MessageIds, + Options, +} from '../../src/rules/consistent-type-assertions'; import rule from '../../src/rules/consistent-type-assertions'; -import { batchedSingleLineTests, RuleTester } from '../RuleTester'; +import { batchedSingleLineTests } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -9,7 +17,12 @@ const ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE = ` const x = new Generic(); const x = b; const x = [1]; -const x = ('string');`; +const x = ('string'); +const x = !'string'; +const x = a + b; +const x = <(A)>a + (b); +const x = (new Generic()); +const x = (new (Generic)());`; const ANGLE_BRACKET_TESTS = `${ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE} const x = { key: 'value' }; @@ -19,7 +32,12 @@ const AS_TESTS_EXCEPT_CONST_CASE = ` const x = new Generic() as Foo; const x = b as A; const x = [1] as readonly number[]; -const x = ('string') as a | b;`; +const x = ('string') as a | b; +const x = !'string' as A; +const x = a as A + b; +const x = a as (A) + (b); +const x = (new Generic()) as Foo; +const x = (new (Generic as Foo)());`; const AS_TESTS = `${AS_TESTS_EXCEPT_CONST_CASE} const x = { key: 'value' } as const; @@ -27,9 +45,13 @@ const x = { key: 'value' } as const; const OBJECT_LITERAL_AS_CASTS = ` const x = {} as Foo; +const x = ({}) as a | b; +const x = {} as A + b; `; const OBJECT_LITERAL_ANGLE_BRACKET_CASTS = ` const x = >{}; +const x = ({}); +const x = {} + b; `; const OBJECT_LITERAL_ARGUMENT_AS_CASTS = ` print({ bar: 5 } as Foo) @@ -50,7 +72,7 @@ print?.call({ bar: 5 }) ruleTester.run('consistent-type-assertions', rule, { valid: [ - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: AS_TESTS, options: [ { @@ -59,7 +81,7 @@ ruleTester.run('consistent-type-assertions', rule, { }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: ANGLE_BRACKET_TESTS, options: [ { @@ -68,7 +90,7 @@ ruleTester.run('consistent-type-assertions', rule, { }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, options: [ { @@ -77,7 +99,7 @@ ruleTester.run('consistent-type-assertions', rule, { }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, options: [ { @@ -86,7 +108,7 @@ ruleTester.run('consistent-type-assertions', rule, { }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: OBJECT_LITERAL_ARGUMENT_AS_CASTS, options: [ { @@ -95,7 +117,7 @@ ruleTester.run('consistent-type-assertions', rule, { }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS, options: [ { @@ -136,7 +158,7 @@ ruleTester.run('consistent-type-assertions', rule, { }, ], invalid: [ - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: AS_TESTS, options: [ { @@ -164,9 +186,29 @@ ruleTester.run('consistent-type-assertions', rule, { messageId: 'angle-bracket', line: 6, }, + { + messageId: 'angle-bracket', + line: 7, + }, + { + messageId: 'angle-bracket', + line: 8, + }, + { + messageId: 'angle-bracket', + line: 9, + }, + { + messageId: 'angle-bracket', + line: 10, + }, + { + messageId: 'angle-bracket', + line: 11, + }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: ANGLE_BRACKET_TESTS, options: [ { @@ -194,9 +236,30 @@ ruleTester.run('consistent-type-assertions', rule, { messageId: 'as', line: 6, }, + { + messageId: 'as', + line: 7, + }, + { + messageId: 'as', + line: 8, + }, + { + messageId: 'as', + line: 9, + }, + { + messageId: 'as', + line: 10, + }, + { + messageId: 'as', + line: 11, + }, ], + output: AS_TESTS, }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: AS_TESTS_EXCEPT_CONST_CASE, options: [ { @@ -224,9 +287,25 @@ ruleTester.run('consistent-type-assertions', rule, { messageId: 'never', line: 6, }, + { + messageId: 'never', + line: 7, + }, + { + messageId: 'never', + line: 8, + }, + { + messageId: 'never', + line: 9, + }, + { + messageId: 'never', + line: 10, + }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: ANGLE_BRACKET_TESTS_EXCEPT_CONST_CASE, options: [ { @@ -254,9 +333,25 @@ ruleTester.run('consistent-type-assertions', rule, { messageId: 'never', line: 6, }, + { + messageId: 'never', + line: 7, + }, + { + messageId: 'never', + line: 8, + }, + { + messageId: 'never', + line: 9, + }, + { + messageId: 'never', + line: 10, + }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: OBJECT_LITERAL_AS_CASTS, options: [ { @@ -268,10 +363,49 @@ ruleTester.run('consistent-type-assertions', rule, { { messageId: 'unexpectedObjectTypeAssertion', line: 2, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'Foo' }, + output: 'const x: Foo = {};', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'const x = {} satisfies Foo;', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 3, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'a | b' }, + output: 'const x: a | b = ({});', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'a | b' }, + output: 'const x = ({}) satisfies a | b;', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 4, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'A' }, + output: 'const x = {} satisfies A + b;', + }, + ], }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: OBJECT_LITERAL_ANGLE_BRACKET_CASTS, options: [ { @@ -283,10 +417,49 @@ ruleTester.run('consistent-type-assertions', rule, { { messageId: 'unexpectedObjectTypeAssertion', line: 2, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'Foo' }, + output: 'const x: Foo = {};', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'const x = {} satisfies Foo;', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 3, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'a | b' }, + output: 'const x: a | b = ({});', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'a | b' }, + output: 'const x = ({}) satisfies a | b;', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 4, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'A' }, + output: 'const x = {} satisfies A + b;', + }, + ], }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: `${OBJECT_LITERAL_AS_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_AS_CASTS}`, options: [ { @@ -298,38 +471,126 @@ ruleTester.run('consistent-type-assertions', rule, { { messageId: 'unexpectedObjectTypeAssertion', line: 2, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'Foo' }, + output: 'const x: Foo = {};', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'const x = {} satisfies Foo;', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 3, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'a | b' }, + output: 'const x: a | b = ({});', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'a | b' }, + output: 'const x = ({}) satisfies a | b;', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 4, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'A' }, + output: 'const x = {} satisfies A + b;', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 5, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'print({ bar: 5 } satisfies Foo)', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 6, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'new print({ bar: 5 } satisfies Foo)', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 7, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'function foo() { throw { bar: 5 } satisfies Foo }', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 8, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo.Bar' }, + output: 'function b(x = {} satisfies Foo.Bar) {}', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 9, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'function c(x = {} satisfies Foo) {}', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 10, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'print?.({ bar: 5 } satisfies Foo)', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 11, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'print?.call({ bar: 5 } satisfies Foo)', + }, + ], }, ], }), - ...batchedSingleLineTests({ + ...batchedSingleLineTests({ code: `${OBJECT_LITERAL_ANGLE_BRACKET_CASTS.trimEnd()}${OBJECT_LITERAL_ARGUMENT_ANGLE_BRACKET_CASTS}`, options: [ { @@ -341,26 +602,100 @@ ruleTester.run('consistent-type-assertions', rule, { { messageId: 'unexpectedObjectTypeAssertion', line: 2, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'Foo' }, + output: 'const x: Foo = {};', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'const x = {} satisfies Foo;', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 3, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithAnnotation', + data: { cast: 'a | b' }, + output: 'const x: a | b = ({});', + }, + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'a | b' }, + output: 'const x = ({}) satisfies a | b;', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 4, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'A' }, + output: 'const x = {} satisfies A + b;', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 5, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'print({ bar: 5 } satisfies Foo)', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 6, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'new print({ bar: 5 } satisfies Foo)', + }, + ], }, { messageId: 'unexpectedObjectTypeAssertion', line: 7, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'function foo() { throw { bar: 5 } satisfies Foo }', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 8, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'print?.({ bar: 5 } satisfies Foo)', + }, + ], + }, + { + messageId: 'unexpectedObjectTypeAssertion', + line: 9, + suggestions: [ + { + messageId: 'replaceObjectTypeAssertionWithSatisfies', + data: { cast: 'Foo' }, + output: 'print?.call({ bar: 5 } satisfies Foo)', + }, + ], }, ], }), diff --git a/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts index 356162dcb6f..b0a2092994d 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/consistent-type-definitions'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts index e5f7bfbc2d3..2b8cdf15bb2 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-exports.test.ts @@ -1,5 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/consistent-type-exports'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); @@ -15,10 +17,12 @@ const ruleTester = new RuleTester({ ruleTester.run('consistent-type-exports', rule, { valid: [ + // unknown module should be ignored "export { Foo } from 'foo';", - "export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';", - "export { BlockScope } from '@typescript-eslint/utils';", - "export type { BlockScope } from '@typescript-eslint/utils';", + + "export type { Type1 } from './consistent-type-exports';", + "export { value1 } from './consistent-type-exports';", + "export type { value1 } from './consistent-type-exports';", ` const variable = 1; class Class {} @@ -53,9 +57,8 @@ export { NonTypeNS }; ], invalid: [ { - code: "export { AnalyzeOptions } from '@typescript-eslint/scope-manager';", - output: - "export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';", + code: "export { Type1 } from './consistent-type-exports';", + output: "export type { Type1 } from './consistent-type-exports';", errors: [ { messageId: 'typeOverValue', @@ -65,10 +68,10 @@ export { NonTypeNS }; ], }, { - code: "export { AnalyzeOptions, BlockScope } from '@typescript-eslint/scope-manager';", + code: "export { Type1, value1 } from './consistent-type-exports';", output: - `export type { AnalyzeOptions } from '@typescript-eslint/scope-manager';\n` + - `export { BlockScope } from '@typescript-eslint/scope-manager';`, + `export type { Type1 } from './consistent-type-exports';\n` + + `export { value1 } from './consistent-type-exports';`, errors: [ { messageId: 'singleExportIsType', @@ -79,15 +82,11 @@ export { NonTypeNS }; }, { code: ` -export { - AnalyzeOptions, - BlockScope, - CatchScope, -} from '@typescript-eslint/scope-manager'; +export { Type1, value1, value2 } from './consistent-type-exports'; `, output: ` -export type { AnalyzeOptions } from '@typescript-eslint/scope-manager'; -export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; +export type { Type1 } from './consistent-type-exports'; +export { value1, value2 } from './consistent-type-exports'; `, errors: [ { @@ -99,16 +98,11 @@ export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; }, { code: ` -export { - AnalyzeOptions, - BlockScope, - Definition, - CatchScope, -} from '@typescript-eslint/scope-manager'; +export { Type1, value1, Type2, value2 } from './consistent-type-exports'; `, output: ` -export type { AnalyzeOptions, Definition } from '@typescript-eslint/scope-manager'; -export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; +export type { Type1, Type2 } from './consistent-type-exports'; +export { value1, value2 } from './consistent-type-exports'; `, errors: [ { @@ -119,9 +113,8 @@ export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; ], }, { - code: "export { Definition as Foo } from '@typescript-eslint/scope-manager';", - output: - "export type { Definition as Foo } from '@typescript-eslint/scope-manager';", + code: "export { Type2 as Foo } from './consistent-type-exports';", + output: "export type { Type2 as Foo } from './consistent-type-exports';", errors: [ { messageId: 'typeOverValue', @@ -132,14 +125,11 @@ export { BlockScope, CatchScope } from '@typescript-eslint/scope-manager'; }, { code: ` -export { - Definition as Foo, - BlockScope, -} from '@typescript-eslint/scope-manager'; +export { Type2 as Foo, value1 } from './consistent-type-exports'; `, output: ` -export type { Definition as Foo } from '@typescript-eslint/scope-manager'; -export { BlockScope } from '@typescript-eslint/scope-manager'; +export type { Type2 as Foo } from './consistent-type-exports'; +export { value1 } from './consistent-type-exports'; `, errors: [ { @@ -152,14 +142,14 @@ export { BlockScope } from '@typescript-eslint/scope-manager'; { code: ` export { - Definition as Foo, - BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + Type2 as Foo, + value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, output: ` -export type { Definition as Foo } from '@typescript-eslint/scope-manager'; -export { BlockScope as BScope, CatchScope as CScope } from '@typescript-eslint/scope-manager'; +export type { Type2 as Foo } from './consistent-type-exports'; +export { value1 as BScope, value2 as CScope } from './consistent-type-exports'; `, errors: [ { @@ -171,12 +161,12 @@ export { BlockScope as BScope, CatchScope as CScope } from '@typescript-eslint/s }, { code: ` -import { Definition } from '@typescript-eslint/scope-manager'; -export { Definition }; +import { Type2 } from './consistent-type-exports'; +export { Type2 }; `, output: ` -import { Definition } from '@typescript-eslint/scope-manager'; -export type { Definition }; +import { Type2 } from './consistent-type-exports'; +export type { Type2 }; `, errors: [ { @@ -188,13 +178,13 @@ export type { Definition }; }, { code: ` -import { CatchScope, Definition } from '@typescript-eslint/scope-manager'; -export { CatchScope, Definition }; +import { value2, Type2 } from './consistent-type-exports'; +export { value2, Type2 }; `, output: ` -import { CatchScope, Definition } from '@typescript-eslint/scope-manager'; -export type { Definition }; -export { CatchScope }; +import { value2, Type2 } from './consistent-type-exports'; +export type { Type2 }; +export { value2 }; `, errors: [ { @@ -367,15 +357,15 @@ export type { T, T }; { code: ` export { - AnalyzeOptions, - Definition as Foo, - type BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + Type1, + Type2 as Foo, + type value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, output: ` -export type { AnalyzeOptions, Definition as Foo, BlockScope as BScope } from '@typescript-eslint/scope-manager'; -export { CatchScope as CScope } from '@typescript-eslint/scope-manager'; +export type { Type1, Type2 as Foo, value1 as BScope } from './consistent-type-exports'; +export { value2 as CScope } from './consistent-type-exports'; `, dependencyConstraints: { typescript: '4.5', @@ -392,19 +382,19 @@ export { CatchScope as CScope } from '@typescript-eslint/scope-manager'; { code: ` export { - AnalyzeOptions, - Definition as Foo, - type BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + Type1, + Type2 as Foo, + type value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, output: ` export { - type AnalyzeOptions, - type Definition as Foo, - type BlockScope as BScope, - CatchScope as CScope, -} from '@typescript-eslint/scope-manager'; + type Type1, + type Type2 as Foo, + type value1 as BScope, + value2 as CScope, +} from './consistent-type-exports'; `, dependencyConstraints: { typescript: '4.5', diff --git a/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts index 2d41b0c3f98..1910b1986ee 100644 --- a/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/consistent-type-imports.test.ts @@ -1,5 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/consistent-type-imports'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -14,6 +16,7 @@ const ruleTester = new RuleTester({ }); const withMetaParserOptions = { + EXPERIMENTAL_useProjectService: false, tsconfigRootDir: getFixturesRootDir(), project: './tsconfig-withmeta.json', }; @@ -681,11 +684,11 @@ export type Y = { { code: ` import foo from 'foo'; - type Baz = typeof foo.bar['Baz']; // TSQualifiedName & TSTypeQuery + type Baz = (typeof foo.bar)['Baz']; // TSQualifiedName & TSTypeQuery `, output: ` import type foo from 'foo'; - type Baz = typeof foo.bar['Baz']; // TSQualifiedName & TSTypeQuery + type Baz = (typeof foo.bar)['Baz']; // TSQualifiedName & TSTypeQuery `, errors: [ { diff --git a/packages/eslint-plugin/tests/rules/default-param-last.test.ts b/packages/eslint-plugin/tests/rules/default-param-last.test.ts index aa0ffbc8743..317434d9d44 100644 --- a/packages/eslint-plugin/tests/rules/default-param-last.test.ts +++ b/packages/eslint-plugin/tests/rules/default-param-last.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/default-param-last'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/dot-notation.test.ts b/packages/eslint-plugin/tests/rules/dot-notation.test.ts index 9b6e2ba0fae..b7ebac3d412 100644 --- a/packages/eslint-plugin/tests/rules/dot-notation.test.ts +++ b/packages/eslint-plugin/tests/rules/dot-notation.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/dot-notation'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts index d3c1a540192..a17a27dec17 100644 --- a/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-function-return-type.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/explicit-function-return-type'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -8,7 +9,6 @@ const ruleTester = new RuleTester({ ruleTester.run('explicit-function-return-type', rule, { valid: [ { - filename: 'test.ts', code: ` function test(): void { return; @@ -16,7 +16,6 @@ function test(): void { `, }, { - filename: 'test.ts', code: ` var fn = function (): number { return 1; @@ -24,13 +23,11 @@ var fn = function (): number { `, }, { - filename: 'test.ts', code: ` var arrowFn = (): string => 'test'; `, }, { - filename: 'test.ts', code: ` class Test { constructor() {} @@ -46,7 +43,6 @@ class Test { `, }, { - filename: 'test.ts', code: 'fn(() => {});', options: [ { @@ -55,7 +51,6 @@ class Test { ], }, { - filename: 'test.ts', code: 'fn(function () {});', options: [ { @@ -64,7 +59,6 @@ class Test { ], }, { - filename: 'test.ts', code: '[function () {}, () => {}];', options: [ { @@ -73,7 +67,6 @@ class Test { ], }, { - filename: 'test.ts', code: '(function () {});', options: [ { @@ -82,7 +75,6 @@ class Test { ], }, { - filename: 'test.ts', code: '(() => {})();', options: [ { @@ -91,7 +83,6 @@ class Test { ], }, { - filename: 'test.ts', code: 'export default (): void => {};', options: [ { @@ -100,7 +91,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` var arrowFn: Foo = () => 'test'; `, @@ -111,7 +101,6 @@ var arrowFn: Foo = () => 'test'; ], }, { - filename: 'test.ts', code: ` var funcExpr: Foo = function () { return 'test'; @@ -124,17 +113,14 @@ var funcExpr: Foo = function () { ], }, { - filename: 'test.ts', code: 'const x = (() => {}) as Foo;', options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: 'const x = (() => {});', options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` const x = { foo: () => {}, @@ -143,7 +129,6 @@ const x = { options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` const x = { foo: () => {}, @@ -152,7 +137,6 @@ const x = { options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` const x: Foo = { foo: () => {}, @@ -162,7 +146,6 @@ const x: Foo = { }, // https://github.com/typescript-eslint/typescript-eslint/issues/2864 { - filename: 'test.ts', code: ` const x = { foo: { bar: () => {} }, @@ -171,7 +154,6 @@ const x = { options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` const x = { foo: { bar: () => {} }, @@ -180,7 +162,6 @@ const x = { options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` const x: Foo = { foo: { bar: () => {} }, @@ -190,7 +171,6 @@ const x: Foo = { }, // https://github.com/typescript-eslint/typescript-eslint/issues/484 { - filename: 'test.ts', code: ` type MethodType = () => void; @@ -202,7 +182,6 @@ class App { }, // https://github.com/typescript-eslint/typescript-eslint/issues/525 { - filename: 'test.ts', code: ` const myObj = { set myProp(val) { @@ -212,21 +191,18 @@ const myObj = { `, }, { - filename: 'test.ts', code: ` () => (): void => {}; `, options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` () => function (): void {}; `, options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` () => { return (): void => {}; @@ -235,7 +211,6 @@ const myObj = { options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` () => { return function (): void {}; @@ -244,7 +219,6 @@ const myObj = { options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` function fn() { return (): void => {}; @@ -253,7 +227,6 @@ function fn() { options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` function fn() { return function (): void {}; @@ -262,7 +235,6 @@ function fn() { options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` function FunctionDeclaration() { return function FunctionExpression_Within_FunctionDeclaration() { @@ -281,7 +253,6 @@ function FunctionDeclaration() { options: [{ allowHigherOrderFunctions: true }], }, { - filename: 'test.ts', code: ` () => () => { return (): void => { @@ -293,7 +264,6 @@ function FunctionDeclaration() { }, // https://github.com/typescript-eslint/typescript-eslint/issues/679 { - filename: 'test.ts', code: ` declare function foo(arg: () => void): void; foo(() => 1); @@ -309,7 +279,6 @@ foo(() => ''); ], }, { - filename: 'test.ts', code: ` declare function foo(arg: () => void): void; foo?.(() => 1); @@ -325,7 +294,6 @@ foo?.(() => ''); ], }, { - filename: 'test.ts', code: ` class Accumulator { private count: number = 0; @@ -344,7 +312,6 @@ new Accumulator().accumulate(() => 1); ], }, { - filename: 'test.ts', code: ` declare function foo(arg: { meth: () => number }): void; foo({ @@ -370,7 +337,6 @@ foo({ ], }, { - filename: 'test.ts', code: ` const func = (value: number) => ({ type: 'X', value } as const); const func = (value: number) => ({ type: 'X', value } as const); @@ -384,7 +350,6 @@ const func = (value: number) => x as const; ], }, { - filename: 'test.ts', code: ` new Promise(resolve => {}); new Foo(1, () => {}); @@ -396,7 +361,6 @@ new Foo(1, () => {}); ], }, { - filename: 'test.ts', code: 'const log = (message: string) => void console.log(message);', options: [{ allowConciseArrowFunctionExpressionsStartingWithVoid: true }], }, @@ -441,7 +405,6 @@ const log = function (a: A): string { options: [{ allowFunctionsWithoutTypeParameters: true }], }, { - filename: 'test.ts', options: [ { allowedNames: ['test1', 'test2'], @@ -458,7 +421,6 @@ const foo = function test2() { `, }, { - filename: 'test.ts', options: [ { allowedNames: ['test1', 'test2'], @@ -474,7 +436,6 @@ const foo = function () { `, }, { - filename: 'test.ts', options: [ { allowedNames: ['test1', 'test2'], @@ -492,7 +453,6 @@ export const foo = { `, }, { - filename: 'test.ts', code: ` class Test { constructor() {} @@ -516,7 +476,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` const x = { arrowFn: () => { @@ -534,7 +493,6 @@ const x = { ], }, { - filename: 'test.ts', code: ` type HigherOrderType = () => (arg1: string) => (arg2: number) => string; const x: HigherOrderType = () => arg1 => arg2 => 'foo'; @@ -547,7 +505,6 @@ const x: HigherOrderType = () => arg1 => arg2 => 'foo'; ], }, { - filename: 'test.ts', code: ` type HigherOrderType = () => (arg1: string) => (arg2: number) => string; const x: HigherOrderType = () => arg1 => arg2 => 'foo'; @@ -560,7 +517,6 @@ const x: HigherOrderType = () => arg1 => arg2 => 'foo'; ], }, { - filename: 'test.ts', code: ` interface Foo { foo: string; @@ -582,7 +538,6 @@ function foo(): Foo { ], }, { - filename: 'test.ts', code: ` type Foo = (arg1: string) => string; type Bar = (arg2: string) => T; @@ -596,7 +551,6 @@ const x: Bar = arg1 => arg2 => arg1 + arg2; ], }, { - filename: 'test.ts', code: ` let foo = function (): number { return 1; @@ -609,7 +563,6 @@ let foo = function (): number { ], }, { - filename: 'test.ts', code: ` const foo = (function () { return 1; @@ -622,7 +575,6 @@ const foo = (function () { ], }, { - filename: 'test.ts', code: ` const foo = (() => { return 1; @@ -635,7 +587,6 @@ const foo = (() => { ], }, { - filename: 'test.ts', code: ` const foo = ((arg: number): number => { return arg; @@ -648,7 +599,6 @@ const foo = ((arg: number): number => { ], }, { - filename: 'test.ts', code: ` const foo = (() => (() => 'foo')())(); `, @@ -659,7 +609,6 @@ const foo = (() => (() => 'foo')())(); ], }, { - filename: 'test.ts', code: ` let foo = (() => (): string => { return 'foo'; @@ -672,7 +621,6 @@ let foo = (() => (): string => { ], }, { - filename: 'test.ts', code: ` let foo = (() => (): string => { return 'foo'; @@ -686,7 +634,6 @@ let foo = (() => (): string => { ], }, { - filename: 'test.ts', code: ` let foo = (() => (): string => { return 'foo'; @@ -700,7 +647,6 @@ let foo = (() => (): string => { ], }, { - filename: 'test.ts', code: ` let foo = (() => (): void => {})()(); `, @@ -711,7 +657,6 @@ let foo = (() => (): void => {})()(); ], }, { - filename: 'test.ts', code: ` let foo = (() => (() => {})())(); `, @@ -724,7 +669,6 @@ let foo = (() => (() => {})())(); ], invalid: [ { - filename: 'test.ts', code: ` function test(a: number, b: number) { return; @@ -741,7 +685,6 @@ function test(a: number, b: number) { ], }, { - filename: 'test.ts', code: ` function test() { return; @@ -758,7 +701,6 @@ function test() { ], }, { - filename: 'test.ts', code: ` var fn = function () { return 1; @@ -775,7 +717,6 @@ var fn = function () { ], }, { - filename: 'test.ts', code: ` var arrowFn = () => 'test'; `, @@ -790,7 +731,6 @@ var arrowFn = () => 'test'; ], }, { - filename: 'test.ts', code: ` class Test { constructor() {} @@ -839,7 +779,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` function test() { return; @@ -857,7 +796,6 @@ function test() { ], }, { - filename: 'test.ts', code: 'const foo = () => {};', options: [{ allowExpressions: true }], errors: [ @@ -871,7 +809,6 @@ function test() { ], }, { - filename: 'test.ts', code: 'const foo = function () {};', options: [{ allowExpressions: true }], errors: [ @@ -885,7 +822,6 @@ function test() { ], }, { - filename: 'test.ts', code: 'export default () => {};', options: [{ allowExpressions: true }], errors: [ @@ -899,7 +835,6 @@ function test() { ], }, { - filename: 'test.ts', code: 'export default function () {}', options: [{ allowExpressions: true }], errors: [ @@ -913,7 +848,6 @@ function test() { ], }, { - filename: 'test.ts', code: ` class Foo { public a = () => {}; @@ -964,7 +898,6 @@ class Foo { ], }, { - filename: 'test.ts', code: "var arrowFn = () => 'test';", options: [{ allowTypedFunctionExpressions: true }], errors: [ @@ -978,7 +911,6 @@ class Foo { ], }, { - filename: 'test.ts', code: ` var funcExpr = function () { return 'test'; @@ -997,7 +929,6 @@ var funcExpr = function () { }, { - filename: 'test.ts', code: 'const x = (() => {}) as Foo;', options: [{ allowTypedFunctionExpressions: false }], errors: [ @@ -1011,7 +942,6 @@ var funcExpr = function () { ], }, { - filename: 'test.ts', code: ` interface Foo {} const x = { @@ -1030,7 +960,6 @@ const x = { ], }, { - filename: 'test.ts', code: ` interface Foo {} const x: Foo = { @@ -1049,7 +978,6 @@ const x: Foo = { ], }, { - filename: 'test.ts', code: '() => () => {};', options: [{ allowHigherOrderFunctions: true }], errors: [ @@ -1063,7 +991,6 @@ const x: Foo = { ], }, { - filename: 'test.ts', code: '() => function () {};', options: [{ allowHigherOrderFunctions: true }], errors: [ @@ -1077,7 +1004,6 @@ const x: Foo = { ], }, { - filename: 'test.ts', code: ` () => { return () => {}; @@ -1095,7 +1021,6 @@ const x: Foo = { ], }, { - filename: 'test.ts', code: ` () => { return function () {}; @@ -1113,7 +1038,6 @@ const x: Foo = { ], }, { - filename: 'test.ts', code: ` function fn() { return () => {}; @@ -1131,7 +1055,6 @@ function fn() { ], }, { - filename: 'test.ts', code: ` function fn() { return function () {}; @@ -1149,7 +1072,6 @@ function fn() { ], }, { - filename: 'test.ts', code: ` function FunctionDeclaration() { return function FunctionExpression_Within_FunctionDeclaration() { @@ -1177,7 +1099,6 @@ function FunctionDeclaration() { ], }, { - filename: 'test.ts', code: ` () => () => { return () => { @@ -1198,7 +1119,6 @@ function FunctionDeclaration() { }, // https://github.com/typescript-eslint/typescript-eslint/issues/679 { - filename: 'test.ts', code: ` declare function foo(arg: () => void): void; foo(() => 1); @@ -1251,7 +1171,6 @@ foo(() => ''); ], }, { - filename: 'test.ts', code: ` class Accumulator { private count: number = 0; @@ -1279,7 +1198,6 @@ new Accumulator().accumulate(() => 1); ], }, { - filename: 'test.ts', code: '(() => true)();', options: [ { @@ -1297,7 +1215,6 @@ new Accumulator().accumulate(() => 1); ], }, { - filename: 'test.ts', code: ` declare function foo(arg: { meth: () => number }): void; foo({ @@ -1346,7 +1263,6 @@ foo({ ], }, { - filename: 'test.ts', code: ` type HigherOrderType = () => (arg1: string) => (arg2: number) => string; const x: HigherOrderType = () => arg1 => arg2 => 'foo'; @@ -1368,7 +1284,6 @@ const x: HigherOrderType = () => arg1 => arg2 => 'foo'; ], }, { - filename: 'test.ts', code: ` type HigherOrderType = () => (arg1: string) => (arg2: number) => string; const x: HigherOrderType = () => arg1 => arg2 => 'foo'; @@ -1404,7 +1319,6 @@ const x: HigherOrderType = () => arg1 => arg2 => 'foo'; ], }, { - filename: 'test.ts', code: ` const func = (value: number) => ({ type: 'X', value } as any); const func = (value: number) => ({ type: 'X', value } as Action); @@ -1432,7 +1346,6 @@ const func = (value: number) => ({ type: 'X', value } as Action); ], }, { - filename: 'test.ts', code: ` const func = (value: number) => ({ type: 'X', value } as const); `, @@ -1452,7 +1365,6 @@ const func = (value: number) => ({ type: 'X', value } as const); ], }, { - filename: 'test.ts', code: 'const log = (message: string) => void console.log(message);', options: [ { allowConciseArrowFunctionExpressionsStartingWithVoid: false }, @@ -1468,7 +1380,6 @@ const func = (value: number) => ({ type: 'X', value } as const); ], }, { - filename: 'test.ts', code: ` const log = (message: string) => { void console.log(message); @@ -1509,7 +1420,6 @@ const log = function (a: A) { options: [{ allowFunctionsWithoutTypeParameters: true }], }, { - filename: 'test.ts', options: [ { allowedNames: ['test', '1'], @@ -1585,7 +1495,6 @@ const x = { ], }, { - filename: 'test.ts', code: ` const ignoredName = 'notIgnoredName'; class Foo { @@ -1604,7 +1513,6 @@ class Foo { ], }, { - filename: 'test.ts', code: ` const foo = (function () { return 'foo'; @@ -1626,7 +1534,6 @@ const foo = (function () { ], }, { - filename: 'test.ts', code: ` const foo = (function () { return () => { @@ -1650,7 +1557,6 @@ const foo = (function () { ], }, { - filename: 'test.ts', code: ` let foo = function () { return 'foo'; @@ -1672,7 +1578,6 @@ let foo = function () { ], }, { - filename: 'test.ts', code: ` let foo = (() => () => {})()(); `, diff --git a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts index 04a6fa55842..d682c711fcc 100644 --- a/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-member-accessibility.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/explicit-member-accessibility'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -8,7 +9,6 @@ const ruleTester = new RuleTester({ ruleTester.run('explicit-member-accessibility', rule, { valid: [ { - filename: 'test.ts', code: ` class Test { public constructor(private foo: string) {} @@ -22,7 +22,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(private readonly foo: string) {} @@ -36,7 +35,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(private foo: string) {} @@ -50,7 +48,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(protected foo: string) {} @@ -64,7 +61,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(public foo: string) {} @@ -78,7 +74,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(readonly foo: string) {} @@ -92,7 +87,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(private readonly foo: string) {} @@ -106,7 +100,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { protected name: string; @@ -118,7 +111,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { protected name: string; @@ -128,7 +120,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { public constructor({ x, y }: { x: number; y: number }) {} @@ -136,7 +127,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { protected name: string; @@ -149,7 +139,6 @@ class Test { options: [{ accessibility: 'explicit' }], }, { - filename: 'test.ts', code: ` class Test { protected name: string; @@ -162,7 +151,6 @@ class Test { options: [{ accessibility: 'no-public' }], }, { - filename: 'test.ts', code: ` class Test { name: string; @@ -178,7 +166,6 @@ class Test { options: [{ accessibility: 'no-public' }], }, { - filename: 'test.ts', code: ` class Test { private x: number; @@ -199,7 +186,6 @@ class Test { options: [{ overrides: { constructors: 'off', accessors: 'off' } }], }, { - filename: 'test.ts', code: ` class Test { private x: number; @@ -223,7 +209,6 @@ class Test { options: [{ overrides: { methods: 'off' } }], }, { - filename: 'test.ts', code: ` class Test { constructor(private x: number) {} @@ -232,7 +217,6 @@ class Test { options: [{ accessibility: 'no-public' }], }, { - filename: 'test.ts', code: ` class Test { constructor(public x: number) {} @@ -246,7 +230,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { constructor(public foo: number) {} @@ -255,7 +238,6 @@ class Test { options: [{ accessibility: 'no-public' }], }, { - filename: 'test.ts', code: ` class Test { public getX() { @@ -266,7 +248,6 @@ class Test { options: [{ ignoredMethodNames: ['getX'] }], }, { - filename: 'test.ts', code: ` class Test { public static getX() { @@ -277,7 +258,6 @@ class Test { options: [{ ignoredMethodNames: ['getX'] }], }, { - filename: 'test.ts', code: ` class Test { get getX() { @@ -288,7 +268,6 @@ class Test { options: [{ ignoredMethodNames: ['getX'] }], }, { - filename: 'test.ts', code: ` class Test { getX() { @@ -299,7 +278,6 @@ class Test { options: [{ ignoredMethodNames: ['getX'] }], }, { - filename: 'test.ts', code: ` class Test { x = 2; @@ -308,7 +286,6 @@ class Test { options: [{ overrides: { properties: 'off' } }], }, { - filename: 'test.ts', code: ` class Test { private x = 2; @@ -317,7 +294,6 @@ class Test { options: [{ overrides: { properties: 'explicit' } }], }, { - filename: 'test.ts', code: ` class Test { x = 2; @@ -347,7 +323,6 @@ class Test { ], invalid: [ { - filename: 'test.ts', code: ` export class XXXX { public constructor(readonly value: string) {} @@ -399,7 +374,6 @@ export class XXXX { ], }, { - filename: 'test.ts', code: ` export class WithParameterProperty { public constructor(readonly value: string) {} @@ -442,7 +416,6 @@ export class WithParameterProperty { ], }, { - filename: 'test.ts', code: ` export class XXXX { public constructor(readonly samosa: string) {} @@ -493,7 +466,6 @@ export class XXXX { ], }, { - filename: 'test.ts', code: ` class Test { public constructor(readonly foo: string) {} @@ -541,7 +513,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { x: number; @@ -604,7 +575,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { private x: number; @@ -664,7 +634,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { x?: number; @@ -771,7 +740,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { protected name: string; @@ -804,7 +772,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { protected name: string; @@ -837,7 +804,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { public x: number; @@ -869,7 +835,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { private x: number; @@ -1011,7 +976,6 @@ class Test { options: [{ overrides: { constructors: 'no-public' } }], }, { - filename: 'test.ts', code: ` class Test { private x: number; @@ -1213,7 +1177,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { constructor(public x: number) {} @@ -1274,7 +1237,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { constructor(public x: number) {} @@ -1318,7 +1280,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { constructor(public readonly x: number) {} @@ -1344,7 +1305,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { x = 2; @@ -1394,7 +1354,6 @@ class Test { ], }, { - filename: 'test.ts', code: ` class Test { public x = 2; @@ -1466,10 +1425,8 @@ class Test { ], }, { - filename: 'test.ts', code: noFormat` class Test { - @public public /*public*/constructor(private foo: string) {} } `, @@ -1487,13 +1444,11 @@ class Test { ], output: ` class Test { - @public /*public*/constructor(private foo: string) {} } `, }, { - filename: 'test.ts', code: ` class Test { @public @@ -1521,7 +1476,6 @@ class Test { }, { - filename: 'test.ts', code: ` class Test { @public @@ -1548,7 +1502,6 @@ class Test { `, }, { - filename: 'test.ts', code: ` class Test { public foo = ''; @@ -1574,10 +1527,9 @@ class Test { }, { - filename: 'test.ts', code: noFormat` class Test { - contructor(public/* Hi there */ readonly foo); + constructor(public/* Hi there */ readonly foo) {} } `, options: [ @@ -1590,20 +1542,19 @@ class Test { { messageId: 'unwantedPublicAccessibility', line: 3, - column: 14, + column: 15, }, ], output: ` class Test { - contructor(/* Hi there */ readonly foo); + constructor(/* Hi there */ readonly foo) {} } `, }, { - filename: 'test.ts', code: ` class Test { - contructor(public readonly foo: string); + constructor(public readonly foo: string) {} } `, options: [ @@ -1615,17 +1566,16 @@ class Test { { messageId: 'unwantedPublicAccessibility', line: 3, - column: 14, + column: 15, }, ], output: ` class Test { - contructor(readonly foo: string); + constructor(readonly foo: string) {} } `, }, { - filename: 'test.ts', code: ` class EnsureWhiteSPaceSpan { public constructor() {} @@ -1651,7 +1601,6 @@ class EnsureWhiteSPaceSpan { `, }, { - filename: 'test.ts', code: ` class EnsureWhiteSPaceSpan { public /* */ constructor() {} @@ -1886,7 +1835,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -1912,7 +1861,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -1933,7 +1882,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -1954,7 +1903,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -1982,7 +1931,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2003,7 +1952,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2024,7 +1973,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2052,7 +2001,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2073,7 +2022,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2094,7 +2043,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2122,7 +2071,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2143,7 +2092,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2164,7 +2113,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2192,7 +2141,7 @@ class DecoratedClass { public get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2213,7 +2162,7 @@ class DecoratedClass { private get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2234,7 +2183,7 @@ class DecoratedClass { protected get y() { return this.x; } - @foo @bar() set y(@foo @bar() value: x) { + @foo @bar() set z(@foo @bar() value: x) { this.x = x; } } @@ -2262,7 +2211,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() public set y(@foo @bar() value: x) { + @foo @bar() public set z(@foo @bar() value: x) { this.x = x; } } @@ -2283,7 +2232,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() private set y(@foo @bar() value: x) { + @foo @bar() private set z(@foo @bar() value: x) { this.x = x; } } @@ -2304,7 +2253,7 @@ class DecoratedClass { get y() { return this.x; } - @foo @bar() protected set y(@foo @bar() value: x) { + @foo @bar() protected set z(@foo @bar() value: x) { this.x = x; } } diff --git a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts index fbed6829fef..854aa1bfe34 100644 --- a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/explicit-module-boundary-types'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -197,7 +198,6 @@ export const x: Foo = { }, // https://github.com/typescript-eslint/typescript-eslint/issues/2864 { - filename: 'test.ts', code: ` export const x = { foo: { bar: () => {} }, @@ -206,7 +206,6 @@ export const x = { options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` export const x = { foo: { bar: () => {} }, @@ -215,7 +214,6 @@ export const x = { options: [{ allowTypedFunctionExpressions: true }], }, { - filename: 'test.ts', code: ` export const x: Foo = { foo: { bar: () => {} }, diff --git a/packages/eslint-plugin/tests/rules/func-call-spacing.test.ts b/packages/eslint-plugin/tests/rules/func-call-spacing.test.ts index 52d7a74ce47..443e4e92f19 100644 --- a/packages/eslint-plugin/tests/rules/func-call-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/func-call-spacing.test.ts @@ -3,11 +3,11 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../src/rules/func-call-spacing'; import rule from '../../src/rules/func-call-spacing'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/indent/indent.test.ts b/packages/eslint-plugin/tests/rules/indent/indent.test.ts index f9191d3ef10..5974cb5198e 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent.test.ts @@ -3,6 +3,7 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; @@ -11,7 +12,6 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../../../src/util'; -import { RuleTester } from '../../RuleTester'; type MessageIds = InferMessageIdsTypeFromRule; type Options = InferOptionsTypeFromRule; @@ -758,8 +758,6 @@ const div: JQuery = $('
') `, options: [2, { VariableDeclarator: { const: 3 } }], }, - // https://github.com/typescript-eslint/typescript-eslint/issues/441 - 'const;', // https://github.com/typescript-eslint/typescript-eslint/issues/1115 { diff --git a/packages/eslint-plugin/tests/rules/indent/utils.ts b/packages/eslint-plugin/tests/rules/indent/utils.ts index 70d5f7a93b8..ae0b6e502ed 100644 --- a/packages/eslint-plugin/tests/rules/indent/utils.ts +++ b/packages/eslint-plugin/tests/rules/indent/utils.ts @@ -68,7 +68,7 @@ export function expectedErrors( providedErrors: ProvidedError | ProvidedError[], ): TSESLint.TestCaseError[]; export function expectedErrors( - providedIndentType: string | ProvidedError | ProvidedError[], + providedIndentType: ProvidedError | ProvidedError[] | string, providedErrors?: ProvidedError | ProvidedError[], ): TSESLint.TestCaseError[] { let indentType: string; diff --git a/packages/eslint-plugin/tests/rules/index.test.ts b/packages/eslint-plugin/tests/rules/index.test.ts index c9160c0522f..8012636d1aa 100644 --- a/packages/eslint-plugin/tests/rules/index.test.ts +++ b/packages/eslint-plugin/tests/rules/index.test.ts @@ -3,12 +3,14 @@ import fs from 'fs'; import rules from '../../src/rules'; describe('./src/rules/index.ts', () => { - const ruleNames = Object.keys(rules).map(name => `${name}.ts`); + const ruleNames = Object.keys(rules) + .map(name => `${name}.ts`) + .sort(); const files = fs .readdirSync('./src/rules') .filter(file => file !== 'index.ts' && file.endsWith('.ts')); it('imports all available rule modules', () => { - expect(ruleNames).toEqual(expect.arrayContaining(files)); + expect(ruleNames).toEqual(files); }); }); diff --git a/packages/eslint-plugin/tests/rules/init-declarations.test.ts b/packages/eslint-plugin/tests/rules/init-declarations.test.ts index 953a7a6aced..f284cd10185 100644 --- a/packages/eslint-plugin/tests/rules/init-declarations.test.ts +++ b/packages/eslint-plugin/tests/rules/init-declarations.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/init-declarations'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/key-spacing.test.ts b/packages/eslint-plugin/tests/rules/key-spacing.test.ts index e7828e01ffe..a0e1c1e9872 100644 --- a/packages/eslint-plugin/tests/rules/key-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/key-spacing.test.ts @@ -2,8 +2,9 @@ // this rule tests the new lines, which prettier will want to fix and break the tests /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/key-spacing'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts index 58c740fbd5c..82db86a4b44 100644 --- a/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/keyword-spacing.test.ts @@ -2,11 +2,11 @@ // this rule tests the spacing, which prettier will want to fix and break the tests /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../src/rules/keyword-spacing'; import rule from '../../src/rules/keyword-spacing'; -import { RuleTester } from '../RuleTester'; //------------------------------------------------------------------------------ // Helpers diff --git a/packages/eslint-plugin/tests/rules/lines-around-comment.test.ts b/packages/eslint-plugin/tests/rules/lines-around-comment.test.ts index a312bb19cd0..368a5cd0567 100644 --- a/packages/eslint-plugin/tests/rules/lines-around-comment.test.ts +++ b/packages/eslint-plugin/tests/rules/lines-around-comment.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/lines-around-comment'; -import { RuleTester } from '../RuleTester'; import { unIndent } from './indent/utils'; const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/lines-between-class-members.test.ts b/packages/eslint-plugin/tests/rules/lines-between-class-members.test.ts index bb55bbbf346..07a349dd88e 100644 --- a/packages/eslint-plugin/tests/rules/lines-between-class-members.test.ts +++ b/packages/eslint-plugin/tests/rules/lines-between-class-members.test.ts @@ -2,8 +2,9 @@ // this rule tests the new lines, which prettier will want to fix and break the tests /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/lines-between-class-members'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', 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 1b618448a93..1f0645e2fc5 100644 --- a/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts +++ b/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/member-delimiter-style'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/member-ordering.test.ts b/packages/eslint-plugin/tests/rules/member-ordering.test.ts index 89f499d697b..9e8dda8b778 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering.test.ts @@ -1,7 +1,8 @@ +import type { RunTests } from '@typescript-eslint/rule-tester'; +import { RuleTester } from '@typescript-eslint/rule-tester'; + import type { MessageIds, Options } from '../../src/rules/member-ordering'; import rule from '../../src/rules/member-ordering'; -import type { RunTests } from '../RuleTester'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -1454,7 +1455,7 @@ class Foo { code: ` class Foo { constructor() {} - @Dec() public A(): void; + @Dec() public A(): void {} @Dec() private B: string; private C(): void; private D: string; @@ -1473,7 +1474,7 @@ class Foo { { code: ` class Foo { - @Dec() private A(): void; + @Dec() private A(): void {} @Dec() private B: string; constructor() {} private C(): void; @@ -1510,7 +1511,7 @@ class Foo { code: ` class Foo { public A(): string; - @Dec() public B(): string; + @Dec() public B(): string {} public C(): string; d: string; @@ -4299,7 +4300,7 @@ class Foo { C: number; [A: string]: number; public static D(): {}; - private static [B: string]: number; + static [B: string]: number; } `, options: [ diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts index fd10c55fe91..46531f75267 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-case-insensitive-order.test.ts @@ -1,7 +1,8 @@ +import type { RunTests } from '@typescript-eslint/rule-tester'; +import { RuleTester } from '@typescript-eslint/rule-tester'; + import type { MessageIds, Options } from '../../../src/rules/member-ordering'; import rule, { defaultOrder } from '../../../src/rules/member-ordering'; -import type { RunTests } from '../../RuleTester'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts index 338b3a50ee9..4b76427cfe8 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-alphabetically-order.test.ts @@ -1,7 +1,8 @@ +import type { RunTests } from '@typescript-eslint/rule-tester'; +import { RuleTester } from '@typescript-eslint/rule-tester'; + import type { MessageIds, Options } from '../../../src/rules/member-ordering'; import rule, { defaultOrder } from '../../../src/rules/member-ordering'; -import type { RunTests } from '../../RuleTester'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -1981,7 +1982,7 @@ class Foo { b2: string; public c(): void; - @Dec() d(): void; + @Dec() d(): void {} } `, options: [ diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts index 782fee826d5..ac4c749c6fa 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-case-insensitive-order.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../../src/rules/member-ordering'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts index c34677a81c7..63c6dd60cc2 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-natural-order.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../../src/rules/member-ordering'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts index 612c7011b02..ac4991944e9 100644 --- a/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts +++ b/packages/eslint-plugin/tests/rules/member-ordering/member-ordering-optionalMembers.test.ts @@ -1,8 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../../src/rules/member-ordering'; import rule from '../../../src/rules/member-ordering'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts index d9db8f5d6eb..91053830e86 100644 --- a/packages/eslint-plugin/tests/rules/method-signature-style.test.ts +++ b/packages/eslint-plugin/tests/rules/method-signature-style.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/method-signature-style'; -import { batchedSingleLineTests, noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -68,105 +69,323 @@ interface Test { typescript: '4.3', }, }, - ...batchedSingleLineTests({ + { options: ['method'], - code: noFormat` - interface Test { f(a: string): number } - interface Test { ['f'](a: boolean): void } - interface Test { f(a: T): T } - interface Test { ['f'](a: T, b: T): T } - interface Test { 'f!'(/* b */ x: any /* c */): void } - type Test = { readonly f(a: string): number } - type Test = { ['f']?(a: boolean): void } - type Test = { readonly f?(a?: T): T } - type Test = { readonly ['f']?(a: T, b: T): T } - `, - }), - ...batchedSingleLineTests({ + code: ` + interface Test { + f(a: string): number; + } + `, + }, + { options: ['method'], - code: noFormat` - interface Test { get f(): number } - interface Test { set f(value: number): void } - type Test = { get f(): number } - type Test = { set f(value: number): void } + code: ` + interface Test { + ['f'](a: boolean): void; + } + `, + }, + { + options: ['method'], + code: ` + interface Test { + f(a: T): T; + } + `, + }, + { + options: ['method'], + code: ` + interface Test { + ['f'](a: T, b: T): T; + } + `, + }, + { + options: ['method'], + code: ` + interface Test { + 'f!'(/* b */ x: any /* c */): void; + } + `, + }, + { + options: ['method'], + code: ` + type Test = { f(a: string): number }; + `, + }, + { + options: ['method'], + code: ` + type Test = { ['f']?(a: boolean): void }; + `, + }, + { + options: ['method'], + code: ` + type Test = { f?(a?: T): T }; + `, + }, + { + options: ['method'], + code: ` + type Test = { ['f']?(a: T, b: T): T }; + `, + }, + { + options: ['method'], + code: ` + interface Test { + get f(): number; + } `, dependencyConstraints: { typescript: '4.3', }, - }), + }, + { + options: ['method'], + code: ` + interface Test { + set f(value: number): void; + } + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, + { + options: ['method'], + code: ` + type Test = { get f(): number }; + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, + { + options: ['method'], + code: ` + type Test = { set f(value: number): void }; + `, + dependencyConstraints: { + typescript: '4.3', + }, + }, ], invalid: [ - ...batchedSingleLineTests({ - code: noFormat` - interface Test { f(a: string): number } - interface Test { ['f'](a: boolean): void } - interface Test { f(a: T): T } - interface Test { ['f'](a: T, b: T): T } - interface Test { 'f!'(/* b */ x: any /* c */): void } - type Test = { readonly f(a: string): number } - type Test = { ['f']?(a: boolean): void } - type Test = { readonly f?(a?: T): T } - type Test = { readonly ['f']?(a: T, b: T): T } + { + code: ` + interface Test { + f(a: string): number; + } `, - errors: [ - { messageId: 'errorMethod', line: 2 }, - { messageId: 'errorMethod', line: 3 }, - { messageId: 'errorMethod', line: 4 }, - { messageId: 'errorMethod', line: 5 }, - { messageId: 'errorMethod', line: 6 }, - { messageId: 'errorMethod', line: 7 }, - { messageId: 'errorMethod', line: 8 }, - { messageId: 'errorMethod', line: 9 }, - { messageId: 'errorMethod', line: 10 }, - ], + errors: [{ messageId: 'errorMethod' }], + output: ` + interface Test { + f: (a: string) => number; + } + `, + }, + { + code: ` + interface Test { + ['f'](a: boolean): void; + } + `, + errors: [{ messageId: 'errorMethod' }], output: ` - interface Test { f: (a: string) => number } - interface Test { ['f']: (a: boolean) => void } - interface Test { f: (a: T) => T } - interface Test { ['f']: (a: T, b: T) => T } - interface Test { 'f!': (/* b */ x: any /* c */) => void } - type Test = { readonly f: (a: string) => number } - type Test = { ['f']?: (a: boolean) => void } - type Test = { readonly f?: (a?: T) => T } - type Test = { readonly ['f']?: (a: T, b: T) => T } - `, - }), - ...batchedSingleLineTests({ + interface Test { + ['f']: (a: boolean) => void; + } + `, + }, + { + code: ` + interface Test { + f(a: T): T; + } + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + interface Test { + f: (a: T) => T; + } + `, + }, + { + code: ` + interface Test { + ['f'](a: T, b: T): T; + } + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + interface Test { + ['f']: (a: T, b: T) => T; + } + `, + }, + { + code: ` + interface Test { + 'f!'(/* b */ x: any /* c */): void; + } + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + interface Test { + 'f!': (/* b */ x: any /* c */) => void; + } + `, + }, + { + code: ` + type Test = { f(a: string): number }; + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + type Test = { f: (a: string) => number }; + `, + }, + { + code: ` + type Test = { ['f']?(a: boolean): void }; + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + type Test = { ['f']?: (a: boolean) => void }; + `, + }, + { + code: ` + type Test = { f?(a?: T): T }; + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + type Test = { f?: (a?: T) => T }; + `, + }, + { + code: ` + type Test = { ['f']?(a: T, b: T): T }; + `, + errors: [{ messageId: 'errorMethod' }], + output: ` + type Test = { ['f']?: (a: T, b: T) => T }; + `, + }, + { + code: ` + interface Test { + f: (a: string) => number; + } + `, options: ['method'], - code: noFormat` - interface Test { f: (a: string) => number } - interface Test { ['f']: (a: boolean) => void } - interface Test { f: (a: T) => T } - interface Test { ['f']: (a: T, b: T) => T } - interface Test { 'f!': (/* b */ x: any /* c */) => void } - type Test = { readonly f: (a: string) => number } - type Test = { ['f']?: (a: boolean) => void } - type Test = { readonly f?: (a?: T) => T } - type Test = { readonly ['f']?: (a: T, b: T) => T } + errors: [{ messageId: 'errorProperty' }], + output: ` + interface Test { + f(a: string): number; + } `, - errors: [ - { messageId: 'errorProperty', line: 2 }, - { messageId: 'errorProperty', line: 3 }, - { messageId: 'errorProperty', line: 4 }, - { messageId: 'errorProperty', line: 5 }, - { messageId: 'errorProperty', line: 6 }, - { messageId: 'errorProperty', line: 7 }, - { messageId: 'errorProperty', line: 8 }, - { messageId: 'errorProperty', line: 9 }, - { messageId: 'errorProperty', line: 10 }, - ], + }, + { + code: ` + interface Test { + ['f']: (a: boolean) => void; + } + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], output: ` - interface Test { f(a: string): number } - interface Test { ['f'](a: boolean): void } - interface Test { f(a: T): T } - interface Test { ['f'](a: T, b: T): T } - interface Test { 'f!'(/* b */ x: any /* c */): void } - type Test = { readonly f(a: string): number } - type Test = { ['f']?(a: boolean): void } - type Test = { readonly f?(a?: T): T } - type Test = { readonly ['f']?(a: T, b: T): T } - `, - }), + interface Test { + ['f'](a: boolean): void; + } + `, + }, + { + code: ` + interface Test { + f: (a: T) => T; + } + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + interface Test { + f(a: T): T; + } + `, + }, + { + code: ` + interface Test { + ['f']: (a: T, b: T) => T; + } + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + interface Test { + ['f'](a: T, b: T): T; + } + `, + }, + { + code: ` + interface Test { + 'f!': (/* b */ x: any /* c */) => void; + } + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + interface Test { + 'f!'(/* b */ x: any /* c */): void; + } + `, + }, + { + code: ` + type Test = { f: (a: string) => number }; + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + type Test = { f(a: string): number }; + `, + }, + { + code: ` + type Test = { ['f']?: (a: boolean) => void }; + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + type Test = { ['f']?(a: boolean): void }; + `, + }, + { + code: ` + type Test = { f?: (a?: T) => T }; + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + type Test = { f?(a?: T): T }; + `, + }, + { + code: ` + type Test = { ['f']?: (a: T, b: T) => T }; + `, + options: ['method'], + errors: [{ messageId: 'errorProperty' }], + output: ` + type Test = { ['f']?(a: T, b: T): T }; + `, + }, { code: noFormat` interface Foo { diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts index 20f357b8a9c..7f7f0efcd49 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/createTestCases.ts @@ -1,3 +1,4 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { @@ -10,10 +11,9 @@ import type { Selector, } from '../../../../src/rules/naming-convention-utils'; import { selectorTypeToMessageString } from '../../../../src/rules/naming-convention-utils'; -import { RuleTester } from '../../../RuleTester'; export const formatTestNames: Readonly< - Record> + Record> > = { camelCase: { valid: ['strictCamelCase', 'lower', 'camelCaseUNSTRICT'], diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts index 29e9373d3b2..593d98deec1 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/method.test.ts @@ -5,12 +5,11 @@ createTestCases([ code: [ 'class Ignored { private %() {} }', 'class Ignored { private "%"() {} }', - 'class Ignored { private readonly %() {} }', + 'class Ignored { private async %() {} }', 'class Ignored { private static %() {} }', - 'class Ignored { private static readonly %() {} }', + 'class Ignored { private static async %() {} }', 'class Ignored { private % = () => {} }', 'class Ignored { abstract %() }', - 'class Ignored { declare %() }', 'class Ignored { #%() }', 'class Ignored { static #%() }', ], diff --git a/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts index 6d8fdf42608..accdfd8d08c 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/cases/property.test.ts @@ -8,7 +8,7 @@ createTestCases([ 'class Ignored { private readonly % = 1 }', 'class Ignored { private static % }', 'class Ignored { private static readonly % = 1 }', - 'class Ignored { abstract % = 1 }', + 'class Ignored { abstract % }', 'class Ignored { declare % }', 'class Ignored { #% }', 'class Ignored { static #% }', diff --git a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts index df222f2dcb3..75156ebb2ce 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention/naming-convention.test.ts @@ -1,6 +1,8 @@ /* eslint-disable @typescript-eslint/internal/prefer-ast-types-enum */ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../../src/rules/naming-convention'; -import { getFixturesRootDir, noFormat, RuleTester } from '../../RuleTester'; +import { getFixturesRootDir } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts index a50d2c08f83..4f358940089 100644 --- a/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-array-constructor'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts b/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts index c8af0c48ad8..a16b08056bd 100644 --- a/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts +++ b/packages/eslint-plugin/tests/rules/no-base-to-string.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-base-to-string'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ @@ -131,7 +133,7 @@ tag\`\${{}}\`; ], }, { - code: '({}.toString());', + code: '({}).toString();', errors: [ { data: { diff --git a/packages/eslint-plugin/tests/rules/no-confusing-non-null-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-confusing-non-null-assertion.test.ts index 333b0182559..ede6c266ad0 100644 --- a/packages/eslint-plugin/tests/rules/no-confusing-non-null-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-confusing-non-null-assertion.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-confusing-non-null-assertion'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-confusing-void-expression.test.ts b/packages/eslint-plugin/tests/rules/no-confusing-void-expression.test.ts index b0133a10b3c..a6b5cab492c 100644 --- a/packages/eslint-plugin/tests/rules/no-confusing-void-expression.test.ts +++ b/packages/eslint-plugin/tests/rules/no-confusing-void-expression.test.ts @@ -1,14 +1,7 @@ -import type { - MessageId, - Options, -} from '../../src/rules/no-confusing-void-expression'; +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-confusing-void-expression'; -import { - batchedSingleLineTests, - getFixturesRootDir, - noFormat, - RuleTester, -} from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ @@ -21,42 +14,99 @@ const ruleTester = new RuleTester({ ruleTester.run('no-confusing-void-expression', rule, { valid: [ - ...batchedSingleLineTests({ - code: ` - () => Math.random(); - console.log('foo'); - foo && console.log(foo); - foo || console.log(foo); - foo ? console.log(true) : console.log(false); - console?.log('foo'); - `, - }), + '() => Math.random();', + "console.log('foo');", + 'foo && console.log(foo);', + 'foo || console.log(foo);', + 'foo ? console.log(true) : console.log(false);', + "console?.log('foo');", - ...batchedSingleLineTests({ + { options: [{ ignoreArrowShorthand: true }], code: ` () => console.log('foo'); + `, + }, + { + options: [{ ignoreArrowShorthand: true }], + code: ` foo => foo && console.log(foo); + `, + }, + { + options: [{ ignoreArrowShorthand: true }], + code: ` foo => foo || console.log(foo); + `, + }, + { + options: [{ ignoreArrowShorthand: true }], + code: ` foo => (foo ? console.log(true) : console.log(false)); `, - }), + }, - ...batchedSingleLineTests({ + { options: [{ ignoreVoidOperator: true }], code: ` !void console.log('foo'); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` +void (foo && console.log(foo)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` -void (foo || console.log(foo)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` () => void ((foo && void console.log(true)) || console.log(false)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` const x = void (foo ? console.log(true) : console.log(false)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` !(foo && void console.log(foo)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` !!(foo || void console.log(foo)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` const x = (foo && void console.log(true)) || void console.log(false); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` () => (foo ? void console.log(true) : void console.log(false)); + `, + }, + { + options: [{ ignoreVoidOperator: true }], + code: ` return void console.log('foo'); `, - }), + }, + ` function cool(input: string) { return console.log(input), input; @@ -72,32 +122,66 @@ function cool(input: string) { ], invalid: [ - ...batchedSingleLineTests({ + { code: ` const x = console.log('foo'); + `, + errors: [{ column: 19, messageId: 'invalidVoidExpr' }], + }, + { + code: ` const x = console?.log('foo'); + `, + errors: [{ column: 19, messageId: 'invalidVoidExpr' }], + }, + { + code: ` console.error(console.log('foo')); + `, + errors: [{ column: 23, messageId: 'invalidVoidExpr' }], + }, + { + code: ` [console.log('foo')]; + `, + errors: [{ column: 10, messageId: 'invalidVoidExpr' }], + }, + { + code: ` ({ x: console.log('foo') }); + `, + errors: [{ column: 15, messageId: 'invalidVoidExpr' }], + }, + { + code: ` void console.log('foo'); + `, + errors: [{ column: 14, messageId: 'invalidVoidExpr' }], + }, + { + code: ` console.log('foo') ? true : false; + `, + errors: [{ column: 9, messageId: 'invalidVoidExpr' }], + }, + { + code: ` (console.log('foo') && true) || false; + `, + errors: [{ column: 10, messageId: 'invalidVoidExpr' }], + }, + { + code: ` (cond && console.log('ok')) || console.log('error'); + `, + errors: [{ column: 18, messageId: 'invalidVoidExpr' }], + }, + { + code: ` !console.log('foo'); `, - errors: [ - { line: 2, column: 11, messageId: 'invalidVoidExpr' }, - { line: 3, column: 19, messageId: 'invalidVoidExpr' }, - { line: 4, column: 23, messageId: 'invalidVoidExpr' }, - { line: 5, column: 10, messageId: 'invalidVoidExpr' }, - { line: 6, column: 15, messageId: 'invalidVoidExpr' }, - { line: 7, column: 14, messageId: 'invalidVoidExpr' }, - { line: 8, column: 9, messageId: 'invalidVoidExpr' }, - { line: 9, column: 10, messageId: 'invalidVoidExpr' }, - { line: 10, column: 18, messageId: 'invalidVoidExpr' }, - { line: 11, column: 10, messageId: 'invalidVoidExpr' }, - ], - }), + errors: [{ column: 10, messageId: 'invalidVoidExpr' }], + }, { code: ` diff --git a/packages/eslint-plugin/tests/rules/no-dupe-class-members.test.ts b/packages/eslint-plugin/tests/rules/no-dupe-class-members.test.ts index fe99fba8631..9639917baef 100644 --- a/packages/eslint-plugin/tests/rules/no-dupe-class-members.test.ts +++ b/packages/eslint-plugin/tests/rules/no-dupe-class-members.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-dupe-class-members'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts b/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts index 037579d12bb..809248f714f 100644 --- a/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts +++ b/packages/eslint-plugin/tests/rules/no-duplicate-enum-values.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-duplicate-enum-values'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts b/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts deleted file mode 100644 index fae90720e7e..00000000000 --- a/packages/eslint-plugin/tests/rules/no-duplicate-imports.test.ts +++ /dev/null @@ -1,180 +0,0 @@ -import rule from '../../src/rules/no-duplicate-imports'; -import { RuleTester } from '../RuleTester'; - -const ruleTester = new RuleTester({ - parser: '@typescript-eslint/parser', -}); - -ruleTester.run('no-duplicate-imports', rule, { - valid: [ - { - code: "import type foo from 'foo';", - }, - { - code: "import type { foo } from 'foo';", - }, - { - code: ` - import type { foo } from 'foo'; - import type Bar from 'foo'; - `, - }, - { - code: ` - import type Foo from 'foo'; - import type { bar } from 'foo'; - `, - }, - { - code: ` - import type Foo from 'foo'; - import type { bar as Bar } from 'foo'; - `, - }, - { - code: ` - import foo from 'foo'; - import type bar from 'foo'; - `, - }, - { - code: ` - import { foo } from 'foo'; - import type { bar } from 'foo'; - `, - }, - { - code: ` - import type { foo } from 'foo'; - export type foo = foo; - `, - }, - { - code: ` - import type { foo } from 'foo'; - export type { foo }; - `, - }, - { - code: ` - export { foo } from 'foo'; - export type { foo } from 'foo'; - `, - }, - { - code: ` - export type * as foo from 'foo'; - export type * as bar from 'foo'; - `, - }, - { - code: ` - import type { bar } from 'foo'; - export type { foo } from 'foo'; - `, - }, - { - code: ` - import type { foo } from 'foo'; - export type { bar } from 'bar'; - `, - options: [{ includeExports: true }], - }, - { - code: ` - import type { foo } from 'foo'; - export type { bar }; - `, - options: [{ includeExports: true }], - }, - { - code: ` - import type Foo from 'foo'; - import type { bar } from 'foo'; - export type { bar }; - `, - options: [{ includeExports: true }], - }, - ], - invalid: [ - { - code: ` - import type foo from 'foo'; - import type bar from 'foo'; - `, - errors: [ - { - messageId: 'importType', - data: { - module: 'foo', - }, - }, - ], - }, - { - code: ` - import type { foo } from 'foo'; - import type { bar } from 'foo'; - `, - errors: [{ messageId: 'importType' }], - }, - { - code: ` - export type { foo } from 'foo'; - import type { bar } from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'importTypeAs' }], - }, - { - code: ` - import type foo from 'foo'; - export type * from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'exportTypeAs' }], - }, - { - code: ` - import type { foo } from 'foo'; - export type { foo } from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'exportTypeAs' }], - }, - { - code: ` - import type Foo from 'foo'; - import type { bar } from 'foo'; - export type { bar } from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'exportTypeAs' }], - }, - { - code: ` - export type * as foo from 'foo'; - export type * as bar from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'exportType' }], - }, - - // check base rule - { - code: ` - import foo from 'foo'; - import bar from 'foo'; - `, - errors: [{ messageId: 'import' }], - }, - { - code: ` - import foo from 'foo'; - export { foo } from 'foo'; - `, - options: [{ includeExports: true }], - errors: [{ messageId: 'exportAs' }], - }, - ], -}); diff --git a/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts new file mode 100644 index 00000000000..376e3fa2268 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-duplicate-type-constituents.test.ts @@ -0,0 +1,668 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + +import rule from '../../src/rules/no-duplicate-type-constituents'; +import { getFixturesRootDir } from '../RuleTester'; + +const rootPath = getFixturesRootDir(); + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + tsconfigRootDir: rootPath, + project: './tsconfig.json', + }, +}); + +ruleTester.run('no-duplicate-type-constituents', rule, { + valid: [ + { + code: 'type T = 1 | 2;', + }, + { + code: "type T = 1 | '1';", + }, + { + code: 'type T = true & boolean;', + }, + { + code: 'type T = null | undefined;', + }, + { + code: 'type T = any | unknown;', + }, + { + code: 'type T = { a: string } | { b: string };', + }, + { + code: 'type T = { a: string; b: number } | { b: number; a: string };', + }, + { + code: 'type T = { a: string | number };', + }, + { + code: 'type T = Set | Set;', + }, + { + code: 'type T = Class | Class;', + }, + { + code: 'type T = string[] | number[];', + }, + { + code: 'type T = string[][] | string[];', + }, + { + code: 'type T = [1, 2, 3] | [1, 2, 4];', + }, + { + code: 'type T = [1, 2, 3] | [1, 2, 3, 4];', + }, + { + code: "type T = 'A' | string[];", + }, + { + code: 'type T = (() => string) | (() => void);', + }, + { + code: 'type T = () => string | void;', + }, + { + code: 'type T = () => null | undefined;', + }, + { + code: 'type T = (arg: string | number) => void;', + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = A | B; + `, + }, + { + code: ` +type A = 'A'; +type B = 'B'; +const a: A | B = 'A'; + `, + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = A | /* comment */ B; + `, + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = 'A' | 'B'; + `, + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type C = 'C'; +type T = A | B | C; + `, + }, + { + code: 'type T = readonly string[] | string[];', + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type C = 'C'; +type D = 'D'; +type T = (A | B) | (C | D); + `, + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = (A | B) | (A & B); + `, + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = Record; + `, + }, + { + code: 'type T = A | A;', + options: [ + { + ignoreUnions: true, + }, + ], + }, + { + code: 'type T = A & A;', + options: [ + { + ignoreIntersections: true, + }, + ], + }, + ], + invalid: [ + { + code: 'type T = 1 | 1;', + output: `type T = 1 ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: '1', + }, + }, + ], + }, + { + code: 'type T = true & true;', + output: `type T = true ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Intersection', + previous: 'true', + }, + }, + ], + }, + { + code: 'type T = null | null;', + output: `type T = null ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'null', + }, + }, + ], + }, + { + code: 'type T = any | any;', + output: `type T = any ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'any', + }, + }, + ], + }, + { + code: 'type T = { a: string | string };', + output: `type T = { a: string };`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'string', + }, + }, + ], + }, + { + code: 'type T = { a: string } | { a: string };', + output: `type T = { a: string } ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: '{ a: string }', + }, + }, + ], + }, + { + code: 'type T = { a: string; b: number } | { a: string; b: number };', + output: `type T = { a: string; b: number } ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: '{ a: string; b: number }', + }, + }, + ], + }, + { + code: 'type T = Set | Set;', + output: `type T = Set ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'Set', + }, + }, + ], + }, + { + code: ` +type IsArray = T extends any[] ? true : false; +type ActuallyDuplicated = IsArray | IsArray; + `, + output: ` +type IsArray = T extends any[] ? true : false; +type ActuallyDuplicated = IsArray ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'IsArray', + }, + }, + ], + }, + { + code: 'type T = Class | Class;', + output: `type T = Class ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'Class', + }, + }, + ], + }, + { + code: 'type T = string[] | string[];', + output: `type T = string[] ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'string[]', + }, + }, + ], + }, + { + code: 'type T = string[][] | string[][];', + output: `type T = string[][] ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'string[][]', + }, + }, + ], + }, + { + code: 'type T = [1, 2, 3] | [1, 2, 3];', + output: `type T = [1, 2, 3] ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: '[1, 2, 3]', + }, + }, + ], + }, + { + code: 'type T = () => string | string;', + output: `type T = () => string ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'string', + }, + }, + ], + }, + { + code: 'type T = () => null | null;', + output: `type T = () => null ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'null', + }, + }, + ], + }, + { + code: 'type T = (arg: string | string) => void;', + output: `type T = (arg: string ) => void;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'string', + }, + }, + ], + }, + { + code: "type T = 'A' | 'A';", + output: `type T = 'A' ;`, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: "'A'", + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type T = A | A; + `, + output: ` +type A = 'A'; +type T = A ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +const a: A | A = 'A'; + `, + output: ` +type A = 'A'; +const a: A = 'A'; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type T = A | /* comment */ A; + `, + output: ` +type A = 'A'; +type T = A /* comment */ ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A1 = 'A'; +type A2 = 'A'; +type A3 = 'A'; +type T = A1 | A2 | A3; + `, + output: ` +type A1 = 'A'; +type A2 = 'A'; +type A3 = 'A'; +type T = A1 ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A1', + }, + }, + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A1', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = A | B | A; + `, + output: ` +type A = 'A'; +type B = 'B'; +type T = A | B ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = A | B | A | B; + `, + output: ` +type A = 'A'; +type B = 'B'; +type T = A | B ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'B', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = A | B | A | A; + `, + output: ` +type A = 'A'; +type B = 'B'; +type T = A | B ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type C = 'C'; +type T = A | B | A | C; + `, + output: ` +type A = 'A'; +type B = 'B'; +type C = 'C'; +type T = A | B | C; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type T = (A | B) | (A | B); + `, + output: ` +type A = 'A'; +type B = 'B'; +type T = (A | B) ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A | B', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type T = A | (A | A); + `, + output: ` +type A = 'A'; +type T = A ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: `A`, + }, + }, + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type B = 'B'; +type C = 'C'; +type D = 'D'; +type F = (A | B) | (A | B) | ((C | D) & (A | B)) | (A | B); + `, + output: ` +type A = 'A'; +type B = 'B'; +type C = 'C'; +type D = 'D'; +type F = (A | B) | ((C | D) & (A | B)) ; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A | B', + }, + }, + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A | B', + }, + }, + ], + }, + { + code: ` +type A = 'A'; +type T = Record; + `, + output: ` +type A = 'A'; +type T = Record; + `, + errors: [ + { + messageId: 'duplicate', + data: { + type: 'Union', + previous: 'A', + }, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts index 40aece28bc5..b58bc177184 100644 --- a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts +++ b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-dynamic-delete'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts index 7f35c79852c..d24ad789e59 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-empty-function'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -169,22 +170,6 @@ function foo() {} }, ], }, - { - code: noFormat` -@decorator() -function foo() {} - `, - errors: [ - { - messageId: 'unexpected', - data: { - name: "function 'foo'", - }, - line: 3, - column: 16, - }, - ], - }, { code: ` class Foo { diff --git a/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts b/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts index 893deaf01d6..3711f874a3b 100644 --- a/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts +++ b/packages/eslint-plugin/tests/rules/no-empty-interface.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-empty-interface'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts index 01d894d1802..2dc995cb66f 100644 --- a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts +++ b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts @@ -1,8 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../src/rules/no-explicit-any'; import rule from '../../src/rules/no-explicit-any'; -import { RuleTester } from '../RuleTester'; type InvalidTestCase = TSESLint.InvalidTestCase; type SuggestionOutput = TSESLint.SuggestionOutput; diff --git a/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts index 3deb4bfaec2..7b9ab5338af 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-non-null-assertion.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-extra-non-null-assertion'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts index 369f55101f2..6aad779b2b7 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-parens.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-extra-parens'; -import { batchedSingleLineTests, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { @@ -17,31 +18,42 @@ const ruleTester = new RuleTester({ ruleTester.run('no-extra-parens', rule, { valid: [ - ...batchedSingleLineTests({ - code: ` -async function f(arg: any) { await (arg as Promise); } -async function f(arg: Promise) { await arg; } -(0).toString(); -(function(){}) ? a() : b(); -(/^a$/).test(x); -for (a of (b, c)); -for (a of b); -for (a in b, c); -for (a in b); -a(1); -new a(1); -a(1); - `, - }), - ...batchedSingleLineTests({ + 'async function f(arg: any) { await (arg as Promise); }', + 'async function f(arg: Promise) { await arg; }', + '(0).toString();', + '(function(){}) ? a() : b();', + '(/^a$/).test(x);', + 'for (a of (b, c));', + 'for (a of b);', + 'for (a in b, c);', + 'for (a in b);', + "a(1);", + "new a(1);", + 'a(1);', + { code: ` while ((foo = bar())) {} + `, + options: ['all', { conditionalAssign: false }], + }, + { + code: ` if ((foo = bar())) {} + `, + options: ['all', { conditionalAssign: false }], + }, + { + code: ` do; while ((foo = bar())) + `, + options: ['all', { conditionalAssign: false }], + }, + { + code: ` for (;(a = b);); `, options: ['all', { conditionalAssign: false }], - }), + }, { code: ` function a(b) { @@ -66,14 +78,24 @@ for (;(a = b);); code: 'b => b ? (c = d) : (c = e);', options: ['all', { returnAssign: false }], }, - ...batchedSingleLineTests({ + { code: ` x = a || (b && c); + `, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: ` x = a + (b * c); + `, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: ` x = (a * b) / c; `, options: ['all', { nestedBinaryExpressions: false }], - }), + }, { code: ` const Component = (
) @@ -100,140 +122,391 @@ const Component = ( `, options: ['all', { ignoreJSX: 'multi-line' }], }, - ...batchedSingleLineTests({ + { code: ` const Component = (
) + `, + options: ['all', { ignoreJSX: 'single-line' }], + }, + { + code: ` const Component = (

) `, options: ['all', { ignoreJSX: 'single-line' }], - }), - ...batchedSingleLineTests({ + }, + { code: ` const b = a => 1 ? 2 : 3; + `, + options: ['all', { enforceForArrowConditionals: false }], + }, + { + code: ` const d = c => (1 ? 2 : 3); `, options: ['all', { enforceForArrowConditionals: false }], - }), - ...batchedSingleLineTests({ + }, + { code: ` (0).toString(); + `, + options: ['functions'], + }, + { + code: ` (Object.prototype.toString.call()); + `, + options: ['functions'], + }, + { + code: ` ({}.toString.call()); + `, + options: ['functions'], + }, + { + code: ` (function(){} ? a() : b()); + `, + options: ['functions'], + }, + { + code: ` (/^a$/).test(x); + `, + options: ['functions'], + }, + { + code: ` a = (b * c); -(a * b) + c; -typeof (a); `, options: ['functions'], - }), - ...batchedSingleLineTests({ + }, + { code: ` -const x = (1 as 1) | (1 as 1); -const x = (<1>1) | (<1>1); -const x = (1 as 1) | 2; -const x = (1 as 1) + 2 + 2; -const x = 1 + 1 + (2 as 2); -const x = 1 | (2 as 2); -const x = (<1>1) | 2; -const x = 1 | (<2>2); -t.true((me.get as SinonStub).calledWithExactly('/foo', other)); -t.true((me.get).calledWithExactly('/foo', other)); -(requestInit.headers as Headers).get('Cookie'); -( requestInit.headers).get('Cookie'); -class Foo {} -class Foo extends (Bar as any) {} -const foo = class {}; -const foo = class extends (Bar as any) {} +(a * b) + c; `, - parserOptions: { - ecmaFeatures: { - jsx: false, - }, - }, - }), - ...batchedSingleLineTests({ + options: ['functions'], + }, + { code: ` -[a as b]; -() => (1 as 1); -x = a as b; -const x = (1 as 1) | 2; -const x = 1 | (2 as 2); -const x = await (foo as Promise); -const res2 = (fn as foo)(); -(x as boolean) ? 1 : 0; -x ? (1 as 1) : 2; -x ? 1 : (2 as 2); -while (foo as boolean) {}; -do {} while (foo as boolean); -for (let i of ([] as Foo)) {} -for (let i in ({} as Foo)) {} -for ((1 as 1);;) {} -for (;(1 as 1);) {} -for (;;(1 as 1)) {} -if (1 as 1) {} -const x = (1 as 1).toString(); -new (1 as 1)(); -const x = { ...(1 as 1), ...{} }; -throw (1 as 1); -throw 1; -const x = !(1 as 1); -const x = (1 as 1)++; -function *x() { yield (1 as 1); yield 1; } -switch (foo) { case 1: case (2 as 2): break; default: break; } - `, - options: [ - 'all', - { - nestedBinaryExpressions: false, - }, - ], - }), - ...batchedSingleLineTests({ +typeof (a); + `, + options: ['functions'], + }, + { + code: 'const x = (1 as 1) | (1 as 1);', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = (<1>1) | (<1>1);', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = (1 as 1) | 2;', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = (1 as 1) + 2 + 2;', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = 1 + 1 + (2 as 2);', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = 1 | (2 as 2);', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = (<1>1) | 2;', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const x = 1 | (<2>2);', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: "t.true((me.get as SinonStub).calledWithExactly('/foo', other));", + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: "t.true((me.get).calledWithExactly('/foo', other));", + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: "(requestInit.headers as Headers).get('Cookie');", + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: "( requestInit.headers).get('Cookie');", + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { code: 'class Foo {}', parserOptions: { ecmaFeatures: { jsx: false } } }, + { + code: 'class Foo extends (Bar as any) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const foo = class {};', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + { + code: 'const foo = class extends (Bar as any) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + }, + + { code: '[a as b];', options: ['all', { nestedBinaryExpressions: false }] }, + { + code: '() => (1 as 1);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'x = a as b;', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = (1 as 1) | 2;', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = 1 | (2 as 2);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = await (foo as Promise);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const res2 = (fn as foo)();', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: '(x as boolean) ? 1 : 0;', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'x ? (1 as 1) : 2;', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'x ? 1 : (2 as 2);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'while (foo as boolean) {};', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'do {} while (foo as boolean);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (let i of ([] as Foo)) {}', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (let i in ({} as Foo)) {}', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for ((1 as 1);;) {}', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (;(1 as 1);) {}', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (;;(1 as 1)) {}', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'if (1 as 1) {}', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = (1 as 1).toString();', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'new (1 as 1)();', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = { ...(1 as 1), ...{} };', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'throw (1 as 1);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { code: 'throw 1;', options: ['all', { nestedBinaryExpressions: false }] }, + { + code: 'const x = !(1 as 1);', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = (1 as 1)++;', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'function *x() { yield (1 as 1); yield 1; }', + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'switch (foo) { case 1: case (2 as 2): break; default: break; }', + options: ['all', { nestedBinaryExpressions: false }], + }, + + { + code: '[a];', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: '() => (<1>1);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'x = a;', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = (<1>1) | 2;', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = 1 | (<2>2);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = await (>foo);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const res2 = (fn)();', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: '(x) ? 1 : 0;', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'x ? (<1>1) : 2;', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'x ? 1 : (<2>2);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'while (foo) {};', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'do {} while (foo);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (let i of ([])) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (let i in ({})) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for ((<1>1);;) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (;(<1>1);) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'for (;;(<1>1)) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'if (<1>1) {}', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = (<1>1).toString();', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'new (<1>1)();', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = { ...(<1>1), ...{} };', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'throw (<1>1);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'throw 1;', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = !(<1>1);', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'const x = (<1>1)++;', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'function *x() { yield (<1>1); yield 1; }', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + { + code: 'switch (foo) { case 1: case (<2>2): break; default: break; }', + parserOptions: { ecmaFeatures: { jsx: false } }, + options: ['all', { nestedBinaryExpressions: false }], + }, + + { code: ` -[a]; -() => (<1>1); -x = a; -const x = (<1>1) | 2; -const x = 1 | (<2>2); -const x = await (>foo); -const res2 = (fn)(); -(x) ? 1 : 0; -x ? (<1>1) : 2; -x ? 1 : (<2>2); -while (foo) {}; -do {} while (foo); -for (let i of ([])) {} -for (let i in ({})) {} -for ((<1>1);;) {} -for (;(<1>1);) {} -for (;;(<1>1)) {} -if (<1>1) {} -const x = (<1>1).toString(); -new (<1>1)(); -const x = { ...(<1>1), ...{} }; -throw (<1>1); -throw 1; -const x = !(<1>1); -const x = (<1>1)++; -function *x() { yield (<1>1); yield 1; } -switch (foo) { case 1: case (<2>2): break; default: break; } +declare const f: (x: T) => any `, parserOptions: { ecmaFeatures: { - jsx: false, + jsx: true, }, }, - options: [ - 'all', - { - nestedBinaryExpressions: false, - }, - ], - }), - ...batchedSingleLineTests({ + }, + { code: ` -declare const f: (x: T) => any f<(number | string)[]>(['a', 1]) `, parserOptions: { @@ -241,146 +514,192 @@ f<(number | string)[]>(['a', 1]) jsx: true, }, }, - }), + }, ], invalid: [ - ...batchedSingleLineTests({ - code: ` -a = (b * c); -(a * b) + c; -for (a in (b, c)); -for (a in (b)); -for (a of (b)); -typeof (a); -a((1)); -new a((1)); -a<(A)>((1)); -async function f(arg: Promise) { await (arg); } -async function f(arg: any) { await ((arg as Promise)); } -class Foo extends ((Bar as any)) {} -class Foo extends (Bar) {} -const foo = class extends ((Bar as any)) {} -const foo = class extends (Bar) {} - `, - output: ` -a = b * c; -a * b + c; -for (a in b, c); -for (a in b); -for (a of b); -typeof a; -a(1); -new a(1); -a<(A)>(1); -async function f(arg: Promise) { await arg; } -async function f(arg: any) { await (arg as Promise); } -class Foo extends (Bar as any) {} -class Foo extends Bar {} -const foo = class extends (Bar as any) {} -const foo = class extends Bar {} - `, + { + code: 'a = (b * c);', + output: 'a = b * c;', errors: [ { messageId: 'unexpected', - line: 2, column: 5, }, + ], + }, + { + code: '(a * b) + c;', + output: 'a * b + c;', + errors: [ { messageId: 'unexpected', - line: 3, column: 1, }, + ], + }, + { + code: 'for (a in (b, c));', + output: 'for (a in b, c);', + errors: [ { messageId: 'unexpected', - line: 4, column: 11, }, + ], + }, + { + code: 'for (a in (b));', + output: 'for (a in b);', + errors: [ { messageId: 'unexpected', - line: 5, column: 11, }, + ], + }, + { + code: 'for (a of (b));', + output: 'for (a of b);', + errors: [ { messageId: 'unexpected', - line: 6, column: 11, }, + ], + }, + { + code: 'typeof (a);', + output: 'typeof a;', + errors: [ { messageId: 'unexpected', - line: 7, column: 8, }, + ], + }, + { + code: "a((1));", + output: "a(1);", + errors: [ { messageId: 'unexpected', - line: 8, column: 15, }, + ], + }, + { + code: "new a((1));", + output: "new a(1);", + errors: [ { messageId: 'unexpected', - line: 9, column: 19, }, + ], + }, + { + code: 'a<(A)>((1));', + output: 'a<(A)>(1);', + errors: [ { messageId: 'unexpected', - line: 10, column: 8, }, + ], + }, + { + code: 'async function f(arg: Promise) { await (arg); }', + output: 'async function f(arg: Promise) { await arg; }', + errors: [ { messageId: 'unexpected', - line: 11, column: 45, }, + ], + }, + { + code: 'async function f(arg: any) { await ((arg as Promise)); }', + output: 'async function f(arg: any) { await (arg as Promise); }', + errors: [ { messageId: 'unexpected', - line: 12, column: 37, }, + ], + }, + { + code: 'class Foo extends ((Bar as any)) {}', + output: 'class Foo extends (Bar as any) {}', + errors: [ { messageId: 'unexpected', - line: 13, column: 20, }, + ], + }, + { + code: 'class Foo extends (Bar) {}', + output: 'class Foo extends Bar {}', + errors: [ { messageId: 'unexpected', - line: 14, column: 19, }, + ], + }, + { + code: 'const foo = class extends ((Bar as any)) {}', + output: 'const foo = class extends (Bar as any) {}', + errors: [ { messageId: 'unexpected', - line: 15, column: 28, }, + ], + }, + { + code: 'const foo = class extends (Bar) {}', + output: 'const foo = class extends Bar {}', + errors: [ { messageId: 'unexpected', - line: 16, column: 27, }, ], - }), - ...batchedSingleLineTests({ + }, + + { code: ` -const Component = (
) -const Component = (

) + const Component = (
) `, output: ` -const Component =
-const Component =

+ const Component =
`, options: ['all', { ignoreJSX: 'multi-line' }], errors: [ { messageId: 'unexpected', - line: 2, - column: 19, + column: 27, }, + ], + }, + { + code: ` + const Component = (

) + `, + output: ` + const Component =

+ `, + options: ['all', { ignoreJSX: 'multi-line' }], + errors: [ { messageId: 'unexpected', - line: 3, - column: 19, + column: 27, }, ], - }), + }, + { code: ` const Component = ( @@ -420,28 +739,35 @@ const Component =${' '} }, ], }, - ...batchedSingleLineTests({ + { code: ` ((function foo() {}))(); -var y = (function () {return 1;}); `, output: ` (function foo() {})(); -var y = function () {return 1;}; `, options: ['functions'], errors: [ { messageId: 'unexpected', - line: 2, column: 2, }, + ], + }, + { + code: ` +var y = (function () {return 1;}); + `, + output: ` +var y = function () {return 1;}; + `, + options: ['functions'], + errors: [ { messageId: 'unexpected', - line: 3, column: 9, }, ], - }), + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-extra-semi.test.ts b/packages/eslint-plugin/tests/rules/no-extra-semi.test.ts index 4d2d870e7e5..897d38ece0c 100644 --- a/packages/eslint-plugin/tests/rules/no-extra-semi.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extra-semi.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-extra-semi'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts index ca8cad2b4d1..cb40f6900cc 100644 --- a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-extraneous-class'; -import { RuleTester } from '../RuleTester'; const empty = { messageId: 'empty' as const, diff --git a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts index 070cef91e9a..c89e4316dd9 100644 --- a/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-floating-promises.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-floating-promises'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); @@ -29,7 +31,6 @@ async function test() { .catch(() => {}) .finally(() => {}); Promise.resolve('value').catch(() => {}); - Promise.resolve('value').finally(() => {}); return Promise.resolve('value'); } `, @@ -56,7 +57,6 @@ async function test() { .catch(() => {}) .finally(() => {}); Promise.reject(new Error('message')).catch(() => {}); - Promise.reject(new Error('message')).finally(() => {}); return Promise.reject(new Error('message')); } `, @@ -75,7 +75,6 @@ async function test() { .catch(() => {}) .finally(() => {}); (async () => true)().catch(() => {}); - (async () => true)().finally(() => {}); return (async () => true)(); } `, @@ -95,7 +94,6 @@ async function test() { .catch(() => {}) .finally(() => {}); returnsPromise().catch(() => {}); - returnsPromise().finally(() => {}); return returnsPromise(); } `, @@ -104,7 +102,6 @@ async function test() { const x = Promise.resolve(); const y = x.then(() => {}); y.catch(() => {}); - y.finally(() => {}); } `, ` @@ -115,7 +112,6 @@ async function test() { ` async function test() { Promise.resolve().catch(() => {}), 123; - Promise.resolve().finally(() => {}), 123; 123, Promise.resolve().then( () => {}, @@ -145,7 +141,7 @@ async function test() { `, ` async function test() { - const promiseValue: Promise; + declare const promiseValue: Promise; await promiseValue; promiseValue.then( @@ -158,13 +154,12 @@ async function test() { .catch(() => {}) .finally(() => {}); promiseValue.catch(() => {}); - promiseValue.finally(() => {}); return promiseValue; } `, ` async function test() { - const promiseUnion: Promise | number; + declare const promiseUnion: Promise | number; await promiseUnion; promiseUnion.then( @@ -183,7 +178,7 @@ async function test() { `, ` async function test() { - const promiseIntersection: Promise & number; + declare const promiseIntersection: Promise & number; await promiseIntersection; promiseIntersection.then( @@ -191,12 +186,7 @@ async function test() { () => {}, ); promiseIntersection.then(() => {}).catch(() => {}); - promiseIntersection - .then(() => {}) - .catch(() => {}) - .finally(() => {}); promiseIntersection.catch(() => {}); - promiseIntersection.finally(() => {}); return promiseIntersection; } `, @@ -216,7 +206,6 @@ async function test() { .catch(() => {}) .finally(() => {}); canThen.catch(() => {}); - canThen.finally(() => {}); return canThen; } `, @@ -226,7 +215,7 @@ async function test() { await (Math.random() > 0.5 ? foo : 0); await (Math.random() > 0.5 ? bar : 0); - const intersectionPromise: Promise & number; + declare const intersectionPromise: Promise & number; await intersectionPromise; } `, @@ -313,7 +302,6 @@ async function test() { .catch(() => {}) .finally(() => {}); promise.catch(() => {}); - promise.finally(() => {}); return promise; } `, @@ -331,7 +319,6 @@ async function test() { ?.then(() => {}) ?.catch(() => {}); returnsPromise()?.catch(() => {}); - returnsPromise()?.finally(() => {}); return returnsPromise(); } `, @@ -456,6 +443,38 @@ async function foo() { `, options: [{ ignoreVoid: false }], }, + { + code: ` +declare const definitelyCallable: () => void; +Promise.reject().catch(definitelyCallable); + `, + options: [{ ignoreVoid: false }], + }, + { + code: ` +Promise.reject() + .catch(() => {}) + .finally(() => {}); + `, + }, + { + code: ` +Promise.reject() + .catch(() => {}) + .finally(() => {}) + .finally(() => {}); + `, + options: [{ ignoreVoid: false }], + }, + { + code: ` +Promise.reject() + .catch(() => {}) + .finally(() => {}) + .finally(() => {}) + .finally(() => {}); + `, + }, ], invalid: [ @@ -603,7 +622,6 @@ async function test() { (async () => true)(); (async () => true)().then(() => {}); (async () => true)().catch(); - (async () => true)().finally(); } `, errors: [ @@ -619,10 +637,6 @@ async function test() { line: 5, messageId: 'floatingVoid', }, - { - line: 6, - messageId: 'floatingVoid', - }, ], }, { @@ -881,7 +895,7 @@ async function test() { { code: ` async function test() { - const promiseValue: Promise; + declare const promiseValue: Promise; promiseValue; promiseValue.then(() => {}); @@ -911,7 +925,7 @@ async function test() { { code: ` async function test() { - const promiseUnion: Promise | number; + declare const promiseUnion: Promise | number; promiseUnion; } @@ -926,12 +940,11 @@ async function test() { { code: ` async function test() { - const promiseIntersection: Promise & number; + declare const promiseIntersection: Promise & number; promiseIntersection; promiseIntersection.then(() => {}); promiseIntersection.catch(); - promiseIntersection.finally(); } `, errors: [ @@ -947,10 +960,6 @@ async function test() { line: 7, messageId: 'floatingVoid', }, - { - line: 8, - messageId: 'floatingVoid', - }, ], }, { @@ -1141,7 +1150,7 @@ async function test() { { code: ` (async function () { - const promiseIntersection: Promise & number; + declare const promiseIntersection: Promise & number; promiseIntersection; promiseIntersection.then(() => {}); promiseIntersection.catch(); @@ -1427,5 +1436,220 @@ async function foo() { }, ], }, + { + code: ` +declare const maybeCallable: string | (() => void); +declare const definitelyCallable: () => void; +Promise.resolve().then(() => {}, undefined); +Promise.resolve().then(() => {}, null); +Promise.resolve().then(() => {}, 3); +Promise.resolve().then(() => {}, maybeCallable); +Promise.resolve().then(() => {}, definitelyCallable); + +Promise.resolve().catch(undefined); +Promise.resolve().catch(null); +Promise.resolve().catch(3); +Promise.resolve().catch(maybeCallable); +Promise.resolve().catch(definitelyCallable); + `, + errors: [ + { + line: 4, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 5, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 6, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 7, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 10, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 11, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 12, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + { + line: 13, + messageId: 'floatingUselessRejectionHandlerVoid', + }, + ], + }, + { + code: ` +Promise.reject() || 3; + `, + errors: [ + { + line: 2, + messageId: 'floatingVoid', + }, + ], + }, + { + code: ` +void Promise.resolve().then(() => {}, undefined); + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 2, + messageId: 'floatingUselessRejectionHandler', + }, + ], + }, + { + code: ` +declare const maybeCallable: string | (() => void); +Promise.resolve().then(() => {}, maybeCallable); + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 3, + messageId: 'floatingUselessRejectionHandler', + }, + ], + }, + { + code: ` +declare const maybeCallable: string | (() => void); +declare const definitelyCallable: () => void; +Promise.resolve().then(() => {}, undefined); +Promise.resolve().then(() => {}, null); +Promise.resolve().then(() => {}, 3); +Promise.resolve().then(() => {}, maybeCallable); +Promise.resolve().then(() => {}, definitelyCallable); + +Promise.resolve().catch(undefined); +Promise.resolve().catch(null); +Promise.resolve().catch(3); +Promise.resolve().catch(maybeCallable); +Promise.resolve().catch(definitelyCallable); + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 4, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 5, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 6, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 7, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 10, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 11, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 12, + messageId: 'floatingUselessRejectionHandler', + }, + { + line: 13, + messageId: 'floatingUselessRejectionHandler', + }, + ], + }, + { + code: ` +Promise.reject() || 3; + `, + options: [{ ignoreVoid: false }], + errors: [ + { + line: 2, + messageId: 'floating', + }, + ], + }, + { + code: ` +Promise.reject().finally(() => {}); + `, + errors: [{ line: 2, messageId: 'floatingVoid' }], + }, + { + code: ` +Promise.reject() + .finally(() => {}) + .finally(() => {}); + `, + options: [{ ignoreVoid: false }], + errors: [{ line: 2, messageId: 'floating' }], + }, + { + code: ` +Promise.reject() + .finally(() => {}) + .finally(() => {}) + .finally(() => {}); + `, + errors: [{ line: 2, messageId: 'floatingVoid' }], + }, + { + code: ` +Promise.reject() + .then(() => {}) + .finally(() => {}); + `, + errors: [{ line: 2, messageId: 'floatingVoid' }], + }, + { + code: ` +declare const returnsPromise: () => Promise | null; +returnsPromise()?.finally(() => {}); + `, + errors: [{ line: 3, messageId: 'floatingVoid' }], + }, + { + code: ` +const promiseIntersection: Promise & number; +promiseIntersection.finally(() => {}); + `, + errors: [{ line: 3, messageId: 'floatingVoid' }], + }, + { + code: ` +Promise.resolve().finally(() => {}), 123; + `, + errors: [{ line: 2, messageId: 'floatingVoid' }], + }, + { + code: ` +(async () => true)().finally(); + `, + errors: [{ line: 2, messageId: 'floatingVoid' }], + }, + { + code: ` +Promise.reject(new Error('message')).finally(() => {}); + `, + errors: [{ line: 2, messageId: 'floatingVoid' }], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts b/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts index 396a12d36f9..cb0fff64e36 100644 --- a/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts +++ b/packages/eslint-plugin/tests/rules/no-for-in-array.test.ts @@ -1,7 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-for-in-array'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/no-implicit-any-catch.test.ts b/packages/eslint-plugin/tests/rules/no-implicit-any-catch.test.ts deleted file mode 100644 index e04b03889ca..00000000000 --- a/packages/eslint-plugin/tests/rules/no-implicit-any-catch.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* eslint-disable eslint-comments/no-use */ -// TODO - prettier currently removes the type annotations, re-enable this once prettier is updated -/* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ -/* eslint-enable eslint-comments/no-use */ - -import rule from '../../src/rules/no-implicit-any-catch'; -import { RuleTester } from '../RuleTester'; - -const ruleTester = new RuleTester({ - parser: '@typescript-eslint/parser', -}); - -ruleTester.run('no-implicit-any-catch', rule, { - valid: [ - ` -try { -} catch (e1: unknown) {} - `, - { - code: ` -try { -} catch (e2: any) {} - `, - options: [{ allowExplicitAny: true }], - }, - ], - invalid: [ - { - code: ` -try { -} catch (e3) {} - `, - errors: [ - { - line: 3, - column: 3, - messageId: 'implicitAnyInCatch', - endLine: 3, - endColumn: 16, - suggestions: [ - { - messageId: 'suggestExplicitUnknown', - output: ` -try { -} catch (e3: unknown) {} - `, - }, - ], - }, - ], - }, - { - code: ` -try { -} catch (e4: any) {} - `, - options: [{ allowExplicitAny: false }], - errors: [ - { - line: 3, - column: 3, - messageId: 'explicitAnyInCatch', - endLine: 3, - endColumn: 21, - suggestions: [ - { - messageId: 'suggestExplicitUnknown', - output: ` -try { -} catch (e4: unknown) {} - `, - }, - ], - }, - ], - }, - ], -}); diff --git a/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts b/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts index af15aa75851..3b6c11c025d 100644 --- a/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts +++ b/packages/eslint-plugin/tests/rules/no-implied-eval.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-implied-eval'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/no-import-type-side-effects.test.ts b/packages/eslint-plugin/tests/rules/no-import-type-side-effects.test.ts index 98d7923e4b4..f638d22fafa 100644 --- a/packages/eslint-plugin/tests/rules/no-import-type-side-effects.test.ts +++ b/packages/eslint-plugin/tests/rules/no-import-type-side-effects.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-import-type-side-effects'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts index 5a085044685..ce1b5deb277 100644 --- a/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts +++ b/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts @@ -1,3 +1,4 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-inferrable-types'; @@ -5,7 +6,6 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../../src/util'; -import { RuleTester } from '../RuleTester'; type MessageIds = InferMessageIdsTypeFromRule; type Options = InferOptionsTypeFromRule; diff --git a/packages/eslint-plugin/tests/rules/no-invalid-this.test.ts b/packages/eslint-plugin/tests/rules/no-invalid-this.test.ts index b2c774166a1..463f4f3ce9b 100644 --- a/packages/eslint-plugin/tests/rules/no-invalid-this.test.ts +++ b/packages/eslint-plugin/tests/rules/no-invalid-this.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-invalid-this'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -76,7 +77,6 @@ function Foo() { z(x => console.log(x, this)); } `, - options: [{}], // test the default value in schema }, { @@ -86,7 +86,6 @@ function Foo() { z(x => console.log(x, this)); } `, - options: [{ capIsConstructor: true }], // test explicitly set option to the default value }, { @@ -242,7 +241,7 @@ obj.foo = (() => (function () { console.log(this); z(x => console.log(x, this)); -}.call(obj)); +}).call(obj); `, ` var foo = function () { @@ -264,7 +263,7 @@ Reflect.apply( (function () { console.log(this); z(x => console.log(x, this)); -}.apply(obj)); +}).apply(obj); `, // Class Instance Methods. @@ -445,7 +444,6 @@ function foo() { console.log(this); z(x => console.log(x, this)); `, - errors, }, { @@ -467,7 +465,6 @@ z(x => console.log(x, this)); z(x => console.log(x, this)); })(); `, - errors, }, @@ -479,7 +476,6 @@ function foo() { z(x => console.log(x, this)); } `, - errors, }, { @@ -489,7 +485,6 @@ function foo() { z(x => console.log(x, this)); } `, - options: [{ capIsConstructor: false }], // test that the option doesn't reverse the logic and mistakenly allows lowercase functions errors, }, @@ -500,7 +495,6 @@ function Foo() { z(x => console.log(x, this)); } `, - options: [{ capIsConstructor: false }], errors, }, @@ -512,7 +506,6 @@ function foo() { z(x => console.log(x, this)); } `, - errors, }, { @@ -523,7 +516,6 @@ function Foo() { z(x => console.log(x, this)); } `, - options: [{ capIsConstructor: false }], errors, }, @@ -546,7 +538,6 @@ var foo = function () { z(x => console.log(x, this)); }.bar(obj); `, - errors, }, @@ -563,7 +554,6 @@ var obj = { }, }; `, - errors, }, { @@ -578,7 +568,6 @@ var obj = { }, }; `, - errors, }, { @@ -592,7 +581,6 @@ var obj = { }, }; `, - errors, }, { @@ -607,7 +595,6 @@ var obj = { }, }; `, - errors, }, { @@ -619,7 +606,6 @@ obj.foo = function () { }; }; `, - errors, }, { @@ -632,7 +618,6 @@ obj.foo = function () { }; }; `, - errors, }, @@ -649,7 +634,6 @@ class A { } } `, - errors, }, @@ -664,7 +648,6 @@ class A { }); } `, - errors, }, @@ -679,7 +662,6 @@ class A { }; } `, - errors, }, @@ -694,7 +676,6 @@ obj.foo = (function () { }; })(); `, - errors, }, { @@ -704,7 +685,6 @@ obj.foo = (() => () => { z(x => console.log(x, this)); })(); `, - errors, }, // Bind/Call/Apply @@ -716,7 +696,6 @@ var foo = function () { z(x => console.log(x, this)); }.bind(null); `, - errors, }, @@ -725,9 +704,8 @@ var foo = function () { (function () { console.log(this); z(x => console.log(x, this)); -}.call(undefined)); +}).call(undefined); `, - errors, }, @@ -736,9 +714,8 @@ var foo = function () { (function () { console.log(this); z(x => console.log(x, this)); -}.apply(void 0)); +}).apply(void 0); `, - errors, }, @@ -750,7 +727,6 @@ Array.from([], function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -760,7 +736,6 @@ foo.every(function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -770,7 +745,6 @@ foo.filter(function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -780,7 +754,6 @@ foo.find(function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -790,7 +763,6 @@ foo.findIndex(function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -800,7 +772,6 @@ foo.forEach(function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -810,7 +781,6 @@ foo.map(function () { z(x => console.log(x, this)); }); `, - errors, }, { @@ -820,7 +790,6 @@ foo.some(function () { z(x => console.log(x, this)); }); `, - errors, }, @@ -831,7 +800,6 @@ foo.forEach(function () { z(x => console.log(x, this)); }, null); `, - errors, }, @@ -844,7 +812,6 @@ foo.forEach(function () { z(x => console.log(x, this)); } `, - errors, }, { @@ -854,7 +821,6 @@ foo.forEach(function () { z(x => console.log(x, this)); }); `, - errors, }, @@ -865,7 +831,6 @@ var Ctor = function () { z(x => console.log(x, this)); }; `, - options: [{ capIsConstructor: false }], errors, }, @@ -876,7 +841,6 @@ var func = function () { z(x => console.log(x, this)); }; `, - errors, }, { @@ -886,7 +850,6 @@ var func = function () { z(x => console.log(x, this)); }; `, - options: [{ capIsConstructor: false }], errors, }, @@ -898,7 +861,6 @@ Ctor = function () { z(x => console.log(x, this)); }; `, - options: [{ capIsConstructor: false }], errors, }, @@ -909,7 +871,6 @@ func = function () { z(x => console.log(x, this)); }; `, - errors, }, { @@ -919,7 +880,6 @@ func = function () { z(x => console.log(x, this)); }; `, - options: [{ capIsConstructor: false }], errors, }, @@ -933,7 +893,6 @@ function foo( }, ) {} `, - errors, }, @@ -946,7 +905,6 @@ function foo( }, ] = a; `, - errors, }, ], diff --git a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts index 1a972b665be..00ba6e4a51f 100644 --- a/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts +++ b/packages/eslint-plugin/tests/rules/no-invalid-void-type.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-invalid-void-type'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-loop-func.test.ts b/packages/eslint-plugin/tests/rules/no-loop-func.test.ts index 37be3ec45d6..29ccaa62b1f 100644 --- a/packages/eslint-plugin/tests/rules/no-loop-func.test.ts +++ b/packages/eslint-plugin/tests/rules/no-loop-func.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-loop-func'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-loss-of-precision.test.ts b/packages/eslint-plugin/tests/rules/no-loss-of-precision.test.ts index cd783915b4d..9ccfa68ca4c 100644 --- a/packages/eslint-plugin/tests/rules/no-loss-of-precision.test.ts +++ b/packages/eslint-plugin/tests/rules/no-loss-of-precision.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-loss-of-precision'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts index d6aa21a799e..10a4c04b42f 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-magic-numbers'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts b/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts index 0cd71da26cb..8c961a7e4e4 100644 --- a/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts +++ b/packages/eslint-plugin/tests/rules/no-meaningless-void-operator.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-meaningless-void-operator'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/no-misused-new.test.ts b/packages/eslint-plugin/tests/rules/no-misused-new.test.ts index 527d5d46671..4e251d7f047 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-new.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-new.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-misused-new'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts index 3d63e093532..a6d6f1db5ad 100644 --- a/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts +++ b/packages/eslint-plugin/tests/rules/no-misused-promises.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-misused-promises'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); @@ -243,14 +245,22 @@ type O = { const Component = (obj: O) => null; 10} />; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: ` const Component: any = () => null; 10} />; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: ` @@ -314,7 +324,11 @@ declare function Component(props: Props): any; const _ = {}} />; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, ` console.log({ ...(await Promise.resolve({ key: 42 })) }); @@ -474,7 +488,11 @@ restTuple('Hello'); ; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, options: [{ checksVoidReturn: { attributes: true } }], }, ], @@ -931,7 +949,11 @@ type O = { const Component = (obj: O) => null; 0} />; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, errors: [ { line: 6, @@ -947,7 +969,11 @@ type O = { const Component = (obj: O) => null; 0} />; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, errors: [ { line: 6, @@ -965,7 +991,11 @@ const g = async () => 'foo'; const Component = (obj: O) => null; ; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, errors: [ { line: 7, diff --git a/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts b/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts index 3847fda0131..23ffc3568c5 100644 --- a/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts +++ b/packages/eslint-plugin/tests/rules/no-mixed-enums.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-mixed-enums'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ @@ -189,19 +191,19 @@ enum Foo { } `, ` -import { AST_NODE_TYPES } from '@typescript-eslint/types'; +import { Enum } from './mixed-enums-decl'; -declare module '@typescript-eslint/types' { - enum AST_NODE_TYPES { +declare module './mixed-enums-decl' { + enum Enum { StringLike = 'StringLike', } } `, ` -import { TSESTree } from '@typescript-eslint/types'; +import { Enum } from "module-that-does't-exist"; -declare module '@typescript-eslint/types' { - enum TSESTree { +declare module "module-that-doesn't-exist" { + enum Enum { StringLike = 'StringLike', } } @@ -552,10 +554,10 @@ namespace Different { }, { code: ` -import { AST_NODE_TYPES } from '@typescript-eslint/types'; +import { Enum } from './mixed-enums-decl'; -declare module '@typescript-eslint/types' { - enum AST_NODE_TYPES { +declare module './mixed-enums-decl' { + enum Enum { Numeric = 0, } } diff --git a/packages/eslint-plugin/tests/rules/no-namespace.test.ts b/packages/eslint-plugin/tests/rules/no-namespace.test.ts index 11d9d1a6fca..a981ca59b3c 100644 --- a/packages/eslint-plugin/tests/rules/no-namespace.test.ts +++ b/packages/eslint-plugin/tests/rules/no-namespace.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-namespace'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-non-null-asserted-nullish-coalescing.test.ts b/packages/eslint-plugin/tests/rules/no-non-null-asserted-nullish-coalescing.test.ts index f197593f59d..789fd1a8727 100644 --- a/packages/eslint-plugin/tests/rules/no-non-null-asserted-nullish-coalescing.test.ts +++ b/packages/eslint-plugin/tests/rules/no-non-null-asserted-nullish-coalescing.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-non-null-asserted-nullish-coalescing'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts index 5f7caabc5b0..a9fda0210fd 100644 --- a/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/no-non-null-asserted-optional-chain.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-non-null-asserted-optional-chain'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -17,7 +18,6 @@ ruleTester.run('no-non-null-asserted-optional-chain', rule, { 'foo?.bar();', '(foo?.bar).baz!;', '(foo?.bar()).baz!;', - // Valid as of 3.9 'foo?.bar!.baz;', 'foo?.bar!();', "foo?.['bar']!.baz;", diff --git a/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts index e9fae587f55..10dbb0d09c3 100644 --- a/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-non-null-assertion.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-non-null-assertion'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-parameter-properties.test.ts b/packages/eslint-plugin/tests/rules/no-parameter-properties.test.ts deleted file mode 100644 index f4f7fb03d2d..00000000000 --- a/packages/eslint-plugin/tests/rules/no-parameter-properties.test.ts +++ /dev/null @@ -1,714 +0,0 @@ -import rule from '../../src/rules/no-parameter-properties'; -import { RuleTester } from '../RuleTester'; - -const ruleTester = new RuleTester({ - parser: '@typescript-eslint/parser', -}); - -ruleTester.run('no-parameter-properties', rule, { - valid: [ - ` -class Foo { - constructor(name: string) {} -} - `, - ` -class Foo { - constructor(...name: string[]) {} -} - `, - ` -class Foo { - constructor(name: string, age: number) {} -} - `, - ` -class Foo { - constructor(name: string); - constructor(name: string, age?: number) {} -} - `, - { - code: ` -class Foo { - constructor(readonly name: string) {} -} - `, - options: [{ allows: ['readonly'] }], - }, - { - code: ` -class Foo { - constructor(private name: string) {} -} - `, - options: [{ allows: ['private'] }], - }, - { - code: ` -class Foo { - constructor(protected name: string) {} -} - `, - options: [{ allows: ['protected'] }], - }, - { - code: ` -class Foo { - constructor(public name: string) {} -} - `, - options: [{ allows: ['public'] }], - }, - { - code: ` -class Foo { - constructor(private readonly name: string) {} -} - `, - options: [{ allows: ['private readonly'] }], - }, - { - code: ` -class Foo { - constructor(protected readonly name: string) {} -} - `, - options: [{ allows: ['protected readonly'] }], - }, - { - code: ` -class Foo { - constructor(public readonly name: string) {} -} - `, - options: [{ allows: ['public readonly'] }], - }, - { - code: ` -class Foo { - constructor(readonly name: string, private age: number) {} -} - `, - options: [{ allows: ['readonly', 'private'] }], - }, - { - code: ` -class Foo { - constructor(public readonly name: string, private age: number) {} -} - `, - options: [{ allows: ['public readonly', 'private'] }], - }, - // Semantically invalid test case - ` -class Foo { - constructor(private ...name: string[]) {} -} - `, - // Semantically invalid test case - ` -class Foo { - constructor(private [test]: [string]) {} -} - `, - ], - invalid: [ - { - code: ` -class Foo { - constructor(readonly name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(public name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private readonly name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected readonly name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(public readonly name: string) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(public name: string, age: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private name: string, private age: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 3, - column: 37, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected name: string, protected age: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 3, - column: 39, - }, - ], - }, - { - code: ` -class Foo { - constructor(public name: string, public age: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 3, - column: 36, - }, - ], - }, - { - code: ` -class Foo { - constructor(name: string); - constructor(private name: string, age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private name: string); - constructor(private name: string, age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private name: string); - constructor(private name: string, private age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 4, - column: 37, - }, - ], - }, - { - code: ` -class Foo { - constructor(name: string); - constructor(protected name: string, age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected name: string); - constructor(protected name: string, age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected name: string); - constructor(protected name: string, protected age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 4, - column: 39, - }, - ], - }, - { - code: ` -class Foo { - constructor(name: string); - constructor(public name: string, age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(public name: string); - constructor(public name: string, age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(public name: string); - constructor(public name: string, public age?: number) {} -} - `, - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 4, - column: 15, - }, - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 4, - column: 36, - }, - ], - }, - - { - code: ` -class Foo { - constructor(readonly name: string) {} -} - `, - options: [{ allows: ['private'] }], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private name: string) {} -} - `, - options: [{ allows: ['readonly'] }], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected name: string) {} -} - `, - options: [ - { - allows: ['readonly', 'private', 'public', 'protected readonly'], - }, - ], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(public name: string) {} -} - `, - options: [ - { - allows: [ - 'readonly', - 'private', - 'protected', - 'protected readonly', - 'public readonly', - ], - }, - ], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private readonly name: string) {} -} - `, - options: [{ allows: ['readonly', 'private'] }], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(protected readonly name: string) {} -} - `, - options: [ - { - allows: [ - 'readonly', - 'protected', - 'private readonly', - 'public readonly', - ], - }, - ], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'name', - }, - line: 3, - column: 15, - }, - ], - }, - { - code: ` -class Foo { - constructor(private name: string); - constructor(private name: string, protected age?: number) {} -} - `, - options: [{ allows: ['private'] }], - errors: [ - { - messageId: 'noParamProp', - data: { - parameter: 'age', - }, - line: 4, - column: 37, - }, - ], - }, - ], -}); diff --git a/packages/eslint-plugin/tests/rules/no-redeclare.test.ts b/packages/eslint-plugin/tests/rules/no-redeclare.test.ts index fcaf99e409d..d53c023c435 100644 --- a/packages/eslint-plugin/tests/rules/no-redeclare.test.ts +++ b/packages/eslint-plugin/tests/rules/no-redeclare.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-redeclare'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts index 29259f4b3f0..04ee15735c4 100644 --- a/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts +++ b/packages/eslint-plugin/tests/rules/no-redundant-type-constituents.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-redundant-type-constituents'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/no-require-imports.test.ts b/packages/eslint-plugin/tests/rules/no-require-imports.test.ts index d884c77a6d6..ff6cbd2a603 100644 --- a/packages/eslint-plugin/tests/rules/no-require-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/no-require-imports.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-require-imports'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts b/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts index b93c8d7e41b..1f3e4748b11 100644 --- a/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts +++ b/packages/eslint-plugin/tests/rules/no-restricted-imports.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-restricted-imports'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts index bd4f9bfdee6..1b81df4435a 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow-eslint.test.ts @@ -2,12 +2,10 @@ // Original Code: https://github.com/t-mangoe/eslint/blob/c4a70499720f48e27734068074fbeee4f48fb460/tests/lib/rules/no-shadow.js // License : https://github.com/eslint/eslint/blob/c4a70499720f48e27734068074fbeee4f48fb460/LICENSE -'use strict'; - +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../../src/rules/no-shadow'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts index 854154ff096..ae00139d982 100644 --- a/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts +++ b/packages/eslint-plugin/tests/rules/no-shadow/no-shadow.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../../src/rules/no-shadow'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts index 942fcf810ff..6df8dbb38c7 100644 --- a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-this-alias'; -import { RuleTester } from '../RuleTester'; const idError = { messageId: 'thisAssignment' as const, diff --git a/packages/eslint-plugin/tests/rules/no-throw-literal.test.ts b/packages/eslint-plugin/tests/rules/no-throw-literal.test.ts index a85614327cf..12373d220bc 100644 --- a/packages/eslint-plugin/tests/rules/no-throw-literal.test.ts +++ b/packages/eslint-plugin/tests/rules/no-throw-literal.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-throw-literal'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts index ed2c00c9991..12acba6dd3f 100644 --- a/packages/eslint-plugin/tests/rules/no-type-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-type-alias.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-type-alias'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-boolean-literal-compare.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-boolean-literal-compare.test.ts index 7c22e7d8d15..897f616fc57 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-boolean-literal-compare.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-boolean-literal-compare.test.ts @@ -1,5 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unnecessary-boolean-literal-compare'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index e3647102305..c68c735ae11 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -1,7 +1,8 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import type { InvalidTestCase, TestCaseError, -} from '@typescript-eslint/utils/dist/ts-eslint'; +} from '@typescript-eslint/utils/ts-eslint'; import * as path from 'path'; import type { @@ -9,7 +10,7 @@ import type { Options, } from '../../src/rules/no-unnecessary-condition'; import rule from '../../src/rules/no-unnecessary-condition'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -280,6 +281,16 @@ function test(a: string | null | undefined) { ` function test(a: unknown) { return a ?? 'default'; +} + `, + ` +function test(a: T) { + return a ?? 'default'; +} + `, + ` +function test(a: T) { + return a ?? 'default'; } `, // Indexing cases @@ -584,6 +595,7 @@ function getElem(dict: Record, key: string) { } `, parserOptions: { + EXPERIMENTAL_useProjectService: false, tsconfigRootDir: getFixturesRootDir(), project: './tsconfig.noUncheckedIndexedAccess.json', }, @@ -827,6 +839,14 @@ function test(a: string) { code: ` function test(a: string | false) { return a ?? 'default'; +} + `, + errors: [ruleError(3, 10, 'neverNullish')], + }, + { + code: ` +function test(a: T) { + return a ?? 'default'; } `, errors: [ruleError(3, 10, 'neverNullish')], @@ -858,6 +878,14 @@ function test(a: null[]) { }, { code: ` +function test(a: T) { + return a ?? 'default'; +} + `, + errors: [ruleError(3, 10, 'alwaysNullish')], + }, + { + code: ` function test(a: never) { return a ?? 'default'; } diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts index 391f84ac5da..e31a8a99ecd 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts @@ -1,7 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-unnecessary-qualifier'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index abedc24d274..162877446c6 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unnecessary-type-arguments'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts index 8b5bec5f592..8cf362938ba 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import path from 'path'; import rule from '../../src/rules/no-unnecessary-type-assertion'; -import { RuleTester } from '../RuleTester'; const rootDir = path.resolve(__dirname, '../fixtures/'); const ruleTester = new RuleTester({ @@ -153,7 +153,11 @@ function Test(props: { id?: null | string | number }) { return
; } `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: ` @@ -488,7 +492,11 @@ function Test(props: { id?: string | number }) { line: 9, }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: ` diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts index 72bde5788ca..d96da6e779f 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-constraint.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unnecessary-type-constraint'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { @@ -121,7 +122,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: noFormat`const data = () => {};`, @@ -141,7 +146,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: noFormat`const data = () => {};`, @@ -161,7 +170,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: noFormat`const data = () => {};`, @@ -181,7 +194,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: noFormat`const data = () => {};`, @@ -201,7 +218,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: 'const data = () => {};', @@ -221,7 +242,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: 'const data = () => {};', @@ -255,7 +280,11 @@ function data() {} ], }, ], - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: 'function data() {}', diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts index 77058a563a9..3b17a756c42 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-argument.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unsafe-argument'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts index 8b08ec79ff9..fb2d713e647 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-assignment.test.ts @@ -1,3 +1,4 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-unsafe-assignment'; @@ -5,12 +6,7 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../../src/util'; -import { - batchedSingleLineTests, - getFixturesRootDir, - noFormat, - RuleTester, -} from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; type Options = InferOptionsTypeFromRule; type MessageIds = InferMessageIdsTypeFromRule; @@ -69,6 +65,7 @@ function assignmentTest( const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + EXPERIMENTAL_useProjectService: false, project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, @@ -113,7 +110,7 @@ class Foo { 'const x = new Set();', 'const x = { y: 1 };', 'const x = { y = 1 };', - noFormat`const x = { y(); };`, + noFormat`const x = { y(){} };`, 'const x: { y: number } = { y: 1 };', 'const x = [...[1, 2, 3]];', 'const [{ [`x${1}`]: x }] = [{ [`x`]: 1 }] as [{ [`x`]: any }];', @@ -123,21 +120,33 @@ type Props = { a: string }; declare function Foo(props: Props): never; ; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: ` declare function Foo(props: { a: string }): never; ; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, { code: ` declare function Foo(props: { a: string }): never; ; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, 'const x: unknown = y as any;', 'const x: unknown[] = y as any[];', @@ -146,74 +155,53 @@ declare function Foo(props: { a: string }): never; 'const x: Map = new Map();', ], invalid: [ - ...batchedSingleLineTests({ - code: noFormat` -const x = (1 as any); -const x = (1 as any), y = 1; -function foo(a = (1 as any)) {} -class Foo { constructor(private a = (1 as any)) {} } -class Foo { private a = (1 as any) } + { + code: 'const x = 1 as any;', + errors: [{ messageId: 'anyAssignment' }], + }, + { + code: ` +const x = 1 as any, + y = 1; `, - errors: [ - { - messageId: 'anyAssignment', - line: 2, - column: 7, - endColumn: 21, - }, - { - messageId: 'anyAssignment', - line: 3, - column: 7, - endColumn: 21, - }, - { - messageId: 'anyAssignment', - line: 4, - column: 14, - endColumn: 28, - }, - { - messageId: 'anyAssignment', - line: 5, - column: 33, - endColumn: 47, - }, - { - messageId: 'anyAssignment', - line: 6, - column: 13, - endColumn: 35, - }, - ], - }), - ...batchedSingleLineTests({ + errors: [{ messageId: 'anyAssignment' }], + }, + { + code: 'function foo(a = 1 as any) {}', + errors: [{ messageId: 'anyAssignment' }], + }, + { + code: ` +class Foo { + constructor(private a = 1 as any) {} +} + `, + errors: [{ messageId: 'anyAssignment' }], + }, + { + code: ` +class Foo { + private a = 1 as any; +} + `, + errors: [{ messageId: 'anyAssignment' }], + }, + + { code: ` const [x] = 1 as any; -const [x] = [] as any[]; `, - errors: [ - { - messageId: 'anyAssignment', - line: 2, - column: 7, - endColumn: 21, - }, - { - messageId: 'unsafeArrayPattern', - line: 3, - column: 7, - endColumn: 10, - }, - ], - }), - ...batchedSingleLineTests({ - code: noFormat` -const x: Set = new Set(); -const x: Map = new Map(); -const x: Set = new Set(); -const x: Set>> = new Set>>(); + errors: [{ messageId: 'anyAssignment' }], + }, + { + code: ` +const [x] = [] as any[]; `, + errors: [{ messageId: 'unsafeArrayPattern' }], + }, + + { + code: 'const x: Set = new Set();', errors: [ { messageId: 'unsafeAssignment', @@ -221,34 +209,46 @@ const x: Set>> = new Set>>(); sender: 'Set', receiver: 'Set', }, - line: 2, }, + ], + }, + { + code: 'const x: Map = new Map();', + errors: [ { messageId: 'unsafeAssignment', data: { sender: 'Map', receiver: 'Map', }, - line: 3, }, + ], + }, + { + code: 'const x: Set = new Set();', + errors: [ { messageId: 'unsafeAssignment', data: { sender: 'Set', receiver: 'Set', }, - line: 4, }, + ], + }, + { + code: 'const x: Set>> = new Set>>();', + errors: [ { messageId: 'unsafeAssignment', data: { sender: 'Set>>', receiver: 'Set>>', }, - line: 5, }, ], - }), + }, + ...assignmentTest([ ['[x] = [1] as [any]', 2, 3], ['[[[[x]]]] = [[[[1 as any]]]]', 5, 6], @@ -269,55 +269,52 @@ const x: Set>> = new Set>>(); }, ], }, - ...batchedSingleLineTests({ + + { code: ` const x = [...(1 as any)]; + `, + errors: [{ messageId: 'unsafeArraySpread' }], + }, + { + code: ` const x = [...([] as any[])]; `, - errors: [ - { - messageId: 'unsafeArraySpread', - line: 2, - column: 12, - endColumn: 25, - }, - { - messageId: 'unsafeArraySpread', - line: 3, - column: 12, - endColumn: 28, - }, - ], - }), + errors: [{ messageId: 'unsafeArraySpread' }], + }, + ...assignmentTest([ ['{x} = {x: 1} as {x: any}', 2, 3], ['{x: y} = {x: 1} as {x: any}', 5, 6], ['{x: {y}} = {x: {y: 1}} as {x: {y: any}}', 6, 7], ['{x: [y]} = {x: {y: 1}} as {x: [any]}', 6, 7], ]), - ...batchedSingleLineTests({ - code: ` -const x = { y: 1 as any }; -const x = { y: { z: 1 as any } }; -const x: { y: Set>> } = { y: new Set>>() }; -const x = { ...(1 as any) }; - `, + + { + code: 'const x = { y: 1 as any };', errors: [ { messageId: 'anyAssignment', - line: 2, column: 13, endColumn: 24, }, + ], + }, + { + code: 'const x = { y: { z: 1 as any } };', + errors: [ { messageId: 'anyAssignment', - line: 3, column: 18, endColumn: 29, }, + ], + }, + { + code: 'const x: { y: Set>> } = { y: new Set>>() };', + errors: [ { messageId: 'unsafeAssignment', - line: 4, column: 43, endColumn: 70, data: { @@ -325,22 +322,31 @@ const x = { ...(1 as any) }; receiver: 'Set>>', }, }, + ], + }, + { + code: 'const x = { ...(1 as any) };', + errors: [ { // spreading an any widens the object type to any messageId: 'anyAssignment', - line: 5, column: 7, endColumn: 28, }, ], - }), + }, + { code: ` type Props = { a: string }; declare function Foo(props: Props): never; ; `, - filename: 'react.tsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, errors: [ { messageId: 'anyAssignment', diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts index db71189a697..bb844011fd7 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-call.test.ts @@ -1,14 +1,12 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unsafe-call'; -import { - batchedSingleLineTests, - getFixturesRootDir, - noFormat, - RuleTester, -} from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + EXPERIMENTAL_useProjectService: false, project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, @@ -47,107 +45,95 @@ function foo(x: { a?: () => void }) { `, ], invalid: [ - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: any) { x() } -function foo(x: any) { x?.() } -function foo(x: any) { x.a.b.c.d.e.f.g() } -function foo(x: any) { x.a.b.c.d.e.f.g?.() } + { + code: ` +function foo(x: any) { + x(); +} `, - errors: [ - { - messageId: 'unsafeCall', - line: 2, - column: 24, - endColumn: 25, - }, - { - messageId: 'unsafeCall', - line: 3, - column: 24, - endColumn: 25, - }, - { - messageId: 'unsafeCall', - line: 4, - column: 24, - endColumn: 39, - }, - { - messageId: 'unsafeCall', - line: 5, - column: 24, - endColumn: 39, - }, - ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: { a: any }) { x.a() } -function foo(x: { a: any }) { x?.a() } -function foo(x: { a: any }) { x.a?.() } + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: any) { + x?.(); +} `, - errors: [ - { - messageId: 'unsafeCall', - line: 2, - column: 31, - endColumn: 34, - }, - { - messageId: 'unsafeCall', - line: 3, - column: 31, - endColumn: 35, - }, - { - messageId: 'unsafeCall', - line: 4, - column: 31, - endColumn: 34, - }, - ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: any) { new x() } -function foo(x: { a: any }) { new x.a() } + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: any) { + x.a.b.c.d.e.f.g(); +} `, - errors: [ - { - messageId: 'unsafeNew', - line: 2, - column: 24, - endColumn: 31, - }, - { - messageId: 'unsafeNew', - line: 3, - column: 31, - endColumn: 40, - }, - ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: any) { x\`foo\` } -function foo(x: { tag: any }) { x.tag\`foo\` } + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: any) { + x.a.b.c.d.e.f.g?.(); +} `, - errors: [ - { - messageId: 'unsafeTemplateTag', - line: 2, - column: 24, - endColumn: 25, - }, - { - messageId: 'unsafeTemplateTag', - line: 3, - column: 33, - endColumn: 38, - }, - ], - }), + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: { a: any }) { + x.a(); +} + `, + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: { a: any }) { + x?.a(); +} + `, + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: { a: any }) { + x.a?.(); +} + `, + errors: [{ messageId: 'unsafeCall' }], + }, + { + code: ` +function foo(x: any) { + new x(); +} + `, + errors: [{ messageId: 'unsafeNew' }], + }, + { + code: ` +function foo(x: { a: any }) { + new x.a(); +} + `, + errors: [{ messageId: 'unsafeNew' }], + }, + { + code: ` +function foo(x: any) { + x\`foo\`; +} + `, + errors: [{ messageId: 'unsafeTemplateTag' }], + }, + { + code: ` +function foo(x: { tag: any }) { + x.tag\`foo\`; +} + `, + errors: [{ messageId: 'unsafeTemplateTag' }], + }, + { code: noFormat` const methods = { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts index 1feabbe8158..82be9996f20 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-declaration-merging.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unsafe-declaration-merging'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts new file mode 100644 index 00000000000..adb3630354e --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-unsafe-enum-comparison.test.ts @@ -0,0 +1,555 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + +import rule from '../../src/rules/no-unsafe-enum-comparison'; +import { getFixturesRootDir } from '../RuleTester'; + +const rootDir = getFixturesRootDir(); + +const ruleTester = new RuleTester({ + parserOptions: { + ecmaVersion: 2015, + tsconfigRootDir: rootDir, + project: './tsconfig.json', + }, + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('strict-enums-comparison', rule, { + valid: [ + "'a' > 'b';", + "'a' < 'b';", + "'a' == 'b';", + "'a' === 'b';", + '1 > 2;', + '1 < 2;', + '1 == 2;', + '1 === 2;', + ` + enum Fruit { + Apple, + } + Fruit.Apple === ({} as any); + `, + ` + enum Fruit { + Apple, + } + Fruit.Apple === undefined; + `, + ` + enum Fruit { + Apple, + } + Fruit.Apple === null; + `, + ` + enum Fruit { + Apple, + } + declare const fruit: Fruit | -1; + fruit === -1; + `, + ` + enum Fruit { + Apple, + } + declare const fruit: Fruit | number; + fruit === -1; + `, + ` + enum Fruit { + Apple, + } + declare const fruit: Fruit | 'apple'; + fruit === 'apple'; + `, + ` + enum Fruit { + Apple, + } + declare const fruit: Fruit | string; + fruit === 'apple'; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | 'apple'; + fruit === 'apple'; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | string; + fruit === 'apple'; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | 0; + fruit === 0; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | number; + fruit === 0; + `, + ` + enum Fruit { + Apple, + } + declare const fruit: Fruit | 'apple'; + fruit === Math.random() > 0.5 ? 'apple' : Fruit.Apple; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | 'apple'; + fruit === Math.random() > 0.5 ? 'apple' : Fruit.Apple; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | string; + fruit === Math.random() > 0.5 ? 'apple' : Fruit.Apple; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | 0; + fruit === Math.random() > 0.5 ? 0 : Fruit.Apple; + `, + ` + enum Fruit { + Apple = 'apple', + } + declare const fruit: Fruit | number; + fruit === Math.random() > 0.5 ? 0 : Fruit.Apple; + `, + ` + enum Fruit { + Apple, + Banana, + } + Fruit.Apple === Fruit.Banana; + `, + ` + enum Fruit { + Apple = 0, + Banana = 1, + } + Fruit.Apple === Fruit.Banana; + `, + ` + enum Fruit { + Apple = 'apple', + Banana = 'banana', + } + Fruit.Apple === Fruit.Banana; + `, + ` + enum Fruit { + Apple, + Banana, + } + const fruit = Fruit.Apple; + fruit === Fruit.Banana; + `, + ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + const vegetable = Vegetable.Asparagus; + vegetable === Vegetable.Beet; + `, + ` + enum Fruit { + Apple, + Banana, + Cherry, + } + const fruit1 = Fruit.Apple; + const fruit2 = Fruit.Banana; + fruit1 === fruit2; + `, + ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + const vegetable1 = Vegetable.Asparagus; + const vegetable2 = Vegetable.Beet; + vegetable1 === vegetable2; + `, + ` + enum Fruit { + Apple, + Banana, + Cherry, + } + enum Fruit2 { + Apple2, + Banana2, + Cherry2, + } + declare const left: number | Fruit; + declare const right: number | Fruit2; + left === right; + `, + ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + enum Vegetable2 { + Asparagus2 = 'asparagus2', + Beet2 = 'beet2', + Celery2 = 'celery2', + } + declare const left: string | Vegetable; + declare const right: string | Vegetable2; + left === right; + `, + ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + type WeirdString = string & { __someBrand: void }; + declare const weirdString: WeirdString; + Vegetable.Asparagus === weirdString; + `, + ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + const foo = {}; + const vegetable = Vegetable.Asparagus; + vegetable in foo; + `, + ` + enum Fruit { + Apple, + Banana, + Cherry, + } + declare const fruitOrBoolean: Fruit | boolean; + fruitOrBoolean === true; + `, + ` + enum Str { + A = 'a', + } + enum Num { + B = 1, + } + enum Mixed { + A = 'a', + B = 1, + } + + declare const str: Str; + declare const strOrString: Str | string; + + declare const num: Num; + declare const numOrNumber: Num | number; + + declare const mixed: Mixed; + declare const mixedOrStringOrNumber: Mixed | string | number; + + function someFunction() {} + + // following are all ignored due to the presence of "| string" or "| number" + strOrString === 'a'; + numOrNumber === 1; + mixedOrStringOrNumber === 'a'; + mixedOrStringOrNumber === 1; + + // following are all ignored because the value can never be an enum value + str === 1; + num === 'a'; + str === {}; + num === {}; + mixed === {}; + str === true; + num === true; + mixed === true; + str === someFunction; + num === someFunction; + mixed === someFunction; + `, + ], + invalid: [ + { + code: ` + enum Fruit { + Apple, + } + Fruit.Apple < 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + } + Fruit.Apple > 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + } + Fruit.Apple == 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + } + Fruit.Apple === 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + } + Fruit.Apple != 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + } + Fruit.Apple !== 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple = 0, + Banana = 'banana', + } + Fruit.Apple === 0; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple = 0, + Banana = 'banana', + } + Fruit.Banana === ''; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + Vegetable.Asparagus === 'beet'; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + Banana, + Cherry, + } + 1 === Fruit.Apple; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + 'beet' === Vegetable.Asparagus; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + Banana, + Cherry, + } + const fruit = Fruit.Apple; + fruit === 1; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + const vegetable = Vegetable.Asparagus; + vegetable === 'beet'; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Fruit { + Apple, + Banana, + Cherry, + } + const fruit = Fruit.Apple; + 1 === fruit; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + const vegetable = Vegetable.Asparagus; + 'beet' === vegetable; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: + 'enum Fruit { Apple, Banana, Cherry }' + + `enum Fruit2 { + Apple2, + Banana2, + Cherry2, +} + Fruit.Apple === Fruit2.Apple2; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + enum Vegetable2 { + Asparagus2 = 'asparagus2', + Beet2 = 'beet2', + Celery2 = 'celery2', + } + Vegetable.Asparagus === Vegetable2.Asparagus2; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: + 'enum Fruit { Apple, Banana, Cherry }' + + `enum Fruit2 { + Apple2, + Banana2, + Cherry2, +} + const fruit = Fruit.Apple; + fruit === Fruit2.Apple2; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Vegetable { + Asparagus = 'asparagus', + Beet = 'beet', + Celery = 'celery', + } + enum Vegetable2 { + Asparagus2 = 'asparagus2', + Beet2 = 'beet2', + Celery2 = 'celery2', + } + const vegetable = Vegetable.Asparagus; + vegetable === Vegetable2.Asparagus2; + `, + errors: [{ messageId: 'mismatched' }], + }, + { + code: ` + enum Str { + A = 'a', + } + enum Num { + B = 1, + } + enum Mixed { + A = 'a', + B = 1, + } + + declare const str: Str; + declare const num: Num; + declare const mixed: Mixed; + + // following are all errors because the value might be an enum value + str === 'a'; + num === 1; + mixed === 'a'; + mixed === 1; + `, + errors: [ + { messageId: 'mismatched' }, + { messageId: 'mismatched' }, + { messageId: 'mismatched' }, + { messageId: 'mismatched' }, + ], + }, + { + code: ` + enum Fruit { + Apple = 'apple', + } + type __String = + | (string & { __escapedIdentifier: void }) + | (void & { __escapedIdentifier: void }) + | Fruit; + declare const weirdString: __String; + weirdString === 'someArbitraryValue'; + `, + errors: [{ messageId: 'mismatched' }], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-member-access.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-member-access.test.ts index 5ab598c3a5a..8298cec6ceb 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-member-access.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-member-access.test.ts @@ -1,14 +1,12 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unsafe-member-access'; -import { - batchedSingleLineTests, - getFixturesRootDir, - noFormat, - RuleTester, -} from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + EXPERIMENTAL_useProjectService: false, project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, @@ -74,11 +72,11 @@ interface B extends FG.A {} `, ], invalid: [ - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: any) { x.a } -function foo(x: any) { x.a.b.c.d.e.f.g } -function foo(x: { a: any }) { x.a.b.c.d.e.f.g } + { + code: ` +function foo(x: any) { + x.a; +} `, errors: [ { @@ -86,34 +84,44 @@ function foo(x: { a: any }) { x.a.b.c.d.e.f.g } data: { property: '.a', }, - line: 2, - column: 24, - endColumn: 27, }, + ], + }, + { + code: ` +function foo(x: any) { + x.a.b.c.d.e.f.g; +} + `, + errors: [ { messageId: 'unsafeMemberExpression', data: { property: '.a', }, - line: 3, - column: 24, - endColumn: 27, }, + ], + }, + { + code: ` +function foo(x: { a: any }) { + x.a.b.c.d.e.f.g; +} + `, + errors: [ { messageId: 'unsafeMemberExpression', data: { property: '.b', }, - line: 4, - column: 31, - endColumn: 36, }, ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: any) { x['a'] } -function foo(x: any) { x['a']['b']['c'] } + }, + { + code: ` +function foo(x: any) { + x['a']; +} `, errors: [ { @@ -121,29 +129,29 @@ function foo(x: any) { x['a']['b']['c'] } data: { property: "['a']", }, - line: 2, - column: 24, - endColumn: 30, }, + ], + }, + { + code: ` +function foo(x: any) { + x['a']['b']['c']; +} + `, + errors: [ { messageId: 'unsafeMemberExpression', data: { property: "['a']", }, - line: 3, - column: 24, - endColumn: 30, }, ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo(x: { a: number }, y: any) { x[y] } -function foo(x?: { a: number }, y: any) { x?.[y] } -function foo(x: { a: number }, y: any) { x[y += 1] } -function foo(x: { a: number }, y: any) { x[1 as any] } -function foo(x: { a: number }, y: any) { x[y()] } -function foo(x: string[], y: any) { x[y] } + }, + { + code: ` +function foo(x: { a: number }, y: any) { + x[y]; +} `, errors: [ { @@ -151,57 +159,85 @@ function foo(x: string[], y: any) { x[y] } data: { property: '[y]', }, - line: 2, - column: 44, - endColumn: 45, }, + ], + }, + { + code: ` +function foo(x?: { a: number }, y: any) { + x?.[y]; +} + `, + errors: [ { messageId: 'unsafeComputedMemberAccess', data: { property: '[y]', }, - line: 3, - column: 47, - endColumn: 48, }, + ], + }, + { + code: ` +function foo(x: { a: number }, y: any) { + x[(y += 1)]; +} + `, + errors: [ { messageId: 'unsafeComputedMemberAccess', data: { property: '[y += 1]', }, - line: 4, - column: 44, - endColumn: 50, }, + ], + }, + { + code: ` +function foo(x: { a: number }, y: any) { + x[1 as any]; +} + `, + errors: [ { messageId: 'unsafeComputedMemberAccess', data: { property: '[1 as any]', }, - line: 5, - column: 44, - endColumn: 52, }, + ], + }, + { + code: ` +function foo(x: { a: number }, y: any) { + x[y()]; +} + `, + errors: [ { messageId: 'unsafeComputedMemberAccess', data: { property: '[y()]', }, - line: 6, - column: 44, - endColumn: 47, }, + ], + }, + { + code: ` +function foo(x: string[], y: any) { + x[y]; +} + `, + errors: [ { messageId: 'unsafeComputedMemberAccess', data: { property: '[y]', }, - line: 7, - column: 39, - endColumn: 40, }, ], - }), + }, + { code: noFormat` const methods = { diff --git a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts index 47ec9701a77..b75cdfb28c0 100644 --- a/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unsafe-return.test.ts @@ -1,14 +1,12 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-unsafe-return'; -import { - batchedSingleLineTests, - getFixturesRootDir, - noFormat, - RuleTester, -} from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + EXPERIMENTAL_useProjectService: false, project: './tsconfig.noImplicitThis.json', tsconfigRootDir: getFixturesRootDir(), }, @@ -112,12 +110,11 @@ function foo(): Set { `, ], invalid: [ - ...batchedSingleLineTests({ - code: noFormat` -function foo() { return (1 as any); } -function foo() { return Object.create(null); } -const foo = () => { return (1 as any) }; -const foo = () => Object.create(null); + { + code: ` +function foo() { + return 1 as any; +} `, errors: [ { @@ -125,43 +122,55 @@ const foo = () => Object.create(null); data: { type: 'any', }, - line: 2, - column: 18, }, + ], + }, + { + code: ` +function foo() { + return Object.create(null); +} + `, + errors: [ { messageId: 'unsafeReturn', data: { type: 'any', }, - line: 3, - column: 18, }, + ], + }, + { + code: ` +const foo = () => { + return 1 as any; +}; + `, + errors: [ { messageId: 'unsafeReturn', data: { type: 'any', }, - line: 4, - column: 21, }, + ], + }, + { + code: 'const foo = () => Object.create(null);', + errors: [ { messageId: 'unsafeReturn', data: { type: 'any', }, - line: 5, - column: 19, }, ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo() { return ([] as any[]); } -function foo() { return ([] as Array); } -function foo() { return ([] as readonly any[]); } -function foo() { return ([] as Readonly); } -const foo = () => { return ([] as any[]) }; -const foo = () => ([] as any[]); + }, + { + code: ` +function foo() { + return [] as any[]; +} `, errors: [ { @@ -169,57 +178,85 @@ const foo = () => ([] as any[]); data: { type: 'any[]', }, - line: 2, - column: 18, }, + ], + }, + { + code: ` +function foo() { + return [] as Array; +} + `, + errors: [ { messageId: 'unsafeReturn', data: { type: 'any[]', }, - line: 3, - column: 18, }, + ], + }, + { + code: ` +function foo() { + return [] as readonly any[]; +} + `, + errors: [ { messageId: 'unsafeReturn', data: { type: 'any[]', }, - line: 4, - column: 18, }, + ], + }, + { + code: ` +function foo() { + return [] as Readonly; +} + `, + errors: [ { messageId: 'unsafeReturn', data: { type: 'any[]', }, - line: 5, - column: 18, }, + ], + }, + { + code: ` +const foo = () => { + return [] as any[]; +}; + `, + errors: [ { messageId: 'unsafeReturn', data: { type: 'any[]', }, - line: 6, - column: 21, }, + ], + }, + { + code: 'const foo = () => [] as any[];', + errors: [ { messageId: 'unsafeReturn', data: { type: 'any[]', }, - line: 7, - column: 20, }, ], - }), - ...batchedSingleLineTests({ - code: noFormat` -function foo(): Set { return new Set(); } -function foo(): Map { return new Map(); } -function foo(): Set { return new Set(); } -function foo(): Set>> { return new Set>>(); } + }, + { + code: ` +function foo(): Set { + return new Set(); +} `, errors: [ { @@ -228,34 +265,58 @@ function foo(): Set>> { return new Set>>(); } sender: 'Set', receiver: 'Set', }, - line: 2, }, + ], + }, + { + code: ` +function foo(): Map { + return new Map(); +} + `, + errors: [ { messageId: 'unsafeReturnAssignment', data: { sender: 'Map', receiver: 'Map', }, - line: 3, }, + ], + }, + { + code: ` +function foo(): Set { + return new Set(); +} + `, + errors: [ { messageId: 'unsafeReturnAssignment', data: { sender: 'Set', receiver: 'Set', }, - line: 4, }, + ], + }, + { + code: ` +function foo(): Set>> { + return new Set>>(); +} + `, + errors: [ { messageId: 'unsafeReturnAssignment', data: { sender: 'Set>>', receiver: 'Set>>', }, - line: 5, }, ], - }), + }, + { code: ` type Fn = () => Set; diff --git a/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts b/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts index 36a0adda0dc..1160917f6ed 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-expressions.test.ts @@ -1,7 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-unused-expressions'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts index 38438bceb6f..06300a7821c 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars-eslint.test.ts @@ -2,14 +2,12 @@ // Original Code: https://github.com/eslint/eslint/blob/0cb81a9b90dd6b92bac383022f886e501bd2cb31/tests/lib/rules/no-unused-vars.js // License : https://github.com/eslint/eslint/blob/0cb81a9b90dd6b92bac383022f886e501bd2cb31/LICENSE -'use strict'; - +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import type { MessageIds } from '../../../src/rules/no-unused-vars'; import rule from '../../../src/rules/no-unused-vars'; -import { RuleTester } from '../../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts index ee2191a3f4c..2646f3ce55b 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars/no-unused-vars.test.ts @@ -1,6 +1,8 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../../src/rules/no-unused-vars'; import { collectUnusedVariables } from '../../../src/util'; -import { getFixturesRootDir, noFormat, RuleTester } from '../../RuleTester'; +import { getFixturesRootDir } from '../../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { @@ -12,6 +14,7 @@ const ruleTester = new RuleTester({ }); const withMetaParserOptions = { + EXPERIMENTAL_useProjectService: false, tsconfigRootDir: getFixturesRootDir(), project: './tsconfig-withmeta.json', }; @@ -587,7 +590,6 @@ export interface Bar extends foo.i18n {} `, { // https://github.com/typescript-eslint/typescript-eslint/issues/141 - filename: 'test.tsx', code: ` import { TypeA } from './interface'; export const a = />; @@ -600,7 +602,6 @@ export const a = />; }, { // https://github.com/typescript-eslint/typescript-eslint/issues/160 - filename: 'test.tsx', code: ` const text = 'text'; export function Foo() { @@ -611,6 +612,11 @@ export function Foo() { ); } `, + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, }, // https://github.com/eslint/typescript-eslint-parser/issues/535 ` @@ -778,8 +784,10 @@ export interface Event { }, // https://github.com/typescript-eslint/typescript-eslint/issues/2369 ` -export default function (@Optional() value = []) { - return value; +export class Test { + constructor(@Optional() value: number[] = []) { + console.log(value); + } } function Optional() { @@ -1072,6 +1080,18 @@ export class Foo { typescript: '4.4', }, }, + ` +interface Foo { + bar: string; +} +export const Foo = 'bar'; + `, + ` +export const Foo = 'bar'; +interface Foo { + bar: string; +} + `, ], invalid: [ @@ -1797,5 +1817,25 @@ x = foo(x); }, ], }, + { + code: ` +interface Foo { + bar: string; +} +const Foo = 'bar'; + `, + errors: [ + { + messageId: 'unusedVar', + line: 5, + column: 7, + data: { + varName: 'Foo', + action: 'assigned a value', + additional: '', + }, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts index 465cf69168e..44ce43101e7 100644 --- a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts +++ b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-use-before-define'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts index a8b0dd92e03..a68ee56fb8f 100644 --- a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/no-useless-constructor'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { @@ -138,11 +138,6 @@ class A { ` abstract class A { constructor(); -} - `, - ` -abstract class A { - abstract constructor(); } `, // https://github.com/typescript-eslint/typescript-eslint/issues/48 diff --git a/packages/eslint-plugin/tests/rules/no-useless-empty-export.test.ts b/packages/eslint-plugin/tests/rules/no-useless-empty-export.test.ts index ea13395ec9e..6ed201033bb 100644 --- a/packages/eslint-plugin/tests/rules/no-useless-empty-export.test.ts +++ b/packages/eslint-plugin/tests/rules/no-useless-empty-export.test.ts @@ -2,8 +2,9 @@ // this rule tests the spacing, which prettier will want to fix and break the tests /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-useless-empty-export'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/no-var-requires.test.ts b/packages/eslint-plugin/tests/rules/no-var-requires.test.ts index 1e38c482218..14ce5110994 100644 --- a/packages/eslint-plugin/tests/rules/no-var-requires.test.ts +++ b/packages/eslint-plugin/tests/rules/no-var-requires.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/no-var-requires'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts b/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts index 6826230b4fd..8b86634d279 100644 --- a/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts +++ b/packages/eslint-plugin/tests/rules/non-nullable-type-assertion-style.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/non-nullable-type-assertion-style'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { @@ -202,6 +204,7 @@ const y = x!; const ruleTesterWithNoUncheckedIndexAccess = new RuleTester({ parserOptions: { + EXPERIMENTAL_useProjectService: false, sourceType: 'module', tsconfigRootDir: getFixturesRootDir(), project: './tsconfig.noUncheckedIndexedAccess.json', diff --git a/packages/eslint-plugin/tests/rules/object-curly-spacing.test.ts b/packages/eslint-plugin/tests/rules/object-curly-spacing.test.ts index 49861e5229a..df37213121c 100644 --- a/packages/eslint-plugin/tests/rules/object-curly-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/object-curly-spacing.test.ts @@ -3,10 +3,10 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/object-curly-spacing'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts index 93b01ce6f33..335abb3710b 100644 --- a/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts +++ b/packages/eslint-plugin/tests/rules/padding-line-between-statements.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/padding-line-between-statements'; -import { RuleTester } from '../RuleTester'; //------------------------------------------------------------------------------ // Tests diff --git a/packages/eslint-plugin/tests/rules/parameter-properties.test.ts b/packages/eslint-plugin/tests/rules/parameter-properties.test.ts index 44580ad1b92..6a60e06ee89 100644 --- a/packages/eslint-plugin/tests/rules/parameter-properties.test.ts +++ b/packages/eslint-plugin/tests/rules/parameter-properties.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/parameter-properties'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -32,7 +33,7 @@ class Foo { `, ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(name: string, age?: number) {} } `, @@ -528,7 +529,7 @@ class Foo { { code: ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(private name: string, age?: number) {} } `, @@ -546,7 +547,7 @@ class Foo { { code: ` class Foo { - constructor(private name: string); + constructor(private name: string) {} constructor(private name: string, age?: number) {} } `, @@ -572,7 +573,7 @@ class Foo { { code: ` class Foo { - constructor(private name: string); + constructor(private name: string) {} constructor(private name: string, private age?: number) {} } `, @@ -606,7 +607,7 @@ class Foo { { code: ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(protected name: string, age?: number) {} } `, @@ -624,7 +625,7 @@ class Foo { { code: ` class Foo { - constructor(protected name: string); + constructor(protected name: string) {} constructor(protected name: string, age?: number) {} } `, @@ -650,7 +651,7 @@ class Foo { { code: ` class Foo { - constructor(protected name: string); + constructor(protected name: string) {} constructor(protected name: string, protected age?: number) {} } `, @@ -684,7 +685,7 @@ class Foo { { code: ` class Foo { - constructor(name: string); + constructor(name: string) {} constructor(public name: string, age?: number) {} } `, @@ -702,7 +703,7 @@ class Foo { { code: ` class Foo { - constructor(public name: string); + constructor(public name: string) {} constructor(public name: string, age?: number) {} } `, @@ -728,7 +729,7 @@ class Foo { { code: ` class Foo { - constructor(public name: string); + constructor(public name: string) {} constructor(public name: string, public age?: number) {} } `, @@ -894,7 +895,7 @@ class Foo { { code: ` class Foo { - constructor(private name: string); + constructor(private name: string) {} constructor(private name: string, protected age?: number) {} } `, diff --git a/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts b/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts index f4e2f46d998..19058d692b4 100644 --- a/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-as-const'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-enum-initializers.test.ts b/packages/eslint-plugin/tests/rules/prefer-enum-initializers.test.ts index adfdd065bb8..7e64015641f 100644 --- a/packages/eslint-plugin/tests/rules/prefer-enum-initializers.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-enum-initializers.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-enum-initializers'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-for-of.test.ts b/packages/eslint-plugin/tests/rules/prefer-for-of.test.ts index 8e59de6bce9..a370ee57a78 100644 --- a/packages/eslint-plugin/tests/rules/prefer-for-of.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-for-of.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-for-of'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts b/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts index 5c65dfc4d2b..0788f415cda 100644 --- a/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts @@ -1,7 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule, { phrases } from '../../src/rules/prefer-function-type'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts index 6b37be5c59f..4cf727cabd7 100644 --- a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-includes'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -234,6 +236,33 @@ ruleTester.run('prefer-includes', rule, { `, errors: [{ messageId: 'preferStringIncludes' }], }, + // test SequenceExpression + { + code: ` + function f(a: string): void { + /bar/.test((1 + 1, a)); + } + `, + output: ` + function f(a: string): void { + (1 + 1, a).includes('bar'); + } + `, + errors: [{ messageId: 'preferStringIncludes' }], + }, + { + code: ` + function f(a: string): void { + /\\0'\\\\\\n\\r\\v\\t\\f/.test(a); + } + `, + output: ` + function f(a: string): void { + a.includes('\\0\\'\\\\\\n\\r\\v\\t\\f'); + } + `, + errors: [{ messageId: 'preferStringIncludes' }], + }, { code: ` const pattern = new RegExp('bar'); diff --git a/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts b/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts index c0e3aec4e8e..4b1f1e49f2c 100644 --- a/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-literal-enum-member.test.ts @@ -1,5 +1,6 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-literal-enum-member'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-namespace-keyword.test.ts b/packages/eslint-plugin/tests/rules/prefer-namespace-keyword.test.ts index b512cea6757..34fc80b2ef7 100644 --- a/packages/eslint-plugin/tests/rules/prefer-namespace-keyword.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-namespace-keyword.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-namespace-keyword'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts index 49e50e741a8..022eb5cdb8b 100644 --- a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts @@ -1,3 +1,4 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import * as path from 'path'; @@ -6,7 +7,7 @@ import type { Options, } from '../../src/rules/prefer-nullish-coalescing'; import rule from '../../src/rules/prefer-nullish-coalescing'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -20,6 +21,7 @@ const ruleTester = new RuleTester({ const types = ['string', 'number', 'boolean', 'object']; const nullishTypes = ['null', 'undefined', 'null | undefined']; +const ignorablePrimitiveTypes = ['string', 'number', 'boolean', 'bigint']; function typeValidTest( cb: (type: string) => TSESLint.ValidTestCase | string, @@ -206,6 +208,13 @@ a && b || c || d; `, options: [{ ignoreMixedLogicalExpressions: true }], })), + ...ignorablePrimitiveTypes.map>(type => ({ + code: ` +declare const x: ${type} | undefined; +x || y; + `, + options: [{ ignorePrimitives: { [type]: true } }], + })), ], invalid: [ ...nullishTypeInvalidTest((nullish, type) => ({ @@ -751,5 +760,453 @@ declare const c: ${type}; }, ], })), + // default for missing option + { + code: ` +declare const x: string | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { number: true, boolean: true, bigint: true }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: number | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { string: true, boolean: true, bigint: true }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: boolean | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { string: true, number: true, bigint: true }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: bigint | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { string: true, number: true, boolean: true }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + // falsy + { + code: ` +declare const x: '' | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: false, + number: true, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: \`\` | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: false, + number: true, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0 | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: false, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: true, + bigint: false, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: false | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: false, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + // truthy + { + code: ` +declare const x: 'a' | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: false, + number: true, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: \`hello\${'string'}\` | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: false, + number: true, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 1 | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: false, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 1n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: true, + bigint: false, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: true | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: false, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + // Unions of same primitive + { + code: ` +declare const x: 'a' | 'b' | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: false, + number: true, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 'a' | \`b\` | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: false, + number: true, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0 | 1 | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: false, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 1 | 2 | 3 | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: false, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0n | 1n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: true, + bigint: false, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 1n | 2n | 3n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: true, + bigint: false, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: true | false | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: false, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + // Mixed unions + { + code: ` +declare const x: 0 | 1 | 0n | 1n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: false, + boolean: true, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0 | 1 | 0n | 1n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: true, + bigint: false, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0 | 1 | 0n | 1n | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: false, + boolean: true, + bigint: false, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: true | false | null | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + string: true, + number: true, + boolean: false, + bigint: true, + }, + }, + ], + errors: [{ messageId: 'preferNullishOverOr' }], + }, + { + code: ` +declare const x: 0 | 'foo' | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + number: true, + string: true, + }, + }, + ], + errors: [ + { + messageId: 'preferNullishOverOr', + }, + ], + }, + { + code: ` +declare const x: 0 | 'foo' | undefined; +x || y; + `, + options: [ + { + ignorePrimitives: { + number: true, + string: false, + }, + }, + ], + errors: [ + { + messageId: 'preferNullishOverOr', + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain/base-cases.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain/base-cases.ts index 99cfe6b0ff9..4ea5f6cc087 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain/base-cases.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain/base-cases.ts @@ -1,228 +1,283 @@ -import type { TSESLint } from '@typescript-eslint/utils'; +import type { InvalidTestCase } from '@typescript-eslint/utils/ts-eslint'; -import type rule from '../../../src/rules/prefer-optional-chain'; import type { - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule, -} from '../../../src/util'; + PreferOptionalChainMessageIds, + PreferOptionalChainOptions, +} from '../../../src/rules/prefer-optional-chain-utils/PreferOptionalChainOptions'; -type InvalidTestCase = TSESLint.InvalidTestCase< - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule ->; +type MutateFn = (c: string) => string; +type BaseCaseCreator = (args: { + operator: '&&' | '||'; + mutateCode?: MutateFn; + mutateOutput?: MutateFn; + mutateDeclaration?: MutateFn; + useSuggestionFixer?: true; + skipIds?: number[]; +}) => InvalidTestCase< + PreferOptionalChainMessageIds, + [PreferOptionalChainOptions] +>[]; -interface BaseCase { - canReplaceAndWithOr: boolean; - output: string; - code: string; -} - -const mapper = (c: BaseCase): InvalidTestCase => ({ - code: c.code.trim(), - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: c.output.trim(), - }, - ], - }, - ], -}); - -const baseCases: Array = [ - // chained members - { - code: 'foo && foo.bar', - output: 'foo?.bar', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar.baz', - output: 'foo.bar?.baz', - canReplaceAndWithOr: true, - }, - { - code: 'foo && foo()', - output: 'foo?.()', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar()', - output: 'foo.bar?.()', - canReplaceAndWithOr: true, - }, - { - code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz', - output: 'foo?.bar?.baz?.buzz', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar.baz && foo.bar.baz.buzz', - output: 'foo.bar?.baz?.buzz', - canReplaceAndWithOr: true, - }, - // case with a jump (i.e. a non-nullish prop) - { - code: 'foo && foo.bar && foo.bar.baz.buzz', - output: 'foo?.bar?.baz.buzz', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar.baz.buzz', - output: 'foo.bar?.baz.buzz', - canReplaceAndWithOr: true, - }, - // case where for some reason there is a doubled up expression - { - code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz', - output: 'foo?.bar?.baz?.buzz', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar.baz && foo.bar.baz && foo.bar.baz.buzz', - output: 'foo.bar?.baz?.buzz', - canReplaceAndWithOr: true, - }, - // chained members with element access - { - code: 'foo && foo[bar] && foo[bar].baz && foo[bar].baz.buzz', - output: 'foo?.[bar]?.baz?.buzz', - canReplaceAndWithOr: true, - }, - { +const RawBaseCases = (operator: '&&' | '||') => + [ + // chained members + { + id: 1, + declaration: 'declare const foo: {bar: number} | null | undefined;', + chain: `foo ${operator} foo.bar;`, + outputChain: 'foo?.bar;', + }, + { + id: 2, + declaration: + 'declare const foo: {bar: {baz: number} | null | undefined};', + chain: `foo.bar ${operator} foo.bar.baz;`, + outputChain: 'foo.bar?.baz;', + }, + { + id: 3, + declaration: 'declare const foo: (() => number) | null | undefined;', + chain: `foo ${operator} foo();`, + outputChain: 'foo?.();', + }, + { + id: 4, + declaration: + 'declare const foo: {bar: (() => number) | null | undefined};', + chain: `foo.bar ${operator} foo.bar();`, + outputChain: 'foo.bar?.();', + }, + { + id: 5, + declaration: + 'declare const foo: {bar: {baz: {buzz: number} | null | undefined} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz;`, + outputChain: 'foo?.bar?.baz?.buzz;', + }, + { + id: 6, + declaration: + 'declare const foo: {bar: {baz: {buzz: number} | null | undefined} | null | undefined};', + chain: `foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz;`, + outputChain: 'foo.bar?.baz?.buzz;', + }, // case with a jump (i.e. a non-nullish prop) - code: 'foo && foo[bar].baz && foo[bar].baz.buzz', - output: 'foo?.[bar].baz?.buzz', - canReplaceAndWithOr: true, - }, - // case with a property access in computed property - { - code: 'foo && foo[bar.baz] && foo[bar.baz].buzz', - output: 'foo?.[bar.baz]?.buzz', - canReplaceAndWithOr: true, - }, - // case with this keyword - { - code: 'foo[this.bar] && foo[this.bar].baz', - output: 'foo[this.bar]?.baz', - canReplaceAndWithOr: true, - }, - // chained calls - { - code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz()', - output: 'foo?.bar?.baz?.buzz()', - canReplaceAndWithOr: true, - }, - { - code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz()', - output: 'foo?.bar?.baz?.buzz?.()', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar.baz && foo.bar.baz.buzz && foo.bar.baz.buzz()', - output: 'foo.bar?.baz?.buzz?.()', - canReplaceAndWithOr: true, - }, - // case with a jump (i.e. a non-nullish prop) - { - code: 'foo && foo.bar && foo.bar.baz.buzz()', - output: 'foo?.bar?.baz.buzz()', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar.baz.buzz()', - output: 'foo.bar?.baz.buzz()', - canReplaceAndWithOr: true, - }, - { + { + id: 7, + declaration: + 'declare const foo: {bar: {baz: {buzz: number}} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz.buzz;`, + outputChain: 'foo?.bar?.baz.buzz;', + }, + { + id: 8, + declaration: + 'declare const foo: {bar: {baz: {buzz: number}} | null | undefined};', + chain: `foo.bar ${operator} foo.bar.baz.buzz;`, + outputChain: 'foo.bar?.baz.buzz;', + }, + // case where for some reason there is a doubled up expression + { + id: 9, + declaration: + 'declare const foo: {bar: {baz: {buzz: number} | null | undefined} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz;`, + outputChain: 'foo?.bar?.baz?.buzz;', + }, + { + id: 10, + declaration: + 'declare const foo: {bar: {baz: {buzz: number} | null | undefined} | null | undefined} | null | undefined;', + chain: `foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz;`, + outputChain: 'foo.bar?.baz?.buzz;', + }, + // chained members with element access + { + id: 11, + declaration: [ + 'declare const bar: string;', + 'declare const foo: {[k: string]: {baz: {buzz: number} | null | undefined} | null | undefined} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo[bar] ${operator} foo[bar].baz ${operator} foo[bar].baz.buzz;`, + outputChain: 'foo?.[bar]?.baz?.buzz;', + }, + { + id: 12, + // case with a jump (i.e. a non-nullish prop) + declaration: [ + 'declare const bar: string;', + 'declare const foo: {[k: string]: {baz: {buzz: number} | null | undefined} | null | undefined} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo[bar].baz ${operator} foo[bar].baz.buzz;`, + outputChain: 'foo?.[bar].baz?.buzz;', + }, + // case with a property access in computed property + { + id: 13, + declaration: [ + 'declare const bar: {baz: string};', + 'declare const foo: {[k: string]: {buzz: number} | null | undefined} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo[bar.baz] ${operator} foo[bar.baz].buzz;`, + outputChain: 'foo?.[bar.baz]?.buzz;', + }, + // chained calls + { + id: 14, + declaration: + 'declare const foo: {bar: {baz: {buzz: () => number} | null | undefined} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz();`, + outputChain: 'foo?.bar?.baz?.buzz();', + }, + { + id: 15, + declaration: + 'declare const foo: {bar: {baz: {buzz: (() => number) | null | undefined} | null | undefined} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz ${operator} foo.bar.baz.buzz();`, + outputChain: 'foo?.bar?.baz?.buzz?.();', + }, + { + id: 16, + declaration: + 'declare const foo: {bar: {baz: {buzz: (() => number) | null | undefined} | null | undefined} | null | undefined};', + chain: `foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz.buzz ${operator} foo.bar.baz.buzz();`, + outputChain: 'foo.bar?.baz?.buzz?.();', + }, // case with a jump (i.e. a non-nullish prop) - code: 'foo && foo.bar && foo.bar.baz.buzz && foo.bar.baz.buzz()', - output: 'foo?.bar?.baz.buzz?.()', - canReplaceAndWithOr: true, - }, - { - // case with a call expr inside the chain for some inefficient reason - code: 'foo && foo.bar() && foo.bar().baz && foo.bar().baz.buzz && foo.bar().baz.buzz()', - output: 'foo?.bar()?.baz?.buzz?.()', - canReplaceAndWithOr: true, - }, - // chained calls with element access - { - code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz]()', - output: 'foo?.bar?.baz?.[buzz]()', - canReplaceAndWithOr: true, - }, - { - code: 'foo && foo.bar && foo.bar.baz && foo.bar.baz[buzz] && foo.bar.baz[buzz]()', - output: 'foo?.bar?.baz?.[buzz]?.()', - canReplaceAndWithOr: true, - }, - // (partially) pre-optional chained - { - code: 'foo && foo?.bar && foo?.bar.baz && foo?.bar.baz[buzz] && foo?.bar.baz[buzz]()', - output: 'foo?.bar?.baz?.[buzz]?.()', - canReplaceAndWithOr: true, - }, - { - code: 'foo && foo?.bar.baz && foo?.bar.baz[buzz]', - output: 'foo?.bar.baz?.[buzz]', - canReplaceAndWithOr: true, - }, - { - code: 'foo && foo?.() && foo?.().bar', - output: 'foo?.()?.bar', - canReplaceAndWithOr: true, - }, - { - code: 'foo.bar && foo.bar?.() && foo.bar?.().baz', - output: 'foo.bar?.()?.baz', - canReplaceAndWithOr: true, - }, - { - code: 'foo !== null && foo.bar !== null', - output: 'foo?.bar != null', - canReplaceAndWithOr: false, - }, - { - code: 'foo != null && foo.bar != null', - output: 'foo?.bar != null', - canReplaceAndWithOr: false, - }, - { - code: 'foo != null && foo.bar !== null', - output: 'foo?.bar != null', - canReplaceAndWithOr: false, - }, - { - code: 'foo !== null && foo.bar != null', - output: 'foo?.bar != null', - canReplaceAndWithOr: false, - }, -]; - -interface Selector { - all(): Array; - select>( - key: K, - value: BaseCase[K], - ): Selector; -} + { + id: 17, + declaration: + 'declare const foo: {bar: {baz: {buzz: () => number}} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz.buzz();`, + outputChain: 'foo?.bar?.baz.buzz();', + }, + { + id: 18, + declaration: + 'declare const foo: {bar: {baz: {buzz: () => number}} | null | undefined};', + chain: `foo.bar ${operator} foo.bar.baz.buzz();`, + outputChain: 'foo.bar?.baz.buzz();', + }, + { + id: 19, + // case with a jump (i.e. a non-nullish prop) + declaration: + 'declare const foo: {bar: {baz: {buzz: (() => number) | null | undefined}} | null | undefined} | null | undefined;', + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz.buzz ${operator} foo.bar.baz.buzz();`, + outputChain: 'foo?.bar?.baz.buzz?.();', + }, + { + id: 20, + // case with a call expr inside the chain for some inefficient reason + declaration: + 'declare const foo: {bar: () => ({baz: {buzz: (() => number) | null | undefined} | null | undefined}) | null | undefined};', + chain: `foo.bar ${operator} foo.bar() ${operator} foo.bar().baz ${operator} foo.bar().baz.buzz ${operator} foo.bar().baz.buzz();`, + outputChain: 'foo.bar?.()?.baz?.buzz?.();', + }, + // chained calls with element access + { + id: 21, + declaration: [ + 'declare const buzz: string;', + 'declare const foo: {bar: {baz: {[k: string]: () => number} | null | undefined} | null | undefined} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz[buzz]();`, + outputChain: 'foo?.bar?.baz?.[buzz]();', + }, + { + id: 22, + declaration: [ + 'declare const buzz: string;', + 'declare const foo: {bar: {baz: {[k: string]: (() => number) | null | undefined} | null | undefined} | null | undefined} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo.bar ${operator} foo.bar.baz ${operator} foo.bar.baz[buzz] ${operator} foo.bar.baz[buzz]();`, + outputChain: 'foo?.bar?.baz?.[buzz]?.();', + }, + // (partially) pre-optional chained + { + id: 23, + declaration: [ + 'declare const buzz: string;', + 'declare const foo: {bar: {baz: {[k: string]: (() => number) | null | undefined} | null | undefined} | null | undefined} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo?.bar ${operator} foo?.bar.baz ${operator} foo?.bar.baz[buzz] ${operator} foo?.bar.baz[buzz]();`, + outputChain: 'foo?.bar?.baz?.[buzz]?.();', + }, + { + id: 24, + declaration: [ + 'declare const buzz: string;', + 'declare const foo: {bar: {baz: {[k: string]: number} | null | undefined}} | null | undefined;', + ].join('\n'), + chain: `foo ${operator} foo?.bar.baz ${operator} foo?.bar.baz[buzz];`, + outputChain: 'foo?.bar.baz?.[buzz];', + }, + { + id: 25, + declaration: + 'declare const foo: (() => ({bar: number} | null | undefined)) | null | undefined;', + chain: `foo ${operator} foo?.() ${operator} foo?.().bar;`, + outputChain: 'foo?.()?.bar;', + }, + { + id: 26, + declaration: + 'declare const foo: {bar: () => ({baz: number} | null | undefined)};', + chain: `foo.bar ${operator} foo.bar?.() ${operator} foo.bar?.().baz;`, + outputChain: 'foo.bar?.()?.baz;', + }, + ] as const; -const selector = (cases: Array): Selector => ({ - all: () => cases.map(mapper), - select: >( - key: K, - value: BaseCase[K], - ): Selector => { - const selectedCases = baseCases.filter(c => c[key] === value); - return selector(selectedCases); - }, -}); +export const identity: MutateFn = c => c; +export const BaseCases: BaseCaseCreator = ({ + operator, + mutateCode = identity, + mutateOutput = mutateCode, + mutateDeclaration = identity, + useSuggestionFixer = false, + skipIds = [], +}) => { + const skipIdsSet = new Set(skipIds); + const skipSpecifiedIds: ( + arg: ReturnType[number], + ) => boolean = + skipIds.length === 0 + ? (): boolean => true + : ({ id }): boolean => !skipIdsSet.has(id); -const { all, select } = selector(baseCases); + return RawBaseCases(operator) + .filter(skipSpecifiedIds) + .map( + ({ + id, + declaration: originalDeclaration, + chain, + outputChain, + }): InvalidTestCase< + PreferOptionalChainMessageIds, + [PreferOptionalChainOptions] + > => { + const declaration = mutateDeclaration(originalDeclaration); + const code = `// ${id}\n${declaration}\n${mutateCode(chain)}`; + const output = `// ${id}\n${declaration}\n${mutateOutput(outputChain)}`; -export { all, select }; + return { + code, + output: useSuggestionFixer ? null : output, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: !useSuggestionFixer + ? null + : [ + { + messageId: 'optionalChainSuggest', + output, + }, + ], + }, + ], + }; + }, + ); +}; diff --git a/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts b/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts index a18de12bf7b..852296721a7 100644 --- a/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-optional-chain/prefer-optional-chain.test.ts @@ -1,1273 +1,2134 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../../src/rules/prefer-optional-chain'; -import { noFormat, RuleTester } from '../../RuleTester'; -import * as BaseCases from './base-cases'; +import { getFixturesRootDir } from '../../RuleTester'; +import { BaseCases, identity } from './base-cases'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', + parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: getFixturesRootDir(), + }, }); -ruleTester.run('prefer-optional-chain', rule, { - valid: [ - '!a || !b;', - '!a || a.b;', - '!a && a.b;', - '!a && !a.b;', - '!a.b || a.b?.();', - '!a.b || a.b();', - '!foo() || !foo().bar;', - - 'foo || {};', - 'foo || ({} as any);', - '(foo || {})?.bar;', - '(foo || { bar: 1 }).bar;', - '(undefined && (foo || {})).bar;', - 'foo ||= bar;', - 'foo ||= bar || {};', - 'foo ||= bar?.baz;', - 'foo ||= bar?.baz || {};', - 'foo ||= bar?.baz?.buzz;', - '(foo1 ? foo2 : foo3 || {}).foo4;', - '(foo = 2 || {}).bar;', - 'func(foo || {}).bar;', - 'foo ?? {};', - '(foo ?? {})?.bar;', - 'foo ||= bar ?? {};', - 'foo && bar;', - 'foo && foo;', - 'foo || bar;', - 'foo ?? bar;', - 'foo || foo.bar;', - 'foo ?? foo.bar;', - "file !== 'index.ts' && file.endsWith('.ts');", - 'nextToken && sourceCode.isSpaceBetweenTokens(prevToken, nextToken);', - 'result && this.options.shouldPreserveNodeMaps;', - 'foo && fooBar.baz;', - 'match && match$1 !== undefined;', - 'foo !== null && foo !== undefined;', - "x['y'] !== undefined && x['y'] !== null;", - // private properties - 'this.#a && this.#b;', - '!this.#a || !this.#b;', - 'a.#foo?.bar;', - '!a.#foo?.bar;', - '!foo().#a || a;', - '!a.b.#a || a;', - '!new A().#b || a;', - '!(await a).#b || a;', - "!(foo as any).bar || 'anything';", - // currently do not handle complex computed properties - 'foo && foo[bar as string] && foo[bar as string].baz;', - 'foo && foo[1 + 2] && foo[1 + 2].baz;', - 'foo && foo[typeof bar] && foo[typeof bar].baz;', - '!foo[1 + 1] || !foo[1 + 2];', - '!foo[1 + 1] || !foo[1 + 1].foo;', - '!foo || !foo[bar as string] || !foo[bar as string].baz;', - '!foo || !foo[1 + 2] || !foo[1 + 2].baz;', - '!foo || !foo[typeof bar] || !foo[typeof bar].baz;', - // currently do not handle 'this' as the first part of a chain - 'this && this.foo;', - '!this || !this.foo;', - // intentionally do not handle mixed TSNonNullExpression in properties - '!entity.__helper!.__initialized || options.refresh;', - '!foo!.bar || !foo!.bar.baz;', - '!foo!.bar!.baz || !foo!.bar!.baz!.paz;', - '!foo.bar!.baz || !foo.bar!.baz!.paz;', - 'import.meta || true;', - 'import.meta || import.meta.foo;', - '!import.meta && false;', - '!import.meta && !import.meta.foo;', - 'new.target || new.target.length;', - '!new.target || true;', - // Do not handle direct optional chaining on private properties because of a typescript bug (https://github.com/microsoft/TypeScript/issues/42734) - // We still allow in computed properties - 'foo && foo.#bar;', - '!foo || !foo.#bar;', - ], - invalid: [ - ...BaseCases.all(), - // it should ignore whitespace in the expressions - ...BaseCases.all().map(c => ({ - ...c, - code: c.code.replace(/\./g, '. '), - })), - ...BaseCases.all().map(c => ({ - ...c, - code: c.code.replace(/\./g, '.\n'), - })), - // it should ignore parts of the expression that aren't part of the expression chain - ...BaseCases.all().map(c => ({ - ...c, - code: `${c.code} && bing`, - errors: [ - { - ...c.errors[0], - suggestions: [ - { - ...c.errors[0].suggestions![0], - output: `${c.errors[0].suggestions![0].output} && bing`, - }, - ], - }, - ], - })), - ...BaseCases.all().map(c => ({ - ...c, - code: `${c.code} && bing.bong`, - errors: [ - { - ...c.errors[0], - suggestions: [ - { - ...c.errors[0].suggestions![0], - output: `${c.errors[0].suggestions![0].output} && bing.bong`, - }, - ], - }, - ], - })), - // strict nullish equality checks x !== null && x.y !== null - ...BaseCases.all().map(c => ({ - ...c, - code: c.code.replace(/&&/g, '!== null &&'), - })), - ...BaseCases.all().map(c => ({ - ...c, - code: c.code.replace(/&&/g, '!= null &&'), - })), - ...BaseCases.all().map(c => ({ - ...c, - code: c.code.replace(/&&/g, '!== undefined &&'), - })), - ...BaseCases.all().map(c => ({ - ...c, - code: c.code.replace(/&&/g, '!= undefined &&'), - })), - - // replace && with ||: foo && foo.bar -> !foo || !foo.bar - ...BaseCases.select('canReplaceAndWithOr', true) - .all() - .map(c => ({ - ...c, - code: c.code.replace(/(^|\s)foo/g, '$1!foo').replace(/&&/g, '||'), +describe('|| {}', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [ + 'foo || {};', + 'foo || ({} as any);', + '(foo || {})?.bar;', + '(foo || { bar: 1 }).bar;', + '(undefined && (foo || {})).bar;', + 'foo ||= bar || {};', + 'foo ||= bar?.baz || {};', + '(foo1 ? foo2 : foo3 || {}).foo4;', + '(foo = 2 || {}).bar;', + 'func(foo || {}).bar;', + 'foo ?? {};', + '(foo ?? {})?.bar;', + 'foo ||= bar ?? {};', + ], + invalid: [ + { + code: '(foo || {}).bar;', errors: [ { - ...c.errors[0], + messageId: 'preferOptionalChain', + column: 1, + endColumn: 16, suggestions: [ { - ...c.errors[0].suggestions![0], - output: `!${c.errors[0].suggestions![0].output}`, + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', }, ], }, ], - })), - - // two errors - { - code: noFormat`foo && foo.bar && foo.bar.baz || baz && baz.bar && baz.bar.foo`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `foo?.bar?.baz || baz && baz.bar && baz.bar.foo`, - }, - ], - }, - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `foo && foo.bar && foo.bar.baz || baz?.bar?.foo`, - }, - ], - }, - ], - }, - // case with inconsistent checks - { - code: 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar?.baz?.buzz;', - }, - ], - }, - ], - }, - { - code: noFormat`foo.bar && foo.bar.baz != null && foo.bar.baz.qux !== undefined && foo.bar.baz.qux.buzz;`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo.bar?.baz?.qux?.buzz;', - }, - ], - }, - ], - }, - // ensure essential whitespace isn't removed - { - code: 'foo && foo.bar(baz => );', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar(baz => );', - }, - ], - }, - ], - parserOptions: { - ecmaFeatures: { - jsx: true, - }, }, - }, - { - code: 'foo && foo.bar(baz => typeof baz);', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar(baz => typeof baz);', - }, - ], - }, - ], - }, - { - code: noFormat`foo && foo["some long string"] && foo["some long string"].baz`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `foo?.["some long string"]?.baz`, - }, - ], - }, - ], - }, - { - code: noFormat`foo && foo[\`some long string\`] && foo[\`some long string\`].baz`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `foo?.[\`some long string\`]?.baz`, - }, - ], - }, - ], - }, - { - code: "foo && foo['some long string'] && foo['some long string'].baz;", - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: "foo?.['some long string']?.baz;", - }, - ], - }, - ], - }, - // should preserve comments in a call expression - { - code: noFormat` -foo && foo.bar(/* comment */a, - // comment2 - b, ); - `, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: ` -foo?.bar(/* comment */a, - // comment2 - b, ); - `, - }, - ], - }, - ], - }, - // ensure binary expressions that are the last expression do not get removed - { - code: 'foo && foo.bar != null;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar != null;', - }, - ], - }, - ], - }, - { - code: 'foo && foo.bar != undefined;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar != undefined;', - }, - ], - }, - ], - }, - { - code: 'foo && foo.bar != null && baz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar != null && baz;', - }, - ], - }, - ], - }, - // case with this keyword at the start of expression - { - code: 'this.bar && this.bar.baz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'this.bar?.baz;', - }, - ], - }, - ], - }, - // other weird cases - { - code: 'foo && foo?.();', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.();', - }, - ], - }, - ], - }, - { - code: 'foo.bar && foo.bar?.();', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo.bar?.();', - }, - ], - }, - ], - }, - // using suggestion instead of autofix - { - code: 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - line: 1, - column: 1, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar?.baz?.buzz;', - }, - ], - }, - ], - }, - { - code: 'foo && foo.bar(baz => );', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - line: 1, - column: 1, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar(baz => );', - }, - ], - }, - ], - parserOptions: { - ecmaFeatures: { - jsx: true, - }, + { + code: noFormat`(foo || ({})).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], }, - }, - { - code: '(foo || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 16, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`(foo || ({})).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 18, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`(await foo || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 22, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(await foo)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo1?.foo2 || {}).foo3;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 24, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo1?.foo2?.foo3;', - }, - ], - }, - ], - }, - { - code: '((() => foo())() || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 28, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(() => foo())()?.bar;', - }, - ], - }, - ], - }, - { - code: 'const foo = (bar || {}).baz;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 13, - endColumn: 28, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'const foo = bar?.baz;', - }, - ], - }, - ], - }, - { - code: '(foo.bar || {})[baz];', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 21, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo.bar?.[baz];', - }, - ], - }, - ], - }, - { - code: '((foo1 || {}).foo2 || {}).foo3;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 31, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo1 || {}).foo2?.foo3;', - }, - ], - }, - { - messageId: 'optionalChainSuggest', - column: 2, - endColumn: 19, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo1?.foo2 || {}).foo3;', - }, - ], - }, - ], - }, - { - code: '(foo || undefined || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo || undefined)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo() || bar || {}).baz;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 25, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo() || bar)?.baz;', - }, - ], - }, - ], - }, - { - code: '((foo1 ? foo2 : foo3) || {}).foo4;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 34, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo1 ? foo2 : foo3)?.foo4;', - }, - ], - }, - ], - }, - { - code: noFormat`if (foo) { (foo || {}).bar; }`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 12, - endColumn: 27, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `if (foo) { foo?.bar; }`, - }, - ], - }, - ], - }, - { - code: noFormat`if ((foo || {}).bar) { foo.bar; }`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 5, - endColumn: 20, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `if (foo?.bar) { foo.bar; }`, - }, - ], - }, - ], - }, - { - code: noFormat`(undefined && foo || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 29, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(undefined && foo)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo ?? {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 16, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`(foo ?? ({})).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 18, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`(await foo ?? {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 22, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(await foo)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo1?.foo2 ?? {}).foo3;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 24, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo1?.foo2?.foo3;', - }, - ], - }, - ], - }, - { - code: '((() => foo())() ?? {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 28, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(() => foo())()?.bar;', - }, - ], - }, - ], - }, - { - code: 'const foo = (bar ?? {}).baz;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 13, - endColumn: 28, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'const foo = bar?.baz;', - }, - ], - }, - ], - }, - { - code: '(foo.bar ?? {})[baz];', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 21, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'foo.bar?.[baz];', - }, - ], - }, - ], - }, - { - code: '((foo1 ?? {}).foo2 ?? {}).foo3;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 31, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo1 ?? {}).foo2?.foo3;', - }, - ], - }, - { - messageId: 'optionalChainSuggest', - column: 2, - endColumn: 19, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo1?.foo2 ?? {}).foo3;', - }, - ], - }, - ], - }, - { - code: '(foo ?? undefined ?? {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo ?? undefined)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo() ?? bar ?? {}).baz;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 25, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo() ?? bar)?.baz;', - }, - ], - }, - ], - }, - { - code: '((foo1 ? foo2 : foo3) ?? {}).foo4;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 34, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo1 ? foo2 : foo3)?.foo4;', - }, - ], - }, - ], - }, - { - code: noFormat`if (foo) { (foo ?? {}).bar; }`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 12, - endColumn: 27, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `if (foo) { foo?.bar; }`, - }, - ], - }, - ], - }, - { - code: noFormat`if ((foo ?? {}).bar) { foo.bar; }`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 5, - endColumn: 20, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `if (foo?.bar) { foo.bar; }`, - }, - ], - }, - ], - }, - { - code: noFormat`(undefined && foo ?? {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 29, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(undefined && foo)?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`(a > b || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 18, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(a > b)?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`(((typeof x) as string) || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 35, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: `((typeof x) as string)?.bar;`, - }, - ], - }, - ], - }, - { - code: '(void foo() || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 23, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(void foo())?.bar;', - }, - ], - }, - ], - }, - { - code: '((a ? b : c) || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 24, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(a ? b : c)?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`((a instanceof Error) || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 33, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(a instanceof Error)?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`((a << b) || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 21, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(a << b)?.bar;', - }, - ], - }, - ], - }, - { - code: noFormat`((foo ** 2) || {}).bar;`, - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 23, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo ** 2)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo ** 2 || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 21, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo ** 2)?.bar;', - }, - ], - }, - ], - }, - { - code: '(foo++ || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 18, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(foo++)?.bar;', - }, - ], - }, - ], - }, - { - code: '(+foo || {}).bar;', - errors: [ - { - messageId: 'optionalChainSuggest', - column: 1, - endColumn: 17, - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '(+foo)?.bar;', - }, - ], - }, - ], - }, - { - code: '(this || {}).foo;', - errors: [ - { - messageId: 'optionalChainSuggest', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: 'this?.foo;', - }, - ], - }, - ], - }, - // case with this keyword at the start of expression - { - code: '!this.bar || !this.bar.baz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '!this.bar?.baz;', - }, - ], - }, - ], - }, - { - code: '!a.b || !a.b();', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '!a.b?.();', - }, - ], - }, - ], - }, - { - code: '!foo.bar || !foo.bar.baz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '!foo.bar?.baz;', - }, - ], - }, - ], - }, - { - code: '!foo[bar] || !foo[bar]?.[baz];', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '!foo[bar]?.[baz];', - }, - ], - }, - ], - }, - { - code: '!foo || !foo?.bar.baz;', - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: '!foo?.bar.baz;', - }, - ], - }, - ], - }, - // two errors - { - code: noFormat`(!foo || !foo.bar || !foo.bar.baz) && (!baz || !baz.bar || !baz.bar.foo);`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: noFormat`(!foo?.bar?.baz) && (!baz || !baz.bar || !baz.bar.foo);`, - }, - ], - }, - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: noFormat`(!foo || !foo.bar || !foo.bar.baz) && (!baz?.bar?.foo);`, - }, - ], - }, - ], - }, - { - code: ` - class Foo { - constructor() { - new.target && new.target.length; + { + code: noFormat`(await foo || {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 22, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(await foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo1?.foo2 || {}).foo3;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 24, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo1?.foo2?.foo3;', + }, + ], + }, + ], + }, + { + code: '((() => foo())() || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(() => foo())()?.bar;', + }, + ], + }, + ], + }, + { + code: 'const foo = (bar || {}).baz;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 13, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'const foo = bar?.baz;', + }, + ], + }, + ], + }, + { + code: '(foo.bar || {})[baz];', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo.bar?.[baz];', + }, + ], + }, + ], + }, + { + code: '((foo1 || {}).foo2 || {}).foo3;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 31, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 || {}).foo2?.foo3;', + }, + ], + }, + { + messageId: 'preferOptionalChain', + column: 2, + endColumn: 19, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1?.foo2 || {}).foo3;', + }, + ], + }, + ], + }, + { + code: '(foo || undefined || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo || undefined)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo() || bar || {}).baz;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 25, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo() || bar)?.baz;', + }, + ], + }, + ], + }, + { + code: '((foo1 ? foo2 : foo3) || {}).foo4;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 34, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 ? foo2 : foo3)?.foo4;', + }, + ], + }, + ], + }, + { + code: ` + if (foo) { + (foo || {}).bar; } - } - `, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: ` - class Foo { - constructor() { - new.target?.length; + `, + errors: [ + { + messageId: 'preferOptionalChain', + column: 13, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + if (foo) { + foo?.bar; } - } - `, - }, - ], - }, - ], - }, - { - code: noFormat`import.meta && import.meta?.baz;`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: noFormat`import.meta?.baz;`, - }, - ], - }, - ], - }, - { - code: noFormat`!import.meta || !import.meta?.baz;`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: noFormat`!import.meta?.baz;`, - }, - ], - }, - ], - }, - { - code: noFormat`import.meta && import.meta?.() && import.meta?.().baz;`, - output: null, - errors: [ - { - messageId: 'preferOptionalChain', - suggestions: [ - { - messageId: 'optionalChainSuggest', - output: noFormat`import.meta?.()?.baz;`, - }, - ], - }, - ], - }, - ], + `, + }, + ], + }, + ], + }, + { + code: ` + if ((foo || {}).bar) { + foo.bar; + } + `, + errors: [ + { + messageId: 'preferOptionalChain', + column: 15, + endColumn: 30, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + if (foo?.bar) { + foo.bar; + } + `, + }, + ], + }, + ], + }, + { + code: noFormat`(undefined && foo || {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 29, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(undefined && foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo ?? {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 16, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(foo ?? ({})).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(await foo ?? {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 22, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(await foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo1?.foo2 ?? {}).foo3;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 24, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo1?.foo2?.foo3;', + }, + ], + }, + ], + }, + { + code: '((() => foo())() ?? {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(() => foo())()?.bar;', + }, + ], + }, + ], + }, + { + code: 'const foo = (bar ?? {}).baz;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 13, + endColumn: 28, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'const foo = bar?.baz;', + }, + ], + }, + ], + }, + { + code: '(foo.bar ?? {})[baz];', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'foo.bar?.[baz];', + }, + ], + }, + ], + }, + { + code: '((foo1 ?? {}).foo2 ?? {}).foo3;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 31, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 ?? {}).foo2?.foo3;', + }, + ], + }, + { + messageId: 'preferOptionalChain', + column: 2, + endColumn: 19, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1?.foo2 ?? {}).foo3;', + }, + ], + }, + ], + }, + { + code: '(foo ?? undefined ?? {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo ?? undefined)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo() ?? bar ?? {}).baz;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 25, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo() ?? bar)?.baz;', + }, + ], + }, + ], + }, + { + code: '((foo1 ? foo2 : foo3) ?? {}).foo4;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 34, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo1 ? foo2 : foo3)?.foo4;', + }, + ], + }, + ], + }, + { + code: noFormat`if (foo) { (foo ?? {}).bar; }`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 12, + endColumn: 27, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'if (foo) { foo?.bar; }', + }, + ], + }, + ], + }, + { + code: noFormat`if ((foo ?? {}).bar) { foo.bar; }`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 5, + endColumn: 20, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'if (foo?.bar) { foo.bar; }', + }, + ], + }, + ], + }, + { + code: noFormat`(undefined && foo ?? {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 29, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(undefined && foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(a > b || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a > b)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`(((typeof x) as string) || {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 35, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '((typeof x) as string)?.bar;', + }, + ], + }, + ], + }, + { + code: '(void foo() || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 23, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(void foo())?.bar;', + }, + ], + }, + ], + }, + { + code: '((a ? b : c) || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 24, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a ? b : c)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`((a instanceof Error) || {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 33, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a instanceof Error)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`((a << b) || {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(a << b)?.bar;', + }, + ], + }, + ], + }, + { + code: noFormat`((foo ** 2) || {}).bar;`, + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 23, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo ** 2)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo ** 2 || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 21, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo ** 2)?.bar;', + }, + ], + }, + ], + }, + { + code: '(foo++ || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 18, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(foo++)?.bar;', + }, + ], + }, + ], + }, + { + code: '(+foo || {}).bar;', + errors: [ + { + messageId: 'preferOptionalChain', + column: 1, + endColumn: 17, + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: '(+foo)?.bar;', + }, + ], + }, + ], + }, + { + code: '(this || {}).foo;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: 'this?.foo;', + }, + ], + }, + ], + }, + ], + }); +}); + +describe('hand-crafted cases', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [ + '!a || !b;', + '!a || a.b;', + '!a && a.b;', + '!a && !a.b;', + '!a.b || a.b?.();', + '!a.b || a.b();', + 'foo ||= bar;', + 'foo ||= bar?.baz;', + 'foo ||= bar?.baz?.buzz;', + 'foo && bar;', + 'foo && foo;', + 'foo || bar;', + 'foo ?? bar;', + 'foo || foo.bar;', + 'foo ?? foo.bar;', + "file !== 'index.ts' && file.endsWith('.ts');", + 'nextToken && sourceCode.isSpaceBetweenTokens(prevToken, nextToken);', + 'result && this.options.shouldPreserveNodeMaps;', + 'foo && fooBar.baz;', + 'match && match$1 !== undefined;', + "typeof foo === 'number' && foo.toFixed();", + "foo === 'undefined' && foo.length;", + 'foo == bar && foo.bar == null;', + 'foo === 1 && foo.toFixed();', + // call arguments are considered + 'foo.bar(a) && foo.bar(a, b).baz;', + // type parameters are considered + 'foo.bar() && foo.bar().baz;', + // array elements are considered + '[1, 2].length && [1, 2, 3].length.toFixed();', + noFormat`[1,].length && [1, 2].length.toFixed();`, + // short-circuiting chains are considered + '(foo?.a).b && foo.a.b.c;', + '(foo?.a)() && foo.a().b;', + '(foo?.a)() && foo.a()();', + // looks like a chain, but isn't actually a chain - just a pair of strict nullish checks + 'foo !== null && foo !== undefined;', + "x['y'] !== undefined && x['y'] !== null;", + // private properties + 'this.#a && this.#b;', + '!this.#a || !this.#b;', + 'a.#foo?.bar;', + '!a.#foo?.bar;', + '!foo().#a || a;', + '!a.b.#a || a;', + '!new A().#b || a;', + '!(await a).#b || a;', + "!(foo as any).bar || 'anything';", + // computed properties should be interrogated and correctly ignored + '!foo[1 + 1] || !foo[1 + 2];', + '!foo[1 + 1] || !foo[1 + 2].foo;', + // currently do not handle 'this' as the first part of a chain + 'this && this.foo;', + '!this || !this.foo;', + '!entity.__helper!.__initialized || options.refresh;', + 'import.meta || true;', + 'import.meta || import.meta.foo;', + '!import.meta && false;', + '!import.meta && !import.meta.foo;', + 'new.target || new.target.length;', + '!new.target || true;', + // Do not handle direct optional chaining on private properties because this TS limitation (https://github.com/microsoft/TypeScript/issues/42734) + 'foo && foo.#bar;', + '!foo || !foo.#bar;', + // weird non-constant cases are ignored + '({}) && {}.toString();', + '[] && [].length;', + '(() => {}) && (() => {}).name;', + '(function () {}) && function () {}.name;', + '(class Foo {}) && class Foo {}.constructor;', + "new Map().get('a') && new Map().get('a').what;", + { + code: '
&& (
).wtf;', + parserOptions: { ecmaFeatures: { jsx: true } }, + filename: 'react.tsx', + }, + { + code: '<> && (<>).wtf;', + parserOptions: { ecmaFeatures: { jsx: true } }, + filename: 'react.tsx', + }, + 'foo[x++] && foo[x++].bar;', + 'foo[yield x] && foo[yield x].bar;', + 'a = b && (a = b).wtf;', + // TODO - should we handle this? + '(x || y) != null && (x || y).foo;', + // TODO - should we handle this? + '(await foo) && (await foo).bar;', + { + code: ` + declare const x: string; + x && x.length; + `, + options: [ + { + requireNullish: true, + }, + ], + }, + { + code: ` + declare const x: string | number | boolean | object; + x && x.toString(); + `, + options: [ + { + requireNullish: true, + }, + ], + }, + { + code: ` + declare const x: any; + x && x.length; + `, + options: [ + { + checkAny: false, + }, + ], + }, + { + code: ` + declare const x: bigint; + x && x.length; + `, + options: [ + { + checkBigInt: false, + }, + ], + }, + { + code: ` + declare const x: boolean; + x && x.length; + `, + options: [ + { + checkBoolean: false, + }, + ], + }, + { + code: ` + declare const x: number; + x && x.length; + `, + options: [ + { + checkNumber: false, + }, + ], + }, + { + code: ` + declare const x: string; + x && x.length; + `, + options: [ + { + checkString: false, + }, + ], + }, + { + code: ` + declare const x: unknown; + x && x.length; + `, + options: [ + { + checkUnknown: false, + }, + ], + }, + '(x = {}) && (x.y = true) != null && x.y.toString();', + "('x' as `${'x'}`) && ('x' as `${'x'}`).length;", + '`x` && `x`.length;', + '`x${a}` && `x${a}`.length;', + + // falsy unions should be ignored + ` + declare const x: false | { a: string }; + x && x.a; + `, + ` + declare const x: false | { a: string }; + !x || x.a; + `, + ` + declare const x: '' | { a: string }; + x && x.a; + `, + ` + declare const x: '' | { a: string }; + !x || x.a; + `, + ` + declare const x: 0 | { a: string }; + x && x.a; + `, + ` + declare const x: 0 | { a: string }; + !x || x.a; + `, + ` + declare const x: 0n | { a: string }; + x && x.a; + `, + ` + declare const x: 0n | { a: string }; + !x || x.a; + `, + ], + invalid: [ + // two errors + { + code: noFormat`foo && foo.bar && foo.bar.baz || baz && baz.bar && baz.bar.foo`, + output: 'foo?.bar?.baz || baz?.bar?.foo', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // case with inconsistent checks should "break" the chain + { + code: 'foo && foo.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', + output: + 'foo?.bar != null && foo.bar.baz !== undefined && foo.bar.baz.buzz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + foo.bar && + foo.bar.baz != null && + foo.bar.baz.qux !== undefined && + foo.bar.baz.qux.buzz; + `, + output: ` + foo.bar?.baz != null && + foo.bar.baz.qux !== undefined && + foo.bar.baz.qux.buzz; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // ensure essential whitespace isn't removed + { + code: 'foo && foo.bar(baz => );', + output: 'foo?.bar(baz => );', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + filename: 'react.tsx', + }, + { + code: 'foo && foo.bar(baz => typeof baz);', + output: 'foo?.bar(baz => typeof baz);', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: "foo && foo['some long string'] && foo['some long string'].baz;", + output: "foo?.['some long string']?.baz;", + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo[`some long string`] && foo[`some long string`].baz;', + output: 'foo?.[`some long string`]?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo[`some ${long} string`] && foo[`some ${long} string`].baz;', + output: 'foo?.[`some ${long} string`]?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // complex computed properties should be handled correctly + { + code: 'foo && foo[bar as string] && foo[bar as string].baz;', + output: 'foo?.[bar as string]?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo[1 + 2] && foo[1 + 2].baz;', + output: 'foo?.[1 + 2]?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo[typeof bar] && foo[typeof bar].baz;', + output: 'foo?.[typeof bar]?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo.bar(a) && foo.bar(a, b).baz;', + output: 'foo?.bar(a) && foo.bar(a, b).baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo() && foo()(bar);', + output: 'foo()?.(bar);', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // type parameters are considered + { + code: 'foo && foo() && foo().bar;', + output: 'foo?.()?.bar;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo() && foo().bar;', + output: 'foo?.() && foo().bar;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // should preserve comments in a call expression + { + code: noFormat` + foo && foo.bar(/* comment */a, + // comment2 + b, ); + `, + output: ` + foo?.bar(/* comment */a, + // comment2 + b, ); + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // ensure binary expressions that are the last expression do not get removed + // these get autofixers because the trailing binary means the type doesn't matter + { + code: 'foo && foo.bar != null;', + output: 'foo?.bar != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo.bar != undefined;', + output: 'foo?.bar != undefined;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo.bar != null && baz;', + output: 'foo?.bar != null && baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // case with this keyword at the start of expression + { + code: 'this.bar && this.bar.baz;', + output: 'this.bar?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // other weird cases + { + code: 'foo && foo?.();', + output: 'foo?.();', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo.bar && foo.bar?.();', + output: 'foo.bar?.();', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo.bar(baz => );', + output: 'foo?.bar(baz => );', + errors: [ + { + messageId: 'preferOptionalChain', + line: 1, + column: 1, + suggestions: null, + }, + ], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + filename: 'react.tsx', + }, + // case with this keyword at the start of expression + { + code: '!this.bar || !this.bar.baz;', + output: '!this.bar?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!a.b || !a.b();', + output: '!a.b?.();', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!foo.bar || !foo.bar.baz;', + output: '!foo.bar?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!foo[bar] || !foo[bar]?.[baz];', + output: '!foo[bar]?.[baz];', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!foo || !foo?.bar.baz;', + output: '!foo?.bar.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // two errors + { + code: '(!foo || !foo.bar || !foo.bar.baz) && (!baz || !baz.bar || !baz.bar.foo);', + output: '(!foo?.bar?.baz) && (!baz?.bar?.foo);', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + class Foo { + constructor() { + new.target && new.target.length; + } + } + `, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + class Foo { + constructor() { + new.target?.length; + } + } + `, + }, + ], + }, + ], + }, + { + code: 'import.meta && import.meta?.baz;', + output: 'import.meta?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!import.meta || !import.meta?.baz;', + output: '!import.meta?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'import.meta && import.meta?.() && import.meta?.().baz;', + output: 'import.meta?.()?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // non-null expressions + { + code: '!foo() || !foo().bar;', + output: '!foo()?.bar;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!foo!.bar || !foo!.bar.baz;', + output: '!foo!.bar?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!foo!.bar!.baz || !foo!.bar!.baz!.paz;', + output: '!foo!.bar!.baz?.paz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: '!foo.bar!.baz || !foo.bar!.baz!.paz;', + output: '!foo.bar!.baz?.paz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + declare const foo: { bar: string } | null; + foo !== null && foo.bar !== null; + `, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + declare const foo: { bar: string } | null; + foo?.bar !== null; + `, + }, + ], + }, + ], + }, + { + code: 'foo != null && foo.bar != null;', + output: 'foo?.bar != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + declare const foo: { bar: string | null } | null; + foo != null && foo.bar !== null; + `, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + declare const foo: { bar: string | null } | null; + foo?.bar !== null; + `, + }, + ], + }, + ], + }, + { + code: ` + declare const foo: { bar: string | null } | null; + foo !== null && foo.bar != null; + `, + output: ` + declare const foo: { bar: string | null } | null; + foo?.bar != null; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // https://github.com/typescript-eslint/typescript-eslint/issues/6332 + { + code: 'unrelated != null && foo != null && foo.bar != null;', + output: 'unrelated != null && foo?.bar != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'unrelated1 != null && unrelated2 != null && foo != null && foo.bar != null;', + output: 'unrelated1 != null && unrelated2 != null && foo?.bar != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1461 + { + code: 'foo1 != null && foo1.bar != null && foo2 != null && foo2.bar != null;', + output: 'foo1?.bar != null && foo2?.bar != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo && foo.a && bar && bar.a;', + output: 'foo?.a && bar?.a;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // randomly placed optional chain tokens are ignored + { + code: 'foo.bar.baz != null && foo?.bar?.baz.bam != null;', + output: 'foo.bar.baz?.bam != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo?.bar.baz != null && foo.bar?.baz.bam != null;', + output: 'foo?.bar.baz?.bam != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo?.bar?.baz != null && foo.bar.baz.bam != null;', + output: 'foo?.bar?.baz?.bam != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // randomly placed non-null assertions are retained as long as they're in an earlier operand + { + code: 'foo.bar.baz != null && foo!.bar!.baz.bam != null;', + output: 'foo.bar.baz?.bam != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo!.bar.baz != null && foo.bar!.baz.bam != null;', + output: 'foo!.bar.baz?.bam != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: 'foo!.bar!.baz != null && foo.bar.baz.bam != null;', + output: 'foo!.bar!.baz?.bam != null;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // mixed binary checks are followed and flagged + { + code: ` + a && + a.b != null && + a.b.c !== undefined && + a.b.c !== null && + a.b.c.d != null && + a.b.c.d.e !== null && + a.b.c.d.e !== undefined && + a.b.c.d.e.f != undefined && + typeof a.b.c.d.e.f.g !== 'undefined' && + a.b.c.d.e.f.g !== null && + a.b.c.d.e.f.g.h; + `, + output: ` + a?.b?.c?.d?.e?.f?.g?.h; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + !a || + a.b == null || + a.b.c === undefined || + a.b.c === null || + a.b.c.d == null || + a.b.c.d.e === null || + a.b.c.d.e === undefined || + a.b.c.d.e.f == undefined || + typeof a.b.c.d.e.f.g === 'undefined' || + a.b.c.d.e.f.g === null || + !a.b.c.d.e.f.g.h; + `, + output: ` + !a?.b?.c?.d?.e?.f?.g?.h; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + !a || + a.b == null || + a.b.c === null || + a.b.c === undefined || + a.b.c.d == null || + a.b.c.d.e === null || + a.b.c.d.e === undefined || + a.b.c.d.e.f == undefined || + typeof a.b.c.d.e.f.g === 'undefined' || + a.b.c.d.e.f.g === null || + !a.b.c.d.e.f.g.h; + `, + output: ` + !a?.b?.c?.d?.e?.f?.g?.h; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // yoda checks are flagged + { + code: 'undefined !== foo && null !== foo && null != foo.bar && foo.bar.baz;', + output: 'foo?.bar?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + null != foo && + 'undefined' !== typeof foo.bar && + null !== foo.bar && + foo.bar.baz; + `, + output: ` + foo?.bar?.baz; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + null != foo && + 'undefined' !== typeof foo.bar && + null !== foo.bar && + null != foo.bar.baz; + `, + output: ` + null != foo?.bar?.baz; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // We should retain the split strict equals check if it's the last operand + { + code: ` + null != foo && + 'undefined' !== typeof foo.bar && + null !== foo.bar && + null !== foo.bar.baz && + 'undefined' !== typeof foo.bar.baz; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + null !== foo?.bar?.baz && + 'undefined' !== typeof foo.bar.baz; + `, + }, + ], + }, + ], + }, + { + code: ` + foo != null && + typeof foo.bar !== 'undefined' && + foo.bar !== null && + foo.bar.baz !== null && + typeof foo.bar.baz !== 'undefined'; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + foo?.bar?.baz !== null && + typeof foo.bar.baz !== 'undefined'; + `, + }, + ], + }, + ], + }, + { + code: ` + null != foo && + 'undefined' !== typeof foo.bar && + null !== foo.bar && + null !== foo.bar.baz && + undefined !== foo.bar.baz; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + null !== foo?.bar?.baz && + undefined !== foo.bar.baz; + `, + }, + ], + }, + ], + }, + { + code: ` + foo != null && + typeof foo.bar !== 'undefined' && + foo.bar !== null && + foo.bar.baz !== null && + foo.bar.baz !== undefined; + `, + output: null, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + foo?.bar?.baz !== null && + foo.bar.baz !== undefined; + `, + }, + ], + }, + ], + }, + { + code: ` + null != foo && + 'undefined' !== typeof foo.bar && + null !== foo.bar && + undefined !== foo.bar.baz && + null !== foo.bar.baz; + `, + output: ` + undefined !== foo?.bar?.baz && + null !== foo.bar.baz; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + foo != null && + typeof foo.bar !== 'undefined' && + foo.bar !== null && + foo.bar.baz !== undefined && + foo.bar.baz !== null; + `, + output: ` + foo?.bar?.baz !== undefined && + foo.bar.baz !== null; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // await + { + code: '(await foo).bar && (await foo).bar.baz;', + output: '(await foo).bar?.baz;', + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + // TODO - should we handle this case and expand the range, or should we leave this as is? + { + code: ` + !a || + a.b == null || + a.b.c === undefined || + a.b.c === null || + a.b.c.d == null || + a.b.c.d.e === null || + a.b.c.d.e === undefined || + a.b.c.d.e.f == undefined || + a.b.c.d.e.f.g == null || + a.b.c.d.e.f.g.h; + `, + output: ` + a?.b?.c?.d?.e?.f?.g == null || + a.b.c.d.e.f.g.h; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + + { + code: ` + declare const foo: { bar: number } | null | undefined; + foo && foo.bar != null; + `, + output: ` + declare const foo: { bar: number } | null | undefined; + foo?.bar != null; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + declare const foo: { bar: number } | undefined; + foo && typeof foo.bar !== 'undefined'; + `, + output: ` + declare const foo: { bar: number } | undefined; + typeof foo?.bar !== 'undefined'; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + declare const foo: { bar: number } | undefined; + foo && 'undefined' !== typeof foo.bar; + `, + output: ` + declare const foo: { bar: number } | undefined; + 'undefined' !== typeof foo?.bar; + `, + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + + // allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing + { + code: ` + declare const foo: { bar: number } | null | undefined; + foo != undefined && foo.bar; + `, + output: ` + declare const foo: { bar: number } | null | undefined; + foo?.bar; + `, + options: [ + { + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: + true, + }, + ], + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: null, + }, + ], + }, + { + code: ` + declare const foo: { bar: number } | null | undefined; + foo != undefined && foo.bar; + `, + output: null, + options: [ + { + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing: + false, + }, + ], + errors: [ + { + messageId: 'preferOptionalChain', + suggestions: [ + { + messageId: 'optionalChainSuggest', + output: ` + declare const foo: { bar: number } | null | undefined; + foo?.bar; + `, + }, + ], + }, + ], + }, + ], + }); +}); + +describe('base cases', () => { + describe('and', () => { + describe('boolean', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: [ + ...BaseCases({ + operator: '&&', + }), + // it should ignore parts of the expression that aren't part of the expression chain + ...BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/;$/, ' && bing;'), + }), + ...BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/;$/, ' && bing.bong;'), + }), + ], + }); + }); + + describe('strict nullish equality checks', () => { + describe('!== null', () => { + ruleTester.run('prefer-optional-chain', rule, { + // with the `| null | undefined` type - `!== null` doesn't cover the + // `undefined` case - so optional chaining is not a valid conversion + valid: BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/&&/g, '!== null &&'), + mutateOutput: identity, + }), + // but if the type is just `| null` - then it covers the cases and is + // a valid conversion + invalid: BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/&&/g, '!== null &&'), + mutateOutput: identity, + mutateDeclaration: c => c.replace(/\| undefined/g, ''), + useSuggestionFixer: true, + }), + }); + }); + + describe('!= null', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/&&/g, '!= null &&'), + mutateOutput: identity, + useSuggestionFixer: true, + }), + }); + }); + + describe('!== undefined', () => { + ruleTester.run('prefer-optional-chain', rule, { + // with the `| null | undefined` type - `!== undefined` doesn't cover the + // `null` case - so optional chaining is not a valid conversion + valid: BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/&&/g, '!== undefined &&'), + mutateOutput: identity, + }), + // but if the type is just `| undefined` - then it covers the cases and is + // a valid conversion + invalid: BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/&&/g, '!== undefined &&'), + mutateOutput: identity, + mutateDeclaration: c => c.replace(/\| null/g, ''), + useSuggestionFixer: true, + }), + }); + }); + + describe('!= undefined', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/&&/g, '!= undefined &&'), + mutateOutput: identity, + useSuggestionFixer: true, + }), + }); + }); + }); + }); + + describe('or', () => { + describe('boolean', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: BaseCases({ + operator: '||', + mutateCode: c => `!${c.replace(/\|\|/g, '|| !')}`, + mutateOutput: c => `!${c}`, + }), + }); + }); + + describe('strict nullish equality checks', () => { + describe('=== null', () => { + ruleTester.run('prefer-optional-chain', rule, { + // with the `| null | undefined` type - `=== null` doesn't cover the + // `undefined` case - so optional chaining is not a valid conversion + valid: BaseCases({ + operator: '||', + mutateCode: c => c.replace(/\|\|/g, '=== null ||'), + mutateOutput: identity, + }), + // but if the type is just `| null` - then it covers the cases and is + // a valid conversion + invalid: BaseCases({ + operator: '||', + mutateCode: c => + c + .replace(/\|\|/g, '=== null ||') + // SEE TODO AT THE BOTTOM OF THE RULE + // We need to ensure the final operand is also a "valid" `||` check + .replace(/;$/, ' === null;'), + mutateOutput: c => c.replace(/;$/, ' === null;'), + mutateDeclaration: c => c.replace(/\| undefined/g, ''), + useSuggestionFixer: true, + }), + }); + }); + + describe('== null', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: BaseCases({ + operator: '||', + mutateCode: c => + c + .replace(/\|\|/g, '== null ||') + // SEE TODO AT THE BOTTOM OF THE RULE + // We need to ensure the final operand is also a "valid" `||` check + .replace(/;$/, ' == null;'), + mutateOutput: c => c.replace(/;$/, ' == null;'), + }), + }); + }); + + describe('=== undefined', () => { + ruleTester.run('prefer-optional-chain', rule, { + // with the `| null | undefined` type - `=== undefined` doesn't cover the + // `null` case - so optional chaining is not a valid conversion + valid: BaseCases({ + operator: '||', + mutateCode: c => c.replace(/\|\|/g, '=== undefined ||'), + mutateOutput: identity, + }), + // but if the type is just `| undefined` - then it covers the cases and is + // a valid conversion + invalid: BaseCases({ + operator: '||', + mutateCode: c => + c + .replace(/\|\|/g, '=== undefined ||') + // SEE TODO AT THE BOTTOM OF THE RULE + // We need to ensure the final operand is also a "valid" `||` check + .replace(/;$/, ' === undefined;'), + mutateOutput: c => c.replace(/;$/, ' === undefined;'), + mutateDeclaration: c => c.replace(/\| null/g, ''), + }), + }); + }); + + describe('== undefined', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: BaseCases({ + operator: '||', + mutateCode: c => + c + .replace(/\|\|/g, '== undefined ||') + // SEE TODO AT THE BOTTOM OF THE RULE + // We need to ensure the final operand is also a "valid" `||` check + .replace(/;$/, ' == undefined;'), + mutateOutput: c => c.replace(/;$/, ' == undefined;'), + }), + }); + }); + }); + }); + + describe('should ignore spacing sanity checks', () => { + ruleTester.run('prefer-optional-chain', rule, { + valid: [], + invalid: [ + // it should ignore whitespace in the expressions + ...BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/\./g, '. '), + // note - the rule will use raw text for computed expressions - so we + // need to ensure that the spacing for the computed member + // expressions is retained for correct fixer matching + mutateOutput: c => + c.replace(/(\[.+\])/g, m => m.replace(/\./g, '. ')), + }), + ...BaseCases({ + operator: '&&', + mutateCode: c => c.replace(/\./g, '.\n'), + mutateOutput: c => + c.replace(/(\[.+\])/g, m => m.replace(/\./g, '.\n')), + }), + ], + }); + }); }); diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts index 7cd0527b2cf..d392a5232fd 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly-parameter-types.test.ts @@ -1,3 +1,4 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import rule from '../../src/rules/prefer-readonly-parameter-types'; @@ -6,7 +7,7 @@ import type { InferOptionsTypeFromRule, } from '../../src/util'; import { readonlynessOptionsDefaults } from '../../src/util'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; type MessageIds = InferMessageIdsTypeFromRule; type Options = InferOptionsTypeFromRule; @@ -290,7 +291,7 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { new (arg: readonly string[]): void; } `, // TSConstructSignatureDeclaration - noFormat`const x = { foo(arg: readonly string[]): void; };`, // TSEmptyBodyFunctionExpression + noFormat`class Foo { foo(arg: readonly string[]): void; };`, // TSEmptyBodyFunctionExpression 'function foo(arg: readonly string[]);', // TSDeclareFunction 'type Foo = (arg: readonly string[]) => void;', // TSFunctionType ` @@ -369,7 +370,7 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { interface Obj { readonly [K: string]: Obj; } - + function foo(event: Obj): void {} `, options: [ @@ -386,11 +387,11 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { interface Obj1 { readonly [K: string]: Obj2; } - + interface Obj2 { readonly [K: string]: Obj1; } - + function foo(event: Obj1): void {} `, options: [ @@ -401,6 +402,83 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, ], }, + // Allowlist + { + code: ` + interface Foo { + readonly prop: RegExp; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'lib', name: 'RegExp' }], + }, + ], + }, + { + code: ` + interface Foo { + prop: RegExp; + } + + function foo(arg: Readonly) {} + `, + options: [ + { + allow: [{ from: 'lib', name: 'RegExp' }], + }, + ], + }, + { + code: ` + interface Foo { + prop: string; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'file', name: 'Foo' }], + }, + ], + }, + { + code: ` + interface Bar { + prop: string; + } + interface Foo { + readonly prop: Bar; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'file', name: 'Foo' }], + }, + ], + }, + { + code: ` + interface Bar { + prop: string; + } + interface Foo { + readonly prop: Bar; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'file', name: 'Bar' }], + }, + ], + }, ], invalid: [ // arrays @@ -667,7 +745,7 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, { // TSEmptyBodyFunctionExpression - code: noFormat`const x = { foo(arg: string[]): void; };`, + code: noFormat`class Foo { foo(arg: string[]): void; };`, errors: [ { messageId: 'shouldBeReadonly', @@ -869,5 +947,142 @@ ruleTester.run('prefer-readonly-parameter-types', rule, { }, ], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/3405 + { + code: ` + type MyType = { + [K in keyof T]: 'cat' | 'dog' | T[K]; + }; + + function method(value: MyType) { + return value; + } + + method(['cat', 'dog']); + method<'mouse'[]>(['cat', 'mouse']); + `, + errors: [{ line: 6, messageId: 'shouldBeReadonly' }], + }, + // Allowlist + { + code: ` + function foo(arg: RegExp) {} + `, + options: [ + { + allow: [{ from: 'file', name: 'Foo' }], + }, + ], + errors: [ + { + messageId: 'shouldBeReadonly', + line: 2, + column: 22, + endColumn: 33, + }, + ], + }, + { + code: ` + interface Foo { + readonly prop: RegExp; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'file', name: 'Bar' }], + }, + ], + errors: [ + { + messageId: 'shouldBeReadonly', + line: 6, + column: 22, + endColumn: 30, + }, + ], + }, + { + code: ` + interface Foo { + readonly prop: RegExp; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'lib', name: 'Foo' }], + }, + ], + errors: [ + { + messageId: 'shouldBeReadonly', + line: 6, + column: 22, + endColumn: 30, + }, + ], + }, + { + code: ` + interface Foo { + readonly prop: RegExp; + } + + function foo(arg: Foo) {} + `, + options: [ + { + allow: [{ from: 'package', name: 'Foo', package: 'foo-lib' }], + }, + ], + errors: [ + { + messageId: 'shouldBeReadonly', + line: 6, + column: 22, + endColumn: 30, + }, + ], + }, + { + code: ` + function foo(arg: RegExp) {} + `, + options: [ + { + allow: [{ from: 'file', name: 'RegExp' }], + }, + ], + errors: [ + { + messageId: 'shouldBeReadonly', + line: 2, + column: 22, + endColumn: 33, + }, + ], + }, + { + code: ` + function foo(arg: RegExp) {} + `, + options: [ + { + allow: [{ from: 'package', name: 'RegExp', package: 'regexp-lib' }], + }, + ], + errors: [ + { + messageId: 'shouldBeReadonly', + line: 2, + column: 22, + endColumn: 33, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index 10f2e3d1e07..f1b57419adc 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-readonly'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/prefer-reduce-type-parameter.test.ts b/packages/eslint-plugin/tests/rules/prefer-reduce-type-parameter.test.ts index 5e7fae0bfea..43aadcec074 100644 --- a/packages/eslint-plugin/tests/rules/prefer-reduce-type-parameter.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-reduce-type-parameter.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-reduce-type-parameter'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts b/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts index 2ac3c7a07ba..dca08379827 100644 --- a/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-regexp-exec'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -74,6 +76,12 @@ const matchCount = (str: string, re: RegExp) => { return (str.match(re) || []).length; }; `, + // https://github.com/typescript-eslint/typescript-eslint/issues/6928 + ` +function test(str: string) { + str.match('[a-z'); +} + `, ], invalid: [ { diff --git a/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts b/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts index a93590dfec0..bc571b26cc2 100644 --- a/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-return-this-type.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-return-this-type'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts index c9fe331c99d..aaea8e8b36c 100644 --- a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts @@ -1,7 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import rule from '../../src/rules/prefer-string-starts-ends-with'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -1063,8 +1064,8 @@ ruleTester.run('prefer-string-starts-ends-with', rule, { }); type Case> = - | TSESLint.ValidTestCase - | TSESLint.InvalidTestCase; + | TSESLint.InvalidTestCase + | TSESLint.ValidTestCase; function addOptional>( cases: (TSESLint.ValidTestCase | string)[], ): TSESLint.ValidTestCase[]; diff --git a/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts b/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts index ccc510187d9..7937dc3fc6e 100644 --- a/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-ts-expect-error.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/prefer-ts-expect-error'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 089e6ba617b..83f0bf6107a 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -1,7 +1,7 @@ -import { noFormat } from '@typescript-eslint/utils/src/eslint-utils'; +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import rule from '../../src/rules/promise-function-async'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const messageId = 'missingAsync'; diff --git a/packages/eslint-plugin/tests/rules/quotes.test.ts b/packages/eslint-plugin/tests/rules/quotes.test.ts index 003d4fd19d7..d6c25e6f41a 100644 --- a/packages/eslint-plugin/tests/rules/quotes.test.ts +++ b/packages/eslint-plugin/tests/rules/quotes.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/quotes'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -741,12 +742,12 @@ abstract class Foo { }, { code: '() => { foo(); `use strict`; }', - output: '() => { foo(); "use strict"; }', + output: null, errors: [useDoubleQuote], }, { code: 'foo(); `use strict`;', - output: 'foo(); "use strict";', + output: null, errors: [useDoubleQuote], }, diff --git a/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts b/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts index 672ff4e7c10..771adedb141 100644 --- a/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts +++ b/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/require-array-sort-compare'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -136,11 +138,28 @@ ruleTester.run('require-array-sort-compare', rule, { }, { code: ` - function f(a: string[]) { + function f(a: number[]) { + a.sort(); + } + `, + errors: [{ messageId: 'requireCompare' }], + }, + { + code: ` + function f(a: number[]) { a.sort(); } `, errors: [{ messageId: 'requireCompare' }], + options: [{ ignoreStringArrays: false }], + }, + { + code: ` + function f(a: number | number[]) { + if (Array.isArray(a)) a.sort(); + } + `, + errors: [{ messageId: 'requireCompare' }], }, { code: ` @@ -149,6 +168,7 @@ ruleTester.run('require-array-sort-compare', rule, { } `, errors: [{ messageId: 'requireCompare' }], + options: [{ ignoreStringArrays: false }], }, { code: ` @@ -177,7 +197,7 @@ ruleTester.run('require-array-sort-compare', rule, { // optional chain { code: ` - function f(a: string[]) { + function f(a: number[]) { a?.sort(); } `, @@ -185,24 +205,24 @@ ruleTester.run('require-array-sort-compare', rule, { }, { code: ` - ['foo', 'bar', 'baz'].sort(); + [1, 2, 3].sort(); `, errors: [{ messageId: 'requireCompare' }], }, { code: ` - function getString() { - return 'foo'; + function getNumber() { + return 1; } - [getString(), getString()].sort(); + [getNumber(), getNumber()].sort(); `, errors: [{ messageId: 'requireCompare' }], }, { code: ` - const foo = 'foo'; - const bar = 'bar'; - const baz = 'baz'; + const foo = 1; + const bar = 2; + const baz = 3; [foo, bar, baz].sort(); `, errors: [{ messageId: 'requireCompare' }], diff --git a/packages/eslint-plugin/tests/rules/require-await.test.ts b/packages/eslint-plugin/tests/rules/require-await.test.ts index c31dab5a0d7..6e36dcf10c2 100644 --- a/packages/eslint-plugin/tests/rules/require-await.test.ts +++ b/packages/eslint-plugin/tests/rules/require-await.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/require-await'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); @@ -218,6 +220,18 @@ async function* foo(): Promise { return new Promise(res => res(\`hello\`)); } `, + // https://github.com/typescript-eslint/typescript-eslint/issues/5458 + ` + async function* f() { + let x!: Omit< + { + [Symbol.asyncIterator](): AsyncIterator; + }, + 'z' + >; + yield* x; + } + `, ], invalid: [ diff --git a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts index 59215883758..f98f6c18750 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/restrict-plus-operands'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -13,53 +15,53 @@ const ruleTester = new RuleTester({ ruleTester.run('restrict-plus-operands', rule, { valid: [ - 'var x = 5;', - "var y = '10';", - 'var z = 8.2;', - "var w = '6.5';", - 'var foo = 5 + 10;', - "var foo = '5.5' + '10';", - "var foo = parseInt('5.5', 10) + 10;", - "var foo = parseFloat('5.5', 10) + 10;", - 'var foo = 1n + 1n;', - 'var foo = BigInt(1) + 1n;', + 'let x = 5;', + "let y = '10';", + 'let z = 8.2;', + "let w = '6.5';", + 'let foo = 5 + 10;', + "let foo = '5.5' + '10';", + "let foo = parseInt('5.5', 10) + 10;", + "let foo = parseFloat('5.5', 10) + 10;", + 'let foo = 1n + 1n;', + 'let foo = BigInt(1) + 1n;', ` - var foo = 1n; + let foo = 1n; foo + 2n; `, ` function test(s: string, n: number): number { return 2; } -var foo = test('5.5', 10) + 10; +let foo = test('5.5', 10) + 10; `, ` -var x = 5; -var z = 8.2; -var foo = x + z; +let x = 5; +let z = 8.2; +let foo = x + z; `, ` -var w = '6.5'; -var y = '10'; -var foo = y + w; +let w = '6.5'; +let y = '10'; +let foo = y + w; `, - 'var foo = 1 + 1;', - "var foo = '1' + '1';", + 'let foo = 1 + 1;', + "let foo = '1' + '1';", ` -var pair: { first: number; second: string } = { first: 5, second: '10' }; -var foo = pair.first + 10; +let pair: { first: number; second: string } = { first: 5, second: '10' }; +let foo = pair.first + 10; `, ` -var pair: { first: number; second: string } = { first: 5, second: '10' }; -var foo = pair.first + (10 as number); +let pair: { first: number; second: string } = { first: 5, second: '10' }; +let foo = pair.first + (10 as number); `, ` -var pair: { first: number; second: string } = { first: 5, second: '10' }; -var foo = '5.5' + pair.second; +let pair: { first: number; second: string } = { first: 5, second: '10' }; +let foo = '5.5' + pair.second; `, ` -var pair: { first: number; second: string } = { first: 5, second: '10' }; -var foo = ('5.5' as string) + pair.second; +let pair: { first: number; second: string } = { first: 5, second: '10' }; +let foo = ('5.5' as string) + pair.second; `, ` const foo = @@ -156,223 +158,494 @@ function A(s: string) { return \`a\${s}b\` as const; } const b = A('') + '!'; + `, + ` +declare const a: \`template\${string}\`; +declare const b: ''; +const x = a + b; + `, + ` +const a: \`template\${0}\`; +declare const b: ''; +const x = a + b; `, { code: ` -let foo: number = 0; -foo += 1; + declare const a: RegExp; + declare const b: string; + const x = a + b; + `, + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: true, + allowNullish: false, + }, + ], + }, + { + code: ` + const a = /regexp/; + declare const b: string; + const x = a + b; + `, + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: true, + allowNullish: false, + }, + ], + }, + // TypeScript handles this case, so we don't have to + { + code: ` +const f = (a: RegExp, b: RegExp) => a + b; + `, + options: [ + { + allowRegExp: true, + }, + ], + }, + { + code: ` +let foo: string | undefined; +foo = foo + 'some data'; `, options: [ { - checkCompoundAssignments: false, + allowNullish: true, }, ], }, { code: ` -let foo: number = 0; -foo += 'string'; +let foo: string | null; +foo = foo + 'some data'; `, options: [ { - checkCompoundAssignments: false, + allowNullish: true, + }, + ], + }, + { + code: ` +let foo: string | null | undefined; +foo = foo + 'some data'; + `, + options: [ + { + allowNullish: true, + }, + ], + }, + { + code: ` +let foo = ''; +foo += 0; + `, + options: [ + { + allowAny: false, + allowBoolean: false, + allowNullish: false, + allowNumberAndString: false, + allowRegExp: false, + skipCompoundAssignments: true, + }, + ], + }, + { + code: ` +let foo = 0; +foo += ''; + `, + options: [ + { + allowAny: false, + allowBoolean: false, + allowNullish: false, + allowNumberAndString: false, + allowRegExp: false, + skipCompoundAssignments: true, + }, + ], + }, + { + code: ` +const f = (a: any, b: any) => a + b; + `, + options: [ + { + allowAny: true, + }, + ], + }, + { + code: ` +const f = (a: any, b: string) => a + b; + `, + options: [ + { + allowAny: true, + }, + ], + }, + { + code: ` +const f = (a: any, b: bigint) => a + b; + `, + options: [ + { + allowAny: true, + }, + ], + }, + { + code: ` +const f = (a: any, b: number) => a + b; + `, + options: [ + { + allowAny: true, }, ], }, { code: ` -export const f = (a: any, b: any) => a + b; +const f = (a: any, b: boolean) => a + b; `, options: [ { allowAny: true, + allowBoolean: true, }, ], }, { code: ` -export const f = (a: any, b: string) => a + b; +const f = (a: string, b: string | number) => a + b; `, options: [ { allowAny: true, + allowBoolean: true, + allowNullish: true, + allowNumberAndString: true, + allowRegExp: true, }, ], }, { code: ` -export const f = (a: any, b: bigint) => a + b; +const f = (a: string | number, b: number) => a + b; `, options: [ { allowAny: true, + allowBoolean: true, + allowNullish: true, + allowNumberAndString: true, + allowRegExp: true, }, ], }, { code: ` -export const f = (a: any, b: number) => a + b; +const f = (a: string | number, b: string | number) => a + b; `, options: [ { allowAny: true, + allowBoolean: true, + allowNullish: true, + allowNumberAndString: true, + allowRegExp: true, }, ], }, ], invalid: [ { - code: "var foo = '1' + 1;", + code: "let foo = '1' + 1;", errors: [ { - messageId: 'notStrings', + data: { + left: 'string', + right: 'number', + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + }, + messageId: 'mismatched', line: 1, column: 11, }, ], + options: [{ allowNumberAndString: false }], }, { - code: 'var foo = [] + {};', + code: "let foo = '1' + 1;", errors: [ { - messageId: 'notValidTypes', + data: { + left: 'string', + right: 'number', + stringLike: 'string', + }, + messageId: 'mismatched', line: 1, column: 11, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNullish: false, + allowNumberAndString: false, + allowRegExp: false, + }, + ], }, { - code: "var foo = 5 + '10';", + code: 'let foo = [] + {};', errors: [ { - messageId: 'notStrings', - line: 1, + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'never[]', + }, column: 11, + endColumn: 13, + line: 1, + messageId: 'invalid', + }, + { + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: '{}', + }, + column: 16, + endColumn: 18, + line: 1, + messageId: 'invalid', }, ], }, { - code: 'var foo = [] + 5;', + code: "let foo = 5 + '10';", errors: [ { - messageId: 'notNumbers', + data: { + left: 'number', + right: 'string', + stringLike: 'string', + }, + messageId: 'mismatched', line: 1, column: 11, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNullish: false, + allowNumberAndString: false, + allowRegExp: false, + }, + ], }, { - code: 'var foo = [] + [];', + code: 'let foo = [] + 5;', errors: [ { - messageId: 'notValidTypes', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'never[]', + }, + messageId: 'invalid', line: 1, column: 11, + endColumn: 13, }, ], }, { - code: 'var foo = 5 + [];', + code: 'let foo = [] + [];', errors: [ { - messageId: 'notNumbers', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'never[]', + }, + messageId: 'invalid', line: 1, + endColumn: 13, column: 11, }, + { + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'never[]', + }, + messageId: 'invalid', + line: 1, + endColumn: 18, + column: 16, + }, ], }, { - code: "var foo = '5' + {};", + code: 'let foo = 5 + [3];', errors: [ { - messageId: 'notStrings', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'number[]', + }, + column: 15, + endColumn: 18, line: 1, - column: 11, + messageId: 'invalid', }, ], }, { - code: "var foo = 5.5 + '5';", + code: "let foo = '5' + {};", errors: [ { - messageId: 'notStrings', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: '{}', + }, + messageId: 'invalid', line: 1, - column: 11, + endColumn: 19, + column: 17, }, ], }, { - code: "var foo = '5.5' + 5;", + code: "let foo = 5.5 + '5';", errors: [ { - messageId: 'notStrings', + data: { + left: 'number', + right: 'string', + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + }, + messageId: 'mismatched', line: 1, column: 11, }, ], + options: [{ allowNumberAndString: false }], }, { - code: ` -var x = 5; -var y = '10'; -var foo = x + y; - `, + code: "let foo = '5.5' + 5;", errors: [ { - messageId: 'notStrings', - line: 4, + data: { + left: 'string', + right: 'number', + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + }, + messageId: 'mismatched', + line: 1, column: 11, }, ], + options: [{ allowNumberAndString: false }], }, { code: ` -var x = 5; -var y = '10'; -var foo = y + x; +let x = 5; +let y = '10'; +let foo = x + y; `, errors: [ { - messageId: 'notStrings', + data: { + left: 'number', + right: 'string', + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + }, + messageId: 'mismatched', line: 4, column: 11, }, ], + options: [{ allowNumberAndString: false }], }, { code: ` -var x = 5; -var foo = x + {}; +let x = 5; +let y = '10'; +let foo = y + x; `, errors: [ { - messageId: 'notNumbers', - line: 3, + data: { + right: 'number', + left: 'string', + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + }, + messageId: 'mismatched', + line: 4, column: 11, }, ], + options: [{ allowNumberAndString: false }], }, { code: ` -var y = '10'; -var foo = [] + y; +let x = 5; +let foo = x + {}; `, errors: [ { - messageId: 'notStrings', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: '{}', + }, + messageId: 'invalid', line: 3, - column: 11, + column: 15, }, ], }, { code: ` -var pair: { first: number; second: string } = { first: 5, second: '10' }; -var foo = pair.first + '10'; +let y = '10'; +let foo = [] + y; `, errors: [ { - messageId: 'notStrings', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'never[]', + }, + messageId: 'invalid', line: 3, column: 11, }, @@ -380,55 +653,92 @@ var foo = pair.first + '10'; }, { code: ` -var pair: { first: number; second: string } = { first: 5, second: '10' }; -var foo = 5 + pair.second; +let pair = { first: 5, second: '10' }; +let foo = pair + pair; `, errors: [ { - messageId: 'notStrings', - line: 3, + data: { + stringLike: 'string', + type: '{ first: number; second: string; }', + }, column: 11, + endColumn: 15, + line: 3, + messageId: 'invalid', + }, + { + data: { + stringLike: 'string', + type: '{ first: number; second: string; }', + }, + column: 18, + endColumn: 22, + line: 3, + messageId: 'invalid', }, ], - }, - { - code: "var foo = parseInt('5.5', 10) + '10';", - errors: [ + options: [ { - messageId: 'notStrings', - line: 1, - column: 11, + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, }, ], }, { code: ` -var pair = { first: 5, second: '10' }; -var foo = pair + pair; +type Valued = { value: number }; +let value: Valued = { value: 0 }; +let combined = value + 0; `, errors: [ { - messageId: 'notValidTypes', - line: 3, - column: 11, + data: { + stringLike: 'string', + type: 'Valued', + }, + column: 16, + endColumn: 21, + line: 4, + messageId: 'invalid', + }, + ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, }, ], }, { - code: 'var foo = 1n + 1;', + code: 'let foo = 1n + 1;', errors: [ { - messageId: 'notBigInts', + data: { + left: 'bigint', + right: 'number', + }, + messageId: 'bigintAndNumber', line: 1, column: 11, }, ], }, { - code: 'var foo = 1 + 1n;', + code: 'let foo = 1 + 1n;', errors: [ { - messageId: 'notBigInts', + data: { + left: 'number', + right: 'bigint', + }, + messageId: 'bigintAndNumber', line: 1, column: 11, }, @@ -436,12 +746,16 @@ var foo = pair + pair; }, { code: ` - var foo = 1n; + let foo = 1n; foo + 1; `, errors: [ { - messageId: 'notBigInts', + data: { + left: 'bigint', + right: 'number', + }, + messageId: 'bigintAndNumber', line: 3, column: 9, }, @@ -449,12 +763,16 @@ var foo = pair + pair; }, { code: ` - var foo = 1; + let foo = 1; foo + 1n; `, errors: [ { - messageId: 'notBigInts', + data: { + left: 'number', + right: 'bigint', + }, + messageId: 'bigintAndNumber', line: 3, column: 9, }, @@ -469,11 +787,25 @@ function foo(a: T) { `, errors: [ { - messageId: 'notStrings', + data: { + left: 'string', + right: 'number', + stringLike: 'string', + }, + messageId: 'mismatched', line: 3, column: 10, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` @@ -483,11 +815,25 @@ function foo(a: T) { `, errors: [ { - messageId: 'notStrings', + data: { + left: 'string', + right: 'number', + stringLike: 'string', + }, + messageId: 'mismatched', line: 3, column: 10, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` @@ -497,11 +843,25 @@ function foo(a: T) { `, errors: [ { - messageId: 'notStrings', + data: { + left: 'number', + right: 'string', + stringLike: 'string', + }, + messageId: 'mismatched', line: 3, column: 10, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` @@ -511,81 +871,134 @@ function foo(a: T) { `, errors: [ { - messageId: 'notStrings', + data: { + left: 'number', + right: 'string', + stringLike: 'string', + }, + messageId: 'mismatched', line: 3, column: 10, }, ], - }, - { - code: ` - declare const a: boolean & string; - declare const b: string; - const x = a + b; - `, - errors: [ + options: [ { - messageId: 'notStrings', - line: 4, - column: 19, + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, }, ], }, { code: ` - declare const a: number & string; - declare const b: string; + declare const a: \`template\${number}\`; + declare const b: number; const x = a + b; `, errors: [ { - messageId: 'notStrings', + data: { + left: 'string', + right: 'number', + stringLike: 'string', + }, + messageId: 'mismatched', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: symbol & string; + declare const a: never; declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notStrings', + data: { + stringLike: 'string', + type: 'never', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: object & string; + declare const a: never & string; declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notStrings', + data: { + stringLike: 'string', + type: 'never', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: never & string; + declare const a: boolean & string; declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notStrings', + data: { + stringLike: 'string', + type: 'never', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` @@ -595,11 +1008,24 @@ function foo(a: T) { `, errors: [ { - messageId: 'notValidAnys', + data: { + stringLike: 'string', + type: 'any', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` @@ -609,193 +1035,385 @@ function foo(a: T) { `, errors: [ { - messageId: 'notStrings', + data: { + stringLike: 'string', + type: '{ a: 1; } & { b: 2; }', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: boolean & number; - declare const b: number; + interface A { + a: 1; + } + declare const a: A; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notNumbers', - line: 4, + data: { + stringLike: 'string', + type: 'A', + }, + messageId: 'invalid', + line: 7, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: symbol & number; - declare const b: number; + interface A { + a: 1; + } + interface A2 extends A { + b: 2; + } + declare const a: A2; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notNumbers', - line: 4, + data: { + stringLike: 'string', + type: 'A2', + }, + messageId: 'invalid', + line: 10, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: object & number; - declare const b: number; + type A = { a: 1 } & { b: 2 }; + declare const a: A; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notNumbers', - line: 4, + data: { + stringLike: 'string', + type: 'A', + }, + messageId: 'invalid', + line: 5, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: never & number; + declare const a: { a: 1 } & { b: 2 }; declare const b: number; const x = a + b; `, errors: [ { - messageId: 'notNumbers', + data: { + stringLike: 'string', + type: '{ a: 1; } & { b: 2; }', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: any & number; - declare const b: number; + declare const a: never; + declare const b: bigint; const x = a + b; `, errors: [ { - messageId: 'notValidAnys', + data: { + stringLike: 'string', + type: 'never', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: { a: 1 } & { b: 2 }; - declare const b: number; + declare const a: any; + declare const b: bigint; const x = a + b; `, errors: [ { - messageId: 'notNumbers', + data: { + stringLike: 'string', + type: 'any', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: boolean & bigint; + declare const a: { a: 1 } & { b: 2 }; declare const b: bigint; const x = a + b; `, errors: [ { - messageId: 'notBigInts', + data: { + stringLike: 'string', + type: '{ a: 1; } & { b: 2; }', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: number & bigint; - declare const b: bigint; + declare const a: RegExp; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notBigInts', + data: { + stringLike: 'string', + type: 'RegExp', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: symbol & bigint; - declare const b: bigint; + const a = /regexp/; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notBigInts', + data: { + stringLike: 'string', + type: 'RegExp', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: object & bigint; - declare const b: bigint; + declare const a: Symbol; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notBigInts', + data: { + stringLike: 'string', + type: 'Symbol', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: never & bigint; - declare const b: bigint; + declare const a: symbol; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notBigInts', + data: { + stringLike: 'string', + type: 'symbol', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: any & bigint; - declare const b: bigint; + declare const a: unique symbol; + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notValidAnys', + data: { + stringLike: 'string', + type: 'unique symbol', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` - declare const a: { a: 1 } & { b: 2 }; - declare const b: bigint; + const a = Symbol(''); + declare const b: string; const x = a + b; `, errors: [ { - messageId: 'notBigInts', + data: { + stringLike: 'string', + type: 'unique symbol', + }, + messageId: 'invalid', line: 4, column: 19, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], }, { code: ` @@ -804,12 +1422,21 @@ foo += 'some data'; `, options: [ { - checkCompoundAssignments: true, + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + skipCompoundAssignments: false, }, ], errors: [ { - messageId: 'notStrings', + data: { + stringLike: 'string', + type: 'string | undefined', + }, + messageId: 'invalid', line: 3, column: 1, }, @@ -817,21 +1444,83 @@ foo += 'some data'; }, { code: ` -let foo = ''; -foo += 0; +let foo: string | null; +foo += 'some data'; + `, + errors: [ + { + data: { + stringLike: 'string', + type: 'string | null', + }, + messageId: 'invalid', + line: 3, + column: 1, + }, + ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNumberAndString: false, + allowRegExp: false, + allowNullish: false, + }, + ], + }, + { + code: ` +let foo: string = ''; +foo += 1; `, + errors: [ + { + data: { + left: 'string', + right: 'number', + stringLike: 'string', + }, + messageId: 'mismatched', + line: 3, + column: 1, + }, + ], options: [ { - checkCompoundAssignments: true, + allowAny: false, + allowBoolean: false, + allowNullish: false, + allowNumberAndString: false, + allowRegExp: false, }, ], + }, + { + code: ` +let foo = 0; +foo += ''; + `, errors: [ { - messageId: 'notStrings', + data: { + left: 'number', + right: 'string', + stringLike: 'string', + }, + messageId: 'mismatched', line: 3, column: 1, }, ], + options: [ + { + allowAny: false, + allowBoolean: false, + allowNullish: false, + allowNumberAndString: false, + allowRegExp: false, + }, + ], }, { code: ` @@ -840,13 +1529,14 @@ const f = (a: any, b: boolean) => a + b; options: [ { allowAny: true, + allowBoolean: false, }, ], errors: [ { - messageId: 'notValidAnys', + messageId: 'invalid', line: 2, - column: 35, + column: 39, }, ], }, @@ -861,13 +1551,40 @@ const f = (a: any, b: []) => a + b; ], errors: [ { - messageId: 'notValidAnys', + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: '[]', + }, + messageId: 'invalid', line: 2, - column: 30, + column: 34, + }, + ], + }, + { + code: ` +const f = (a: any, b: boolean) => a + b; + `, + options: [ + { + allowAny: false, + allowBoolean: true, + }, + ], + errors: [ + { + data: { + stringLike: + 'string, allowing a string + any of: `boolean`, `null`, `RegExp`, `undefined`', + type: 'any', + }, + messageId: 'invalid', + line: 2, + column: 35, }, ], }, - { code: ` const f = (a: any, b: any) => a + b; @@ -879,10 +1596,15 @@ const f = (a: any, b: any) => a + b; ], errors: [ { - messageId: 'notValidAnys', + messageId: 'invalid', line: 2, column: 31, }, + { + messageId: 'invalid', + line: 2, + column: 35, + }, ], }, { @@ -896,7 +1618,7 @@ const f = (a: any, b: string) => a + b; ], errors: [ { - messageId: 'notValidAnys', + messageId: 'invalid', line: 2, column: 34, }, @@ -913,7 +1635,7 @@ const f = (a: any, b: bigint) => a + b; ], errors: [ { - messageId: 'notValidAnys', + messageId: 'invalid', line: 2, column: 34, }, @@ -930,7 +1652,7 @@ const f = (a: any, b: number) => a + b; ], errors: [ { - messageId: 'notValidAnys', + messageId: 'invalid', line: 2, column: 34, }, @@ -940,16 +1662,110 @@ const f = (a: any, b: number) => a + b; code: ` const f = (a: any, b: boolean) => a + b; `, + errors: [ + { + messageId: 'invalid', + line: 2, + column: 35, + }, + { + messageId: 'invalid', + line: 2, + column: 39, + }, + ], options: [ { allowAny: false, + allowBoolean: false, }, ], + }, + { + code: ` +const f = (a: number, b: RegExp) => a + b; + `, errors: [ { - messageId: 'notValidAnys', + messageId: 'invalid', line: 2, - column: 35, + column: 41, + }, + ], + options: [ + { + allowRegExp: true, + }, + ], + }, + { + code: ` +let foo: string | boolean; +foo = foo + 'some data'; + `, + errors: [ + { + data: { + stringLike: + 'string, allowing a string + any of: `any`, `null`, `RegExp`, `undefined`', + type: 'string | boolean', + }, + messageId: 'invalid', + line: 3, + column: 7, + }, + ], + options: [ + { + allowBoolean: false, + }, + ], + }, + { + code: ` +let foo: boolean; +foo = foo + 'some data'; + `, + errors: [ + { + data: { + stringLike: + 'string, allowing a string + any of: `any`, `null`, `RegExp`, `undefined`', + type: 'boolean', + }, + messageId: 'invalid', + line: 3, + column: 7, + }, + ], + options: [ + { + allowBoolean: false, + }, + ], + }, + { + code: ` +const f = (a: any, b: unknown) => a + b; + `, + options: [ + { + allowAny: true, + allowBoolean: true, + allowNullish: true, + allowRegExp: true, + }, + ], + errors: [ + { + data: { + stringLike: + 'string, allowing a string + any of: `any`, `boolean`, `null`, `RegExp`, `undefined`', + type: 'unknown', + }, + messageId: 'invalid', + line: 2, + column: 39, }, ], }, diff --git a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts index b58305051fa..48b700584ef 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -1,5 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/restrict-template-expressions'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); @@ -289,6 +291,11 @@ ruleTester.run('restrict-template-expressions', rule, { } `, }, + 'const msg = `arg = ${false}`;', + 'const msg = `arg = ${null}`;', + 'const msg = `arg = ${undefined}`;', + 'const msg = `arg = ${123}`;', + "const msg = `arg = ${'abc'}`;", ], invalid: [ @@ -318,6 +325,7 @@ ruleTester.run('restrict-template-expressions', rule, { column: 30, }, ], + options: [{ allowBoolean: false }], }, { code: ` @@ -331,6 +339,7 @@ ruleTester.run('restrict-template-expressions', rule, { column: 30, }, ], + options: [{ allowNullish: false }], }, { code: ` @@ -360,6 +369,11 @@ ruleTester.run('restrict-template-expressions', rule, { column: 30, }, ], + options: [ + { + allowBoolean: false, + }, + ], }, { options: [{ allowNumber: true, allowBoolean: true, allowNullish: true }], @@ -397,7 +411,14 @@ ruleTester.run('restrict-template-expressions', rule, { ], }, { - options: [{ allowNumber: true, allowBoolean: true, allowNullish: true }], + options: [ + { + allowAny: false, + allowNumber: true, + allowBoolean: true, + allowNullish: true, + }, + ], code: ` function test(arg: T) { return \`arg = \${arg}\`; @@ -418,7 +439,14 @@ ruleTester.run('restrict-template-expressions', rule, { ], }, { - options: [{ allowNumber: true, allowBoolean: true, allowNullish: true }], + options: [ + { + allowAny: false, + allowNumber: true, + allowBoolean: true, + allowNullish: true, + }, + ], code: ` function test(arg: any) { return \`arg = \${arg}\`; diff --git a/packages/eslint-plugin/tests/rules/return-await.test.ts b/packages/eslint-plugin/tests/rules/return-await.test.ts index 6a19ba3c223..ef6c3044c81 100644 --- a/packages/eslint-plugin/tests/rules/return-await.test.ts +++ b/packages/eslint-plugin/tests/rules/return-await.test.ts @@ -1,5 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/return-await'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/semi.test.ts b/packages/eslint-plugin/tests/rules/semi.test.ts index f0a856d68dd..e1f53043a9c 100644 --- a/packages/eslint-plugin/tests/rules/semi.test.ts +++ b/packages/eslint-plugin/tests/rules/semi.test.ts @@ -3,11 +3,11 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../src/rules/semi'; import rule from '../../src/rules/semi'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts index 42f9ab8153a..e1a2afc3828 100644 --- a/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts +++ b/packages/eslint-plugin/tests/rules/sort-type-constituents.test.ts @@ -1,3 +1,4 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { @@ -5,13 +6,12 @@ import type { Options, } from '../../src/rules/sort-type-constituents'; import rule from '../../src/rules/sort-type-constituents'; -import { noFormat, RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const valid = (operator: '|' | '&'): TSESLint.ValidTestCase[] => [ +const valid = (operator: '&' | '|'): TSESLint.ValidTestCase[] => [ { code: `type T = A ${operator} B;`, }, @@ -86,7 +86,7 @@ type T = }, ]; const invalid = ( - operator: '|' | '&', + operator: '&' | '|', ): TSESLint.InvalidTestCase[] => { const type = operator === '|' ? 'Union' : 'Intersection'; return [ diff --git a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts b/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts deleted file mode 100644 index 6242d140634..00000000000 --- a/packages/eslint-plugin/tests/rules/sort-type-union-intersection-members.test.ts +++ /dev/null @@ -1,380 +0,0 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - -import type { - MessageIds, - Options, -} from '../../src/rules/sort-type-union-intersection-members'; -import rule from '../../src/rules/sort-type-union-intersection-members'; -import { noFormat, RuleTester } from '../RuleTester'; - -const ruleTester = new RuleTester({ - parser: '@typescript-eslint/parser', -}); - -const valid = (operator: '|' | '&'): TSESLint.ValidTestCase[] => [ - { - code: `type T = A ${operator} B;`, - }, - { - code: `type T = A ${operator} /* comment */ B;`, - }, - { - code: `type T = 'A' ${operator} 'B';`, - }, - { - code: `type T = 1 ${operator} 2;`, - }, - { - code: noFormat`type T = (A) ${operator} (B);`, - }, - { - code: `type T = { a: string } ${operator} { b: string };`, - }, - { - code: `type T = [1, 2, 3] ${operator} [1, 2, 4];`, - }, - { - code: `type T = (() => string) ${operator} (() => void);`, - }, - { - code: `type T = () => string ${operator} void;`, - }, - { - // testing the default ordering - code: noFormat` -type T = - ${operator} A - ${operator} B - ${operator} C.D - ${operator} D.E - ${operator} intrinsic - ${operator} number[] - ${operator} string[] - ${operator} any - ${operator} string - ${operator} symbol - ${operator} this - ${operator} readonly number[] - ${operator} readonly string[] - ${operator} 'a' - ${operator} 'b' - ${operator} "a" - ${operator} "b" - ${operator} (() => string) - ${operator} (() => void) - ${operator} (new () => string) - ${operator} (new () => void) - ${operator} import('bar') - ${operator} import('foo') - ${operator} (number extends string ? unknown : never) - ${operator} (string extends string ? unknown : never) - ${operator} { [a in string]: string } - ${operator} { [a: string]: string } - ${operator} { [b in string]: string } - ${operator} { [b: string]: string } - ${operator} { a: string } - ${operator} { b: string } - ${operator} [1, 2, 3] - ${operator} [1, 2, 4] - ${operator} (A & B) - ${operator} (B & C) - ${operator} (A | B) - ${operator} (B | C) - ${operator} null - ${operator} undefined - `, - }, -]; -const invalid = ( - operator: '|' | '&', -): TSESLint.InvalidTestCase[] => { - const type = operator === '|' ? 'Union' : 'Intersection'; - return [ - { - code: `type T = B ${operator} A;`, - output: `type T = A ${operator} B;`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = 'B' ${operator} 'A';`, - output: `type T = 'A' ${operator} 'B';`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = 2 ${operator} 1;`, - output: `type T = 1 ${operator} 2;`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: noFormat`type T = (B) ${operator} (A);`, - output: `type T = A ${operator} B;`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = { b: string } ${operator} { a: string };`, - output: `type T = { a: string } ${operator} { b: string };`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = [1, 2, 4] ${operator} [1, 2, 3];`, - output: `type T = [1, 2, 3] ${operator} [1, 2, 4];`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = (() => void) ${operator} (() => string);`, - output: `type T = (() => string) ${operator} (() => void);`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = () => void ${operator} string;`, - output: `type T = () => string ${operator} void;`, - errors: [ - { - messageId: 'notSorted', - data: { - type, - }, - }, - ], - }, - { - code: `type T = () => undefined ${operator} null;`, - output: `type T = () => null ${operator} undefined;`, - errors: [ - { - messageId: 'notSorted', - data: { - type, - }, - }, - ], - }, - { - code: noFormat` -type T = - ${operator} [1, 2, 4] - ${operator} [1, 2, 3] - ${operator} { b: string } - ${operator} { a: string } - ${operator} (() => void) - ${operator} (() => string) - ${operator} "b" - ${operator} "a" - ${operator} 'b' - ${operator} 'a' - ${operator} readonly string[] - ${operator} readonly number[] - ${operator} string[] - ${operator} number[] - ${operator} D.E - ${operator} C.D - ${operator} B - ${operator} A - ${operator} undefined - ${operator} null - ${operator} string - ${operator} any; - `, - output: ` -type T = - A ${operator} B ${operator} C.D ${operator} D.E ${operator} number[] ${operator} string[] ${operator} any ${operator} string ${operator} readonly number[] ${operator} readonly string[] ${operator} 'a' ${operator} 'b' ${operator} "a" ${operator} "b" ${operator} (() => string) ${operator} (() => void) ${operator} { a: string } ${operator} { b: string } ${operator} [1, 2, 3] ${operator} [1, 2, 4] ${operator} null ${operator} undefined; - `, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = B ${operator} /* comment */ A;`, - output: null, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - suggestions: [ - { - messageId: 'suggestFix', - output: `type T = A ${operator} B;`, - }, - ], - }, - ], - }, - { - code: `type T = (() => /* comment */ A) ${operator} B;`, - output: `type T = B ${operator} (() => /* comment */ A);`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - suggestions: null, - }, - ], - }, - { - code: `type Expected = (new (x: number) => boolean) ${operator} string;`, - output: `type Expected = string ${operator} (new (x: number) => boolean);`, - errors: [ - { - messageId: 'notSortedNamed', - }, - ], - }, - { - code: `type T = (| A) ${operator} B;`, - output: `type T = B ${operator} (| A);`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - { - code: `type T = (& A) ${operator} B;`, - output: `type T = B ${operator} (& A);`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type, - name: 'T', - }, - }, - ], - }, - ]; -}; - -ruleTester.run('sort-type-union-intersection-members', rule, { - valid: [ - ...valid('|'), - { - code: 'type T = B | A;', - options: [ - { - checkUnions: false, - }, - ], - }, - - ...valid('&'), - { - code: 'type T = B & A;', - options: [ - { - checkIntersections: false, - }, - ], - }, - - { - code: noFormat` -type T = [1] | 'a' | 'b' | "b" | 1 | 2 | {}; - `, - options: [ - { - groupOrder: ['tuple', 'literal', 'object'], - }, - ], - }, - { - // if not specified - groups should be placed last - code: ` -type T = 1 | string | {} | A; - `, - options: [ - { - groupOrder: ['literal', 'keyword'], - }, - ], - }, - ], - invalid: [ - ...invalid('|'), - ...invalid('&'), - { - code: 'type T = (B | C) & A;', - output: `type T = A & (B | C);`, - errors: [ - { - messageId: 'notSortedNamed', - data: { - type: 'Intersection', - name: 'T', - }, - }, - ], - }, - ], -}); diff --git a/packages/eslint-plugin/tests/rules/space-before-blocks.test.ts b/packages/eslint-plugin/tests/rules/space-before-blocks.test.ts index 7e1338c6fc5..193dc06b505 100644 --- a/packages/eslint-plugin/tests/rules/space-before-blocks.test.ts +++ b/packages/eslint-plugin/tests/rules/space-before-blocks.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/space-before-blocks'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts b/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts index 065b36b0c09..35b19dfa2be 100644 --- a/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts +++ b/packages/eslint-plugin/tests/rules/space-before-function-paren.test.ts @@ -3,10 +3,10 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import rule from '../../src/rules/space-before-function-paren'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts b/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts index 37060fab745..61bb6b08c1f 100644 --- a/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts +++ b/packages/eslint-plugin/tests/rules/space-infix-ops.test.ts @@ -3,8 +3,9 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/space-infix-ops'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts index 1e33bae9889..65878e2d17f 100644 --- a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts @@ -1,3 +1,6 @@ +/* eslint-disable deprecation/deprecation -- TODO - migrate this test away from `batchedSingleLineTests` */ + +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; import * as path from 'path'; import type { @@ -5,12 +8,7 @@ import type { Options, } from '../../src/rules/strict-boolean-expressions'; import rule from '../../src/rules/strict-boolean-expressions'; -import { - batchedSingleLineTests, - getFixturesRootDir, - noFormat, - RuleTester, -} from '../RuleTester'; +import { batchedSingleLineTests, getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ @@ -24,114 +22,200 @@ const ruleTester = new RuleTester({ ruleTester.run('strict-boolean-expressions', rule, { valid: [ // boolean in boolean context - ...batchedSingleLineTests({ - code: noFormat` - true ? "a" : "b"; - if (false) {} - while (true) {} - for (; false;) {} - !true; - false || 123; - true && "foo"; - !(false || true); - true && false ? true : false; - false && true || false; - false && true || []; - (false && 1) || (true && 2); - declare const x: boolean; if (x) {} - (x: boolean) => !x; - (x: T) => x ? 1 : 0; - declare const x: never; if (x) {} - `, - }), + "true ? 'a' : 'b';", + ` +if (false) { +} + `, + 'while (true) {}', + 'for (; false; ) {}', + '!true;', + 'false || 123;', + "true && 'foo';", + '!(false || true);', + 'true && false ? true : false;', + '(false && true) || false;', + '(false && true) || [];', + '(false && 1) || (true && 2);', + ` +declare const x: boolean; +if (x) { +} + `, + '(x: boolean) => !x;', + '(x: T) => (x ? 1 : 0);', + ` +declare const x: never; +if (x) { +} + `, // string in boolean context - ...batchedSingleLineTests({ - code: noFormat` - if ("") {} - while ("x") {} - for (; "";) {} - "" && "1" || x; - declare const x: string; if (x) {} - (x: string) => !x; - (x: T) => x ? 1 : 0; - `, - }), + ` +if ('') { +} + `, + "while ('x') {}", + "for (; ''; ) {}", + "('' && '1') || x;", + ` +declare const x: string; +if (x) { +} + `, + '(x: string) => !x;', + '(x: T) => (x ? 1 : 0);', // number in boolean context - ...batchedSingleLineTests({ - code: noFormat` - if (0) {} - while (1n) {} - for (; Infinity;) {} - 0 / 0 && 1 + 2 || x; - declare const x: number; if (x) {} - (x: bigint) => !x; - (x: T) => x ? 1 : 0; - `, - }), + ` +if (0) { +} + `, + 'while (1n) {}', + 'for (; Infinity; ) {}', + '(0 / 0 && 1 + 2) || x;', + ` +declare const x: number; +if (x) { +} + `, + '(x: bigint) => !x;', + '(x: T) => (x ? 1 : 0);', // nullable object in boolean context - ...batchedSingleLineTests({ - code: noFormat` - declare const x: null | object; if (x) {} - (x?: { a: any }) => !x; - (x: T) => x ? 1 : 0; - `, - }), + ` +declare const x: null | object; +if (x) { +} + `, + '(x?: { a: any }) => !x;', + '(x: T) => (x ? 1 : 0);', // nullable boolean in boolean context - ...batchedSingleLineTests({ + { options: [{ allowNullableBoolean: true }], - code: noFormat` - declare const x: boolean | null; if (x) {} + code: ` + declare const x: boolean | null; + if (x) { + } + `, + }, + { + options: [{ allowNullableBoolean: true }], + code: ` (x?: boolean) => !x; - (x: T) => x ? 1 : 0; `, - }), + }, + { + options: [{ allowNullableBoolean: true }], + code: ` + (x: T) => (x ? 1 : 0); + `, + }, // nullable string in boolean context - ...batchedSingleLineTests({ + { options: [{ allowNullableString: true }], - code: noFormat` - declare const x: string | null; if (x) {} + code: ` + declare const x: string | null; + if (x) { + } + `, + }, + { + options: [{ allowNullableString: true }], + code: ` (x?: string) => !x; - (x: T) => x ? 1 : 0; `, - }), + }, + { + options: [{ allowNullableString: true }], + code: ` + (x: T) => (x ? 1 : 0); + `, + }, // nullable number in boolean context - ...batchedSingleLineTests({ + { options: [{ allowNullableNumber: true }], - code: noFormat` - declare const x: number | null; if (x) {} + code: ` + declare const x: number | null; + if (x) { + } + `, + }, + { + options: [{ allowNullableNumber: true }], + code: ` (x?: number) => !x; - (x: T) => x ? 1 : 0; `, - }), + }, + { + options: [{ allowNullableNumber: true }], + code: ` + (x: T) => (x ? 1 : 0); + `, + }, // any in boolean context - ...batchedSingleLineTests({ + { options: [{ allowAny: true }], - code: noFormat` - declare const x: any; if (x) {} - (x) => !x; - (x: T) => x ? 1 : 0; + code: ` + declare const x: any; + if (x) { + } `, - }), + }, + { + options: [{ allowAny: true }], + code: ` + x => !x; + `, + }, + { + options: [{ allowAny: true }], + code: ` + (x: T) => (x ? 1 : 0); + `, + }, // logical operator - ...batchedSingleLineTests({ + { options: [{ allowString: true, allowNumber: true }], code: ` 1 && true && 'x' && {}; + `, + }, + { + options: [{ allowString: true, allowNumber: true }], + code: ` let x = 0 || false || '' || null; + `, + }, + { + options: [{ allowString: true, allowNumber: true }], + code: ` if (1 && true && 'x') void 0; + `, + }, + { + options: [{ allowString: true, allowNumber: true }], + code: ` if (0 || false || '') void 0; + `, + }, + { + options: [{ allowString: true, allowNumber: true }], + code: ` 1 && true && 'x' ? {} : null; + `, + }, + { + options: [{ allowString: true, allowNumber: true }], + code: ` 0 || false || '' ? null : {}; `, - }), + }, // nullable enum in boolean context { @@ -198,6 +282,53 @@ ruleTester.run('strict-boolean-expressions', rule, { `, options: [{ allowNullableEnum: true }], }, + + // nullable mixed enum in boolean context + { + // falsy number and truthy string + code: ` + enum ExampleEnum { + This = 0, + That = 'one', + } + (value?: ExampleEnum) => (value ? 1 : 0); + `, + options: [{ allowNullableEnum: true }], + }, + { + // falsy string and truthy number + code: ` + enum ExampleEnum { + This = '', + That = 1, + } + (value?: ExampleEnum) => (!value ? 1 : 0); + `, + options: [{ allowNullableEnum: true }], + }, + { + // truthy string and truthy number + code: ` + enum ExampleEnum { + This = 'this', + That = 1, + } + (value?: ExampleEnum) => (!value ? 1 : 0); + `, + options: [{ allowNullableEnum: true }], + }, + { + // falsy string and falsy number + code: ` + enum ExampleEnum { + This = '', + That = 0, + } + (value?: ExampleEnum) => (!value ? 1 : 0); + `, + options: [{ allowNullableEnum: true }], + }, + { code: ` declare const x: string[] | null; @@ -1287,6 +1418,117 @@ if (y) { } `, }, + + // nullable mixed enum in boolean context + { + // falsy number and truthy string + options: [{ allowNullableEnum: false }], + code: ` + enum ExampleEnum { + This = 0, + That = 'one', + } + (value?: ExampleEnum) => (value ? 1 : 0); + `, + errors: [ + { + line: 6, + column: 35, + messageId: 'conditionErrorNullableEnum', + endLine: 6, + endColumn: 40, + }, + ], + output: ` + enum ExampleEnum { + This = 0, + That = 'one', + } + (value?: ExampleEnum) => ((value != null) ? 1 : 0); + `, + }, + { + // falsy string and truthy number + options: [{ allowNullableEnum: false }], + code: ` + enum ExampleEnum { + This = '', + That = 1, + } + (value?: ExampleEnum) => (!value ? 1 : 0); + `, + errors: [ + { + line: 6, + column: 36, + messageId: 'conditionErrorNullableEnum', + endLine: 6, + endColumn: 41, + }, + ], + output: ` + enum ExampleEnum { + This = '', + That = 1, + } + (value?: ExampleEnum) => ((value == null) ? 1 : 0); + `, + }, + { + // truthy string and truthy number + options: [{ allowNullableEnum: false }], + code: ` + enum ExampleEnum { + This = 'this', + That = 1, + } + (value?: ExampleEnum) => (!value ? 1 : 0); + `, + errors: [ + { + line: 6, + column: 36, + messageId: 'conditionErrorNullableEnum', + endLine: 6, + endColumn: 41, + }, + ], + output: ` + enum ExampleEnum { + This = 'this', + That = 1, + } + (value?: ExampleEnum) => ((value == null) ? 1 : 0); + `, + }, + { + // falsy string and falsy number + options: [{ allowNullableEnum: false }], + code: ` + enum ExampleEnum { + This = '', + That = 0, + } + (value?: ExampleEnum) => (!value ? 1 : 0); + `, + errors: [ + { + line: 6, + column: 36, + messageId: 'conditionErrorNullableEnum', + endLine: 6, + endColumn: 41, + }, + ], + output: ` + enum ExampleEnum { + This = '', + That = 0, + } + (value?: ExampleEnum) => ((value == null) ? 1 : 0); + `, + }, + // any in boolean context ...batchedSingleLineTests({ code: noFormat` diff --git a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts index 747323bd486..b250a09e2bb 100644 --- a/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts +++ b/packages/eslint-plugin/tests/rules/switch-exhaustiveness-check.test.ts @@ -1,7 +1,7 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import path from 'path'; import switchExhaustivenessCheck from '../../src/rules/switch-exhaustiveness-check'; -import { RuleTester } from '../RuleTester'; const rootPath = path.join(process.cwd(), 'tests/fixtures/'); diff --git a/packages/eslint-plugin/tests/rules/triple-slash-reference.test.ts b/packages/eslint-plugin/tests/rules/triple-slash-reference.test.ts index 8dd71212fbb..5c0c7d482cc 100644 --- a/packages/eslint-plugin/tests/rules/triple-slash-reference.test.ts +++ b/packages/eslint-plugin/tests/rules/triple-slash-reference.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/triple-slash-reference'; -import { RuleTester } from '../RuleTester'; const ruleTester = new RuleTester({ parserOptions: { diff --git a/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts b/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts index 17fb23c7771..ff745515c4b 100644 --- a/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts +++ b/packages/eslint-plugin/tests/rules/type-annotation-spacing.test.ts @@ -3,6 +3,7 @@ /* eslint "@typescript-eslint/internal/plugin-test-formatting": ["error", { formatWithPrettier: false }] */ /* eslint-enable eslint-comments/no-use */ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import rule from '../../src/rules/type-annotation-spacing'; @@ -10,7 +11,6 @@ import type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule, } from '../../src/util'; -import { RuleTester } from '../RuleTester'; type MessageIds = InferMessageIdsTypeFromRule; type Options = InferOptionsTypeFromRule; diff --git a/packages/eslint-plugin/tests/rules/typedef.test.ts b/packages/eslint-plugin/tests/rules/typedef.test.ts index 3a58eb1387a..79dcaa9b193 100644 --- a/packages/eslint-plugin/tests/rules/typedef.test.ts +++ b/packages/eslint-plugin/tests/rules/typedef.test.ts @@ -1,5 +1,7 @@ +import { noFormat, RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/typedef'; -import { getFixturesRootDir, noFormat, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootDir = getFixturesRootDir(); const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 49b06a4ac50..9eb2b73b22c 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -1,8 +1,9 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint } from '@typescript-eslint/utils'; import type { MessageIds, Options } from '../../src/rules/unbound-method'; import rule from '../../src/rules/unbound-method'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rootPath = getFixturesRootDir(); diff --git a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts index 9bd8a07e997..dcc16c7a196 100644 --- a/packages/eslint-plugin/tests/rules/unified-signatures.test.ts +++ b/packages/eslint-plugin/tests/rules/unified-signatures.test.ts @@ -1,5 +1,6 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; + import rule from '../../src/rules/unified-signatures'; -import { RuleTester } from '../RuleTester'; //------------------------------------------------------------------------------ // Tests @@ -169,6 +170,36 @@ function f(a: number | string): void {} }, { code: ` +function f(m: number): void; +function f(v: number, u: string): void; +function f(v: number, u?: string): void {} + `, + options: [{ ignoreDifferentlyNamedParameters: true }], + }, + { + code: ` +function f(v: boolean): number; +function f(): string; + `, + options: [{ ignoreDifferentlyNamedParameters: true }], + }, + { + code: ` +function f(v: boolean, u: boolean): number; +function f(v: boolean): string; + `, + options: [{ ignoreDifferentlyNamedParameters: true }], + }, + { + code: ` +function f(v: number, u?: string): void {} +function f(v: number): void; +function f(): string; + `, + options: [{ ignoreDifferentlyNamedParameters: true }], + }, + { + code: ` function f(a: boolean, ...c: number[]): void; function f(a: boolean, ...d: string[]): void; function f(a: boolean, ...c: (number | string)[]): void {} @@ -678,68 +709,6 @@ interface IFoo { }, ], }, - { - // Works with parameter properties. Note that this is invalid TypeScript syntax. - code: ` -class Foo { - constructor(readonly x: number); - constructor(readonly x: string); -} - `, - errors: [ - { - messageId: 'singleParameterDifference', - data: { - failureStringStart: - 'These overloads can be combined into one signature', - type1: 'number', - type2: 'string', - }, - line: 4, - column: 15, - }, - ], - }, - { - // Works with parameter properties. Note that this is invalid TypeScript syntax. - code: ` -class Foo { - constructor(readonly x: number); - constructor(readonly x: number, readonly y: string); -} - `, - errors: [ - { - messageId: 'omittingSingleParameter', - data: { - failureStringStart: - 'These overloads can be combined into one signature', - }, - line: 4, - column: 35, - }, - ], - }, - { - // Works with parameter properties. Note that this is invalid TypeScript syntax. - code: ` -class Foo { - constructor(readonly x: number); - constructor(readonly x: number, readonly y?: string, readonly z?: string); -} - `, - errors: [ - { - messageId: 'omittingSingleParameter', - data: { - failureStringStart: - 'These overloads can be combined into one signature', - }, - line: 4, - column: 56, - }, - ], - }, { code: ` export function foo(line: number): number; diff --git a/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot b/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot new file mode 100644 index 00000000000..ee8e4edeee5 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/adjacent-overload-signatures.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes adjacent-overload-signatures 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/array-type.shot b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot new file mode 100644 index 00000000000..4f46cb9a726 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/array-type.shot @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes array-type 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "arrayOption": { + "enum": ["array", "array-simple", "generic"], + "type": "string" + } + }, + "additionalProperties": false, + "properties": { + "default": { + "$ref": "#/items/0/$defs/arrayOption", + "description": "The array type expected for mutable cases." + }, + "readonly": { + "$ref": "#/items/0/$defs/arrayOption", + "description": "The array type expected for readonly cases. If omitted, the value for \`default\` will be used." + } + }, + "type": "object" + } +] + + +# TYPES: + +type ArrayOption = 'array' | 'array-simple' | 'generic'; + +type Options = [ + { + /** The array type expected for mutable cases. */ + default?: ArrayOption; + /** The array type expected for readonly cases. If omitted, the value for \`default\` will be used. */ + readonly?: ArrayOption; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot b/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot new file mode 100644 index 00000000000..ac87bfd93ca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/await-thenable.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes await-thenable 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot new file mode 100644 index 00000000000..a39ac4e59b3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-ts-comment.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes ban-ts-comment 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "directiveConfigSchema": { + "oneOf": [ + { + "default": true, + "type": "boolean" + }, + { + "enum": ["allow-with-description"], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "descriptionFormat": { + "type": "string" + } + }, + "type": "object" + } + ] + } + }, + "additionalProperties": false, + "properties": { + "minimumDescriptionLength": { + "default": 3, + "type": "number" + }, + "ts-check": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + }, + "ts-expect-error": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + }, + "ts-ignore": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + }, + "ts-nocheck": { + "$ref": "#/items/0/$defs/directiveConfigSchema" + } + }, + "type": "object" + } +] + + +# TYPES: + +type DirectiveConfigSchema = + | 'allow-with-description' + | { + descriptionFormat?: string; + } + | boolean; + +type Options = [ + { + 'ts-check'?: DirectiveConfigSchema; + 'ts-expect-error'?: DirectiveConfigSchema; + 'ts-ignore'?: DirectiveConfigSchema; + 'ts-nocheck'?: DirectiveConfigSchema; + minimumDescriptionLength?: number; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot new file mode 100644 index 00000000000..2a45126d783 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-tslint-comment.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes ban-tslint-comment 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot new file mode 100644 index 00000000000..a7fe2d555cd --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/ban-types.shot @@ -0,0 +1,103 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes ban-types 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "banConfig": { + "oneOf": [ + { + "description": "Bans the type with the default message", + "type": "null" + }, + { + "description": "Un-bans the type (useful when paired with \`extendDefaults\`)", + "enum": [false], + "type": "boolean" + }, + { + "description": "Bans the type with the default message", + "enum": [true], + "type": "boolean" + }, + { + "description": "Bans the type with a custom message", + "type": "string" + }, + { + "additionalProperties": false, + "description": "Bans a type", + "properties": { + "fixWith": { + "description": "Type to autofix replace with. Note that autofixers can be applied automatically - so you need to be careful with this option.", + "type": "string" + }, + "message": { + "description": "Custom error message", + "type": "string" + }, + "suggest": { + "additionalItems": false, + "description": "Types to suggest replacing with.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } + ] + } + }, + "additionalProperties": false, + "properties": { + "extendDefaults": { + "type": "boolean" + }, + "types": { + "additionalProperties": { + "$ref": "#/items/0/$defs/banConfig" + }, + "type": "object" + } + }, + "type": "object" + } +] + + +# TYPES: + +type BanConfig = + /** Bans a type */ + | { + /** Type to autofix replace with. Note that autofixers can be applied automatically - so you need to be careful with this option. */ + fixWith?: string; + /** Custom error message */ + message?: string; + /** Types to suggest replacing with. */ + suggest?: string[]; + } + /** Bans the type with a custom message */ + | string + /** Bans the type with the default message */ + | null + /** Bans the type with the default message */ + | true + /** Un-bans the type (useful when paired with \`extendDefaults\`) */ + | false; + +type Options = [ + { + extendDefaults?: boolean; + types?: { + [k: string]: BanConfig; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot new file mode 100644 index 00000000000..f36ea49fa82 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/block-spacing.shot @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes block-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["always", "never"] + } +] + + +# TYPES: + +type Options = ['always' | 'never']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot new file mode 100644 index 00000000000..1418bafb13e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/brace-style.shot @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes brace-style 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["1tbs", "allman", "stroustrup"] + }, + { + "additionalProperties": false, + "properties": { + "allowSingleLine": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + '1tbs' | 'allman' | 'stroustrup', + { + allowSingleLine?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot b/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot new file mode 100644 index 00000000000..ab5b34c1d89 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/class-literal-property-style.shot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes class-literal-property-style 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["fields", "getters"], + "type": "string" + } +] + + +# TYPES: + +type Options = ['fields' | 'getters']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot new file mode 100644 index 00000000000..645b7ce040f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-dangle.shot @@ -0,0 +1,95 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes comma-dangle 1`] = ` +" +# SCHEMA: + +{ + "$defs": { + "value": { + "enum": ["always", "always-multiline", "never", "only-multiline"], + "type": "string" + }, + "valueWithIgnore": { + "enum": [ + "always", + "always-multiline", + "ignore", + "never", + "only-multiline" + ], + "type": "string" + } + }, + "additionalItems": false, + "items": [ + { + "oneOf": [ + { + "$ref": "#/$defs/value" + }, + { + "additionalProperties": false, + "properties": { + "arrays": { + "$ref": "#/$defs/valueWithIgnore" + }, + "enums": { + "$ref": "#/$defs/valueWithIgnore" + }, + "exports": { + "$ref": "#/$defs/valueWithIgnore" + }, + "functions": { + "$ref": "#/$defs/valueWithIgnore" + }, + "generics": { + "$ref": "#/$defs/valueWithIgnore" + }, + "imports": { + "$ref": "#/$defs/valueWithIgnore" + }, + "objects": { + "$ref": "#/$defs/valueWithIgnore" + }, + "tuples": { + "$ref": "#/$defs/valueWithIgnore" + } + }, + "type": "object" + } + ] + } + ], + "type": "array" +} + + +# TYPES: + +type Value = 'always' | 'always-multiline' | 'never' | 'only-multiline'; + +type ValueWithIgnore = + | 'always' + | 'always-multiline' + | 'ignore' + | 'never' + | 'only-multiline'; + +type Options = + | [] + | [ + | { + arrays?: ValueWithIgnore; + enums?: ValueWithIgnore; + exports?: ValueWithIgnore; + functions?: ValueWithIgnore; + generics?: ValueWithIgnore; + imports?: ValueWithIgnore; + objects?: ValueWithIgnore; + tuples?: ValueWithIgnore; + } + | Value, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot new file mode 100644 index 00000000000..5399369fee5 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/comma-spacing.shot @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes comma-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "after": { + "default": true, + "type": "boolean" + }, + "before": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + after?: boolean; + before?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot new file mode 100644 index 00000000000..339f564088a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-generic-constructors.shot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-generic-constructors 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["constructor", "type-annotation"], + "type": "string" + } +] + + +# TYPES: + +type Options = ['constructor' | 'type-annotation']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot new file mode 100644 index 00000000000..d498aa9d357 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-indexed-object-style.shot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-indexed-object-style 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["index-signature", "record"], + "type": "string" + } +] + + +# TYPES: + +type Options = ['index-signature' | 'record']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot new file mode 100644 index 00000000000..b50dc807a9b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-assertions.shot @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-assertions 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "assertionStyle": { + "enum": ["never"], + "type": "string" + } + }, + "required": ["assertionStyle"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "assertionStyle": { + "enum": ["angle-bracket", "as"], + "type": "string" + }, + "objectLiteralTypeAssertions": { + "enum": ["allow", "allow-as-parameter", "never"], + "type": "string" + } + }, + "required": ["assertionStyle"], + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + | { + assertionStyle: 'angle-bracket' | 'as'; + objectLiteralTypeAssertions?: 'allow' | 'allow-as-parameter' | 'never'; + } + | { + assertionStyle: 'never'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot new file mode 100644 index 00000000000..0a721742384 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-definitions.shot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-definitions 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["interface", "type"], + "type": "string" + } +] + + +# TYPES: + +type Options = ['interface' | 'type']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot new file mode 100644 index 00000000000..1ad2d951194 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-exports.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-exports 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "fixMixedExportsWithInlineTypeSpecifier": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + fixMixedExportsWithInlineTypeSpecifier?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot new file mode 100644 index 00000000000..7164fbdd367 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/consistent-type-imports.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes consistent-type-imports 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "disallowTypeAnnotations": { + "type": "boolean" + }, + "fixStyle": { + "enum": ["inline-type-imports", "separate-type-imports"], + "type": "string" + }, + "prefer": { + "enum": ["no-type-imports", "type-imports"], + "type": "string" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + disallowTypeAnnotations?: boolean; + fixStyle?: 'inline-type-imports' | 'separate-type-imports'; + prefer?: 'no-type-imports' | 'type-imports'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot b/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot new file mode 100644 index 00000000000..dccc9316644 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/default-param-last.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes default-param-last 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot new file mode 100644 index 00000000000..73c0dcdad74 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/dot-notation.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes dot-notation 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowIndexSignaturePropertyAccess": { + "default": false, + "type": "boolean" + }, + "allowKeywords": { + "default": true, + "type": "boolean" + }, + "allowPattern": { + "default": "", + "type": "string" + }, + "allowPrivateClassPropertyAccess": { + "default": false, + "type": "boolean" + }, + "allowProtectedClassPropertyAccess": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowIndexSignaturePropertyAccess?: boolean; + allowKeywords?: boolean; + allowPattern?: string; + allowPrivateClassPropertyAccess?: boolean; + allowProtectedClassPropertyAccess?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot new file mode 100644 index 00000000000..9239baf5003 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-function-return-type.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes explicit-function-return-type 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowConciseArrowFunctionExpressionsStartingWithVoid": { + "description": "Whether to allow arrow functions that start with the \`void\` keyword.", + "type": "boolean" + }, + "allowDirectConstAssertionInArrowFunctions": { + "description": "Whether to ignore arrow functions immediately returning a \`as const\` value.", + "type": "boolean" + }, + "allowedNames": { + "description": "An array of function/method names that will not have their arguments or return values checked.", + "items": { + "type": "string" + }, + "type": "array" + }, + "allowExpressions": { + "description": "Whether to ignore function expressions (functions which are not part of a declaration).", + "type": "boolean" + }, + "allowFunctionsWithoutTypeParameters": { + "description": "Whether to ignore functions that don't have generic type parameters.", + "type": "boolean" + }, + "allowHigherOrderFunctions": { + "description": "Whether to ignore functions immediately returning another function expression.", + "type": "boolean" + }, + "allowIIFEs": { + "description": "Whether to ignore immediately invoked function expressions (IIFEs).", + "type": "boolean" + }, + "allowTypedFunctionExpressions": { + "description": "Whether to ignore type annotations on the variable of function expressions.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow arrow functions that start with the \`void\` keyword. */ + allowConciseArrowFunctionExpressionsStartingWithVoid?: boolean; + /** Whether to ignore arrow functions immediately returning a \`as const\` value. */ + allowDirectConstAssertionInArrowFunctions?: boolean; + /** Whether to ignore function expressions (functions which are not part of a declaration). */ + allowExpressions?: boolean; + /** Whether to ignore functions that don't have generic type parameters. */ + allowFunctionsWithoutTypeParameters?: boolean; + /** Whether to ignore functions immediately returning another function expression. */ + allowHigherOrderFunctions?: boolean; + /** Whether to ignore immediately invoked function expressions (IIFEs). */ + allowIIFEs?: boolean; + /** Whether to ignore type annotations on the variable of function expressions. */ + allowTypedFunctionExpressions?: boolean; + /** An array of function/method names that will not have their arguments or return values checked. */ + allowedNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot new file mode 100644 index 00000000000..5a33d7fca21 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-member-accessibility.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes explicit-member-accessibility 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "accessibilityLevel": { + "oneOf": [ + { + "description": "Always require an accessor.", + "enum": ["explicit"], + "type": "string" + }, + { + "description": "Require an accessor except when public.", + "enum": ["no-public"], + "type": "string" + }, + { + "description": "Never check whether there is an accessor.", + "enum": ["off"], + "type": "string" + } + ] + } + }, + "additionalProperties": false, + "properties": { + "accessibility": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "ignoredMethodNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "overrides": { + "additionalProperties": false, + "properties": { + "accessors": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "constructors": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "methods": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "parameterProperties": { + "$ref": "#/items/0/$defs/accessibilityLevel" + }, + "properties": { + "$ref": "#/items/0/$defs/accessibilityLevel" + } + }, + "type": "object" + } + }, + "type": "object" + } +] + + +# TYPES: + +type AccessibilityLevel = + /** Always require an accessor. */ + | 'explicit' + /** Never check whether there is an accessor. */ + | 'off' + /** Require an accessor except when public. */ + | 'no-public'; + +type Options = [ + { + accessibility?: AccessibilityLevel; + ignoredMethodNames?: string[]; + overrides?: { + accessors?: AccessibilityLevel; + constructors?: AccessibilityLevel; + methods?: AccessibilityLevel; + parameterProperties?: AccessibilityLevel; + properties?: AccessibilityLevel; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot new file mode 100644 index 00000000000..cd004e5a22b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/explicit-module-boundary-types.shot @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes explicit-module-boundary-types 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowArgumentsExplicitlyTypedAsAny": { + "description": "Whether to ignore arguments that are explicitly typed as \`any\`.", + "type": "boolean" + }, + "allowDirectConstAssertionInArrowFunctions": { + "description": "Whether to ignore return type annotations on body-less arrow functions that return an \`as const\` type assertion.\\nYou must still type the parameters of the function.", + "type": "boolean" + }, + "allowedNames": { + "description": "An array of function/method names that will not have their arguments or return values checked.", + "items": { + "type": "string" + }, + "type": "array" + }, + "allowHigherOrderFunctions": { + "description": "Whether to ignore return type annotations on functions immediately returning another function expression.\\nYou must still type the parameters of the function.", + "type": "boolean" + }, + "allowTypedFunctionExpressions": { + "description": "Whether to ignore type annotations on the variable of a function expresion.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore arguments that are explicitly typed as \`any\`. */ + allowArgumentsExplicitlyTypedAsAny?: boolean; + /** + * Whether to ignore return type annotations on body-less arrow functions that return an \`as const\` type assertion. + * You must still type the parameters of the function. + */ + allowDirectConstAssertionInArrowFunctions?: boolean; + /** + * Whether to ignore return type annotations on functions immediately returning another function expression. + * You must still type the parameters of the function. + */ + allowHigherOrderFunctions?: boolean; + /** Whether to ignore type annotations on the variable of a function expresion. */ + allowTypedFunctionExpressions?: boolean; + /** An array of function/method names that will not have their arguments or return values checked. */ + allowedNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot new file mode 100644 index 00000000000..d3192bbdc54 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/func-call-spacing.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes func-call-spacing 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "items": [ + { + "enum": ["never"], + "type": "string" + } + ], + "maxItems": 1, + "minItems": 0, + "type": "array" + }, + { + "items": [ + { + "enum": ["always"], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "allowNewlines": { + "type": "boolean" + } + }, + "type": "object" + } + ], + "maxItems": 2, + "minItems": 0, + "type": "array" + } + ] +} + + +# TYPES: + +type Options = + | [] + | ['always'] + | ['never'] + | [ + 'always', + { + allowNewlines?: boolean; + }, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot new file mode 100644 index 00000000000..2b3d70185b6 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/init-declarations.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes init-declarations 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "items": [ + { + "enum": ["always"] + } + ], + "maxItems": 1, + "minItems": 0, + "type": "array" + }, + { + "items": [ + { + "enum": ["never"] + }, + { + "additionalProperties": false, + "properties": { + "ignoreForLoopInit": { + "type": "boolean" + } + }, + "type": "object" + } + ], + "maxItems": 2, + "minItems": 0, + "type": "array" + } + ] +} + + +# TYPES: + +type Options = + | [] + | ['always'] + | ['never'] + | [ + 'never', + { + ignoreForLoopInit?: boolean; + }, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot new file mode 100644 index 00000000000..d476304884a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/key-spacing.shot @@ -0,0 +1,228 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes key-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "anyOf": [ + { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "align": { + "anyOf": [ + { + "enum": ["colon", "value"] + }, + { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + }, + "on": { + "enum": ["colon", "value"] + } + }, + "type": "object" + } + ] + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } + }, + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "multiLine": { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "align": { + "anyOf": [ + { + "enum": ["colon", "value"] + }, + { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + }, + "on": { + "enum": ["colon", "value"] + } + }, + "type": "object" + } + ] + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } + }, + "type": "object" + }, + "singleLine": { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } + }, + "type": "object" + } + }, + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "align": { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + }, + "on": { + "enum": ["colon", "value"] + } + }, + "type": "object" + }, + "multiLine": { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } + }, + "type": "object" + }, + "singleLine": { + "additionalProperties": false, + "properties": { + "afterColon": { + "type": "boolean" + }, + "beforeColon": { + "type": "boolean" + }, + "mode": { + "enum": ["minimum", "strict"] + } + }, + "type": "object" + } + }, + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + | { + afterColon?: boolean; + align?: + | 'colon' + | 'value' + | { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + on?: 'colon' | 'value'; + }; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + } + | { + align?: { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + on?: 'colon' | 'value'; + }; + multiLine?: { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + }; + singleLine?: { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + }; + } + | { + multiLine?: { + afterColon?: boolean; + align?: + | 'colon' + | 'value' + | { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + on?: 'colon' | 'value'; + }; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + }; + singleLine?: { + afterColon?: boolean; + beforeColon?: boolean; + mode?: 'minimum' | 'strict'; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot new file mode 100644 index 00000000000..1c0d3563df8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/keyword-spacing.shot @@ -0,0 +1,1146 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes keyword-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "after": { + "default": true, + "type": "boolean" + }, + "before": { + "default": true, + "type": "boolean" + }, + "overrides": { + "additionalProperties": false, + "properties": { + "abstract": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "as": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "async": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "await": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "boolean": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "break": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "byte": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "case": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "catch": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "char": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "class": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "const": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "continue": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "debugger": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "default": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "delete": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "do": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "double": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "else": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "enum": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "export": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "extends": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "false": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "final": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "finally": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "float": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "for": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "from": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "function": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "get": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "goto": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "if": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "implements": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "import": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "in": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "instanceof": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "int": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "interface": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "let": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "long": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "native": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "new": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "null": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "of": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "package": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "private": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "protected": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "public": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "return": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "set": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "short": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "static": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "super": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "switch": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "synchronized": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "this": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "throw": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "throws": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "transient": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "true": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "try": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "type": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "typeof": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "var": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "void": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "volatile": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "while": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "with": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + }, + "yield": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + after?: boolean; + before?: boolean; + overrides?: { + abstract?: { + after?: boolean; + before?: boolean; + }; + as?: { + after?: boolean; + before?: boolean; + }; + async?: { + after?: boolean; + before?: boolean; + }; + await?: { + after?: boolean; + before?: boolean; + }; + boolean?: { + after?: boolean; + before?: boolean; + }; + break?: { + after?: boolean; + before?: boolean; + }; + byte?: { + after?: boolean; + before?: boolean; + }; + case?: { + after?: boolean; + before?: boolean; + }; + catch?: { + after?: boolean; + before?: boolean; + }; + char?: { + after?: boolean; + before?: boolean; + }; + class?: { + after?: boolean; + before?: boolean; + }; + const?: { + after?: boolean; + before?: boolean; + }; + continue?: { + after?: boolean; + before?: boolean; + }; + debugger?: { + after?: boolean; + before?: boolean; + }; + default?: { + after?: boolean; + before?: boolean; + }; + delete?: { + after?: boolean; + before?: boolean; + }; + do?: { + after?: boolean; + before?: boolean; + }; + double?: { + after?: boolean; + before?: boolean; + }; + else?: { + after?: boolean; + before?: boolean; + }; + enum?: { + after?: boolean; + before?: boolean; + }; + export?: { + after?: boolean; + before?: boolean; + }; + extends?: { + after?: boolean; + before?: boolean; + }; + false?: { + after?: boolean; + before?: boolean; + }; + final?: { + after?: boolean; + before?: boolean; + }; + finally?: { + after?: boolean; + before?: boolean; + }; + float?: { + after?: boolean; + before?: boolean; + }; + for?: { + after?: boolean; + before?: boolean; + }; + from?: { + after?: boolean; + before?: boolean; + }; + function?: { + after?: boolean; + before?: boolean; + }; + get?: { + after?: boolean; + before?: boolean; + }; + goto?: { + after?: boolean; + before?: boolean; + }; + if?: { + after?: boolean; + before?: boolean; + }; + implements?: { + after?: boolean; + before?: boolean; + }; + import?: { + after?: boolean; + before?: boolean; + }; + in?: { + after?: boolean; + before?: boolean; + }; + instanceof?: { + after?: boolean; + before?: boolean; + }; + int?: { + after?: boolean; + before?: boolean; + }; + interface?: { + after?: boolean; + before?: boolean; + }; + let?: { + after?: boolean; + before?: boolean; + }; + long?: { + after?: boolean; + before?: boolean; + }; + native?: { + after?: boolean; + before?: boolean; + }; + new?: { + after?: boolean; + before?: boolean; + }; + null?: { + after?: boolean; + before?: boolean; + }; + of?: { + after?: boolean; + before?: boolean; + }; + package?: { + after?: boolean; + before?: boolean; + }; + private?: { + after?: boolean; + before?: boolean; + }; + protected?: { + after?: boolean; + before?: boolean; + }; + public?: { + after?: boolean; + before?: boolean; + }; + return?: { + after?: boolean; + before?: boolean; + }; + set?: { + after?: boolean; + before?: boolean; + }; + short?: { + after?: boolean; + before?: boolean; + }; + static?: { + after?: boolean; + before?: boolean; + }; + super?: { + after?: boolean; + before?: boolean; + }; + switch?: { + after?: boolean; + before?: boolean; + }; + synchronized?: { + after?: boolean; + before?: boolean; + }; + this?: { + after?: boolean; + before?: boolean; + }; + throw?: { + after?: boolean; + before?: boolean; + }; + throws?: { + after?: boolean; + before?: boolean; + }; + transient?: { + after?: boolean; + before?: boolean; + }; + true?: { + after?: boolean; + before?: boolean; + }; + try?: { + after?: boolean; + before?: boolean; + }; + type?: { + after?: boolean; + before?: boolean; + }; + typeof?: { + after?: boolean; + before?: boolean; + }; + var?: { + after?: boolean; + before?: boolean; + }; + void?: { + after?: boolean; + before?: boolean; + }; + volatile?: { + after?: boolean; + before?: boolean; + }; + while?: { + after?: boolean; + before?: boolean; + }; + with?: { + after?: boolean; + before?: boolean; + }; + yield?: { + after?: boolean; + before?: boolean; + }; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot new file mode 100644 index 00000000000..9a683cf8b25 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-around-comment.shot @@ -0,0 +1,118 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes lines-around-comment 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "afterBlockComment": { + "default": false, + "type": "boolean" + }, + "afterLineComment": { + "default": false, + "type": "boolean" + }, + "allowArrayEnd": { + "type": "boolean" + }, + "allowArrayStart": { + "type": "boolean" + }, + "allowBlockEnd": { + "default": false, + "type": "boolean" + }, + "allowBlockStart": { + "default": false, + "type": "boolean" + }, + "allowClassEnd": { + "type": "boolean" + }, + "allowClassStart": { + "type": "boolean" + }, + "allowEnumEnd": { + "type": "boolean" + }, + "allowEnumStart": { + "type": "boolean" + }, + "allowInterfaceEnd": { + "type": "boolean" + }, + "allowInterfaceStart": { + "type": "boolean" + }, + "allowModuleEnd": { + "type": "boolean" + }, + "allowModuleStart": { + "type": "boolean" + }, + "allowObjectEnd": { + "type": "boolean" + }, + "allowObjectStart": { + "type": "boolean" + }, + "allowTypeEnd": { + "type": "boolean" + }, + "allowTypeStart": { + "type": "boolean" + }, + "applyDefaultIgnorePatterns": { + "type": "boolean" + }, + "beforeBlockComment": { + "default": true, + "type": "boolean" + }, + "beforeLineComment": { + "default": false, + "type": "boolean" + }, + "ignorePattern": { + "type": "string" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + afterBlockComment?: boolean; + afterLineComment?: boolean; + allowArrayEnd?: boolean; + allowArrayStart?: boolean; + allowBlockEnd?: boolean; + allowBlockStart?: boolean; + allowClassEnd?: boolean; + allowClassStart?: boolean; + allowEnumEnd?: boolean; + allowEnumStart?: boolean; + allowInterfaceEnd?: boolean; + allowInterfaceStart?: boolean; + allowModuleEnd?: boolean; + allowModuleStart?: boolean; + allowObjectEnd?: boolean; + allowObjectStart?: boolean; + allowTypeEnd?: boolean; + allowTypeStart?: boolean; + applyDefaultIgnorePatterns?: boolean; + beforeBlockComment?: boolean; + beforeLineComment?: boolean; + ignorePattern?: string; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot new file mode 100644 index 00000000000..9e8924e05e8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/lines-between-class-members.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes lines-between-class-members 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["always", "never"] + }, + { + "additionalProperties": false, + "properties": { + "exceptAfterOverload": { + "default": true, + "type": "boolean" + }, + "exceptAfterSingleLine": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + 'always' | 'never', + { + exceptAfterOverload?: boolean; + exceptAfterSingleLine?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot new file mode 100644 index 00000000000..a1c9dcc17ee --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/member-delimiter-style.shot @@ -0,0 +1,132 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes member-delimiter-style 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "delimiterConfig": { + "additionalProperties": false, + "properties": { + "multiline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "$ref": "#/items/0/$defs/multiLineOption" + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + }, + "singleline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "$ref": "#/items/0/$defs/singleLineOption" + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "multiLineOption": { + "enum": ["comma", "none", "semi"], + "type": "string" + }, + "singleLineOption": { + "enum": ["comma", "semi"], + "type": "string" + } + }, + "additionalProperties": false, + "properties": { + "multiline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "$ref": "#/items/0/$defs/multiLineOption" + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + }, + "multilineDetection": { + "enum": ["brackets", "last-member"], + "type": "string" + }, + "overrides": { + "additionalProperties": false, + "properties": { + "interface": { + "$ref": "#/items/0/$defs/delimiterConfig" + }, + "typeLiteral": { + "$ref": "#/items/0/$defs/delimiterConfig" + } + }, + "type": "object" + }, + "singleline": { + "additionalProperties": false, + "properties": { + "delimiter": { + "$ref": "#/items/0/$defs/singleLineOption" + }, + "requireLast": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + } +] + + +# TYPES: + +type MultiLineOption = 'comma' | 'none' | 'semi'; + +type SingleLineOption = 'comma' | 'semi'; + +type DelimiterConfig = { + multiline?: { + delimiter?: MultiLineOption; + requireLast?: boolean; + }; + singleline?: { + delimiter?: SingleLineOption; + requireLast?: boolean; + }; +}; + +type Options = [ + { + multiline?: { + delimiter?: MultiLineOption; + requireLast?: boolean; + }; + multilineDetection?: 'brackets' | 'last-member'; + overrides?: { + interface?: DelimiterConfig; + typeLiteral?: DelimiterConfig; + }; + singleline?: { + delimiter?: SingleLineOption; + requireLast?: boolean; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot new file mode 100644 index 00000000000..d7e2517bb91 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/member-ordering.shot @@ -0,0 +1,495 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes member-ordering 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "allItems": { + "enum": [ + "#private-field", + "#private-get", + "#private-instance-field", + "#private-instance-get", + "#private-instance-method", + "#private-instance-readonly-field", + "#private-instance-set", + "#private-instance-static-initialization", + "#private-method", + "#private-readonly-field", + "#private-set", + "#private-static-field", + "#private-static-get", + "#private-static-method", + "#private-static-readonly-field", + "#private-static-set", + "#private-static-static-initialization", + "abstract-field", + "abstract-get", + "abstract-method", + "abstract-readonly-field", + "abstract-set", + "abstract-static-initialization", + "call-signature", + "constructor", + "decorated-field", + "decorated-get", + "decorated-method", + "decorated-readonly-field", + "decorated-set", + "field", + "get", + "instance-field", + "instance-get", + "instance-method", + "instance-readonly-field", + "instance-set", + "instance-static-initialization", + "method", + "private-constructor", + "private-decorated-field", + "private-decorated-get", + "private-decorated-method", + "private-decorated-readonly-field", + "private-decorated-set", + "private-field", + "private-get", + "private-instance-field", + "private-instance-get", + "private-instance-method", + "private-instance-readonly-field", + "private-instance-set", + "private-instance-static-initialization", + "private-method", + "private-readonly-field", + "private-set", + "private-static-field", + "private-static-get", + "private-static-method", + "private-static-readonly-field", + "private-static-set", + "private-static-static-initialization", + "protected-abstract-field", + "protected-abstract-get", + "protected-abstract-method", + "protected-abstract-readonly-field", + "protected-abstract-set", + "protected-abstract-static-initialization", + "protected-constructor", + "protected-decorated-field", + "protected-decorated-get", + "protected-decorated-method", + "protected-decorated-readonly-field", + "protected-decorated-set", + "protected-field", + "protected-get", + "protected-instance-field", + "protected-instance-get", + "protected-instance-method", + "protected-instance-readonly-field", + "protected-instance-set", + "protected-instance-static-initialization", + "protected-method", + "protected-readonly-field", + "protected-set", + "protected-static-field", + "protected-static-get", + "protected-static-method", + "protected-static-readonly-field", + "protected-static-set", + "protected-static-static-initialization", + "public-abstract-field", + "public-abstract-get", + "public-abstract-method", + "public-abstract-readonly-field", + "public-abstract-set", + "public-abstract-static-initialization", + "public-constructor", + "public-decorated-field", + "public-decorated-get", + "public-decorated-method", + "public-decorated-readonly-field", + "public-decorated-set", + "public-field", + "public-get", + "public-instance-field", + "public-instance-get", + "public-instance-method", + "public-instance-readonly-field", + "public-instance-set", + "public-instance-static-initialization", + "public-method", + "public-readonly-field", + "public-set", + "public-static-field", + "public-static-get", + "public-static-method", + "public-static-readonly-field", + "public-static-set", + "public-static-static-initialization", + "readonly-field", + "readonly-signature", + "set", + "signature", + "static-field", + "static-get", + "static-initialization", + "static-method", + "static-readonly-field", + "static-set", + "static-static-initialization" + ], + "type": "string" + }, + "baseConfig": { + "oneOf": [ + { + "enum": ["never"], + "type": "string" + }, + { + "items": { + "oneOf": [ + { + "$ref": "#/items/0/$defs/allItems" + }, + { + "items": { + "$ref": "#/items/0/$defs/allItems" + }, + "type": "array" + } + ] + }, + "type": "array" + }, + { + "additionalProperties": false, + "properties": { + "memberTypes": { + "oneOf": [ + { + "items": { + "oneOf": [ + { + "$ref": "#/items/0/$defs/allItems" + }, + { + "items": { + "$ref": "#/items/0/$defs/allItems" + }, + "type": "array" + } + ] + }, + "type": "array" + }, + { + "enum": ["never"], + "type": "string" + } + ] + }, + "optionalityOrder": { + "$ref": "#/items/0/$defs/optionalityOrderOptions" + }, + "order": { + "$ref": "#/items/0/$defs/orderOptions" + } + }, + "type": "object" + } + ] + }, + "optionalityOrderOptions": { + "enum": ["optional-first", "required-first"], + "type": "string" + }, + "orderOptions": { + "enum": [ + "alphabetically", + "alphabetically-case-insensitive", + "as-written", + "natural", + "natural-case-insensitive" + ], + "type": "string" + }, + "typeItems": { + "enum": [ + "constructor", + "field", + "method", + "readonly-field", + "readonly-signature", + "signature" + ], + "type": "string" + }, + "typesConfig": { + "oneOf": [ + { + "enum": ["never"], + "type": "string" + }, + { + "items": { + "oneOf": [ + { + "$ref": "#/items/0/$defs/typeItems" + }, + { + "items": { + "$ref": "#/items/0/$defs/typeItems" + }, + "type": "array" + } + ] + }, + "type": "array" + }, + { + "additionalProperties": false, + "properties": { + "memberTypes": { + "oneOf": [ + { + "items": { + "oneOf": [ + { + "$ref": "#/items/0/$defs/typeItems" + }, + { + "items": { + "$ref": "#/items/0/$defs/typeItems" + }, + "type": "array" + } + ] + }, + "type": "array" + }, + { + "enum": ["never"], + "type": "string" + } + ] + }, + "optionalityOrder": { + "$ref": "#/items/0/$defs/optionalityOrderOptions" + }, + "order": { + "$ref": "#/items/0/$defs/orderOptions" + } + }, + "type": "object" + } + ] + } + }, + "additionalProperties": false, + "properties": { + "classes": { + "$ref": "#/items/0/$defs/baseConfig" + }, + "classExpressions": { + "$ref": "#/items/0/$defs/baseConfig" + }, + "default": { + "$ref": "#/items/0/$defs/baseConfig" + }, + "interfaces": { + "$ref": "#/items/0/$defs/typesConfig" + }, + "typeLiterals": { + "$ref": "#/items/0/$defs/typesConfig" + } + }, + "type": "object" + } +] + + +# TYPES: + +type OrderOptions = + | 'alphabetically' + | 'alphabetically-case-insensitive' + | 'as-written' + | 'natural' + | 'natural-case-insensitive'; + +type OptionalityOrderOptions = 'optional-first' | 'required-first'; + +type AllItems = + | '#private-field' + | '#private-get' + | '#private-instance-field' + | '#private-instance-get' + | '#private-instance-method' + | '#private-instance-readonly-field' + | '#private-instance-set' + | '#private-instance-static-initialization' + | '#private-method' + | '#private-readonly-field' + | '#private-set' + | '#private-static-field' + | '#private-static-get' + | '#private-static-method' + | '#private-static-readonly-field' + | '#private-static-set' + | '#private-static-static-initialization' + | 'abstract-field' + | 'abstract-get' + | 'abstract-method' + | 'abstract-readonly-field' + | 'abstract-set' + | 'abstract-static-initialization' + | 'call-signature' + | 'constructor' + | 'decorated-field' + | 'decorated-get' + | 'decorated-method' + | 'decorated-readonly-field' + | 'decorated-set' + | 'field' + | 'get' + | 'instance-field' + | 'instance-get' + | 'instance-method' + | 'instance-readonly-field' + | 'instance-set' + | 'instance-static-initialization' + | 'method' + | 'private-constructor' + | 'private-decorated-field' + | 'private-decorated-get' + | 'private-decorated-method' + | 'private-decorated-readonly-field' + | 'private-decorated-set' + | 'private-field' + | 'private-get' + | 'private-instance-field' + | 'private-instance-get' + | 'private-instance-method' + | 'private-instance-readonly-field' + | 'private-instance-set' + | 'private-instance-static-initialization' + | 'private-method' + | 'private-readonly-field' + | 'private-set' + | 'private-static-field' + | 'private-static-get' + | 'private-static-method' + | 'private-static-readonly-field' + | 'private-static-set' + | 'private-static-static-initialization' + | 'protected-abstract-field' + | 'protected-abstract-get' + | 'protected-abstract-method' + | 'protected-abstract-readonly-field' + | 'protected-abstract-set' + | 'protected-abstract-static-initialization' + | 'protected-constructor' + | 'protected-decorated-field' + | 'protected-decorated-get' + | 'protected-decorated-method' + | 'protected-decorated-readonly-field' + | 'protected-decorated-set' + | 'protected-field' + | 'protected-get' + | 'protected-instance-field' + | 'protected-instance-get' + | 'protected-instance-method' + | 'protected-instance-readonly-field' + | 'protected-instance-set' + | 'protected-instance-static-initialization' + | 'protected-method' + | 'protected-readonly-field' + | 'protected-set' + | 'protected-static-field' + | 'protected-static-get' + | 'protected-static-method' + | 'protected-static-readonly-field' + | 'protected-static-set' + | 'protected-static-static-initialization' + | 'public-abstract-field' + | 'public-abstract-get' + | 'public-abstract-method' + | 'public-abstract-readonly-field' + | 'public-abstract-set' + | 'public-abstract-static-initialization' + | 'public-constructor' + | 'public-decorated-field' + | 'public-decorated-get' + | 'public-decorated-method' + | 'public-decorated-readonly-field' + | 'public-decorated-set' + | 'public-field' + | 'public-get' + | 'public-instance-field' + | 'public-instance-get' + | 'public-instance-method' + | 'public-instance-readonly-field' + | 'public-instance-set' + | 'public-instance-static-initialization' + | 'public-method' + | 'public-readonly-field' + | 'public-set' + | 'public-static-field' + | 'public-static-get' + | 'public-static-method' + | 'public-static-readonly-field' + | 'public-static-set' + | 'public-static-static-initialization' + | 'readonly-field' + | 'readonly-signature' + | 'set' + | 'signature' + | 'static-field' + | 'static-get' + | 'static-initialization' + | 'static-method' + | 'static-readonly-field' + | 'static-set' + | 'static-static-initialization'; + +type TypeItems = + | 'constructor' + | 'field' + | 'method' + | 'readonly-field' + | 'readonly-signature' + | 'signature'; + +type BaseConfig = + | 'never' + | (AllItems | AllItems[])[] + | { + memberTypes?: 'never' | (AllItems | AllItems[])[]; + optionalityOrder?: OptionalityOrderOptions; + order?: OrderOptions; + }; + +type TypesConfig = + | 'never' + | (TypeItems | TypeItems[])[] + | { + memberTypes?: 'never' | (TypeItems | TypeItems[])[]; + optionalityOrder?: OptionalityOrderOptions; + order?: OrderOptions; + }; + +type Options = [ + { + classExpressions?: BaseConfig; + classes?: BaseConfig; + default?: BaseConfig; + interfaces?: TypesConfig; + typeLiterals?: TypesConfig; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot new file mode 100644 index 00000000000..b66647bd92d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/method-signature-style.shot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes method-signature-style 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["method", "property"], + "type": "string" + } +] + + +# TYPES: + +type Options = ['method' | 'property']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot new file mode 100644 index 00000000000..1f360bc55c2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/naming-convention.shot @@ -0,0 +1,1993 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes naming-convention 1`] = ` +" +# SCHEMA: + +{ + "$defs": { + "formatOptionsConfig": { + "oneOf": [ + { + "additionalItems": false, + "items": { + "$ref": "#/$defs/predefinedFormats" + }, + "type": "array" + }, + { + "type": "null" + } + ] + }, + "matchRegexConfig": { + "additionalProperties": false, + "properties": { + "match": { + "type": "boolean" + }, + "regex": { + "type": "string" + } + }, + "required": ["match", "regex"], + "type": "object" + }, + "predefinedFormats": { + "enum": [ + "PascalCase", + "StrictPascalCase", + "UPPER_CASE", + "camelCase", + "snake_case", + "strictCamelCase" + ], + "type": "string" + }, + "prefixSuffixConfig": { + "additionalItems": false, + "items": { + "minLength": 1, + "type": "string" + }, + "type": "array" + }, + "typeModifiers": { + "enum": ["array", "boolean", "function", "number", "string"], + "type": "string" + }, + "underscoreOptions": { + "enum": [ + "allow", + "allowDouble", + "allowSingleOrDouble", + "forbid", + "require", + "requireDouble" + ], + "type": "string" + } + }, + "additionalItems": false, + "items": { + "oneOf": [ + { + "additionalProperties": false, + "description": "Multiple selectors in one config", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "const", + "destructured", + "exported", + "global", + "override", + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "unused" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "additionalItems": false, + "items": { + "enum": [ + "accessor", + "class", + "classMethod", + "classProperty", + "default", + "enum", + "enumMember", + "function", + "interface", + "memberLike", + "method", + "objectLiteralMethod", + "objectLiteralProperty", + "parameter", + "parameterProperty", + "property", + "typeAlias", + "typeLike", + "typeMethod", + "typeParameter", + "typeProperty", + "variable", + "variableLike" + ], + "type": "string" + }, + "type": "array" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'default'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "const", + "destructured", + "exported", + "global", + "override", + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static", + "unused" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["default"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'variableLike'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["async", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["variableLike"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'variable'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "async", + "const", + "destructured", + "exported", + "global", + "unused" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["variable"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'function'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["async", "exported", "global", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["function"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'parameter'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["destructured", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["parameter"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'memberLike'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "override", + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["memberLike"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'classProperty'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "override", + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["classProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'objectLiteralProperty'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["public", "requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["objectLiteralProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'typeProperty'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["public", "readonly", "requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'parameterProperty'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["private", "protected", "public", "readonly"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["parameterProperty"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'property'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "override", + "private", + "protected", + "public", + "readonly", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["property"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'classMethod'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "override", + "private", + "protected", + "public", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["classMethod"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'objectLiteralMethod'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["async", "public", "requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["objectLiteralMethod"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'typeMethod'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["public", "requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeMethod"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'method'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "#private", + "abstract", + "async", + "override", + "private", + "protected", + "public", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["method"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'accessor'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": [ + "abstract", + "override", + "private", + "protected", + "public", + "requiresQuotes", + "static" + ], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["accessor"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "types": { + "additionalItems": false, + "items": { + "$ref": "#/$defs/typeModifiers" + }, + "type": "array" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'enumMember'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["requiresQuotes"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["enumMember"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'typeLike'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["abstract", "exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeLike"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'class'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["abstract", "exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["class"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'interface'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["interface"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'typeAlias'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeAlias"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'enum'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["exported", "unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["enum"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + }, + { + "additionalProperties": false, + "description": "Selector 'typeParameter'", + "properties": { + "custom": { + "$ref": "#/$defs/matchRegexConfig" + }, + "failureMessage": { + "type": "string" + }, + "filter": { + "oneOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "$ref": "#/$defs/matchRegexConfig" + } + ] + }, + "format": { + "$ref": "#/$defs/formatOptionsConfig" + }, + "leadingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + }, + "modifiers": { + "additionalItems": false, + "items": { + "enum": ["unused"], + "type": "string" + }, + "type": "array" + }, + "prefix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "selector": { + "enum": ["typeParameter"], + "type": "string" + }, + "suffix": { + "$ref": "#/$defs/prefixSuffixConfig" + }, + "trailingUnderscore": { + "$ref": "#/$defs/underscoreOptions" + } + }, + "required": ["selector", "format"], + "type": "object" + } + ] + }, + "type": "array" +} + + +# TYPES: + +type UnderscoreOptions = + | 'allow' + | 'allowDouble' + | 'allowSingleOrDouble' + | 'forbid' + | 'require' + | 'requireDouble'; + +type PredefinedFormats = + | 'PascalCase' + | 'StrictPascalCase' + | 'UPPER_CASE' + | 'camelCase' + | 'snake_case' + | 'strictCamelCase'; + +type TypeModifiers = 'array' | 'boolean' | 'function' | 'number' | 'string'; + +type PrefixSuffixConfig = string[]; + +type MatchRegexConfig = { + match: boolean; + regex: string; +}; + +type FormatOptionsConfig = PredefinedFormats[] | null; + +type Options = /** Multiple selectors in one config */ +(| { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'const' + | 'destructured' + | 'exported' + | 'global' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + | 'unused' + )[]; + prefix?: PrefixSuffixConfig; + selector: ( + | 'accessor' + | 'class' + | 'classMethod' + | 'classProperty' + | 'default' + | 'enum' + | 'enumMember' + | 'function' + | 'interface' + | 'memberLike' + | 'method' + | 'objectLiteralMethod' + | 'objectLiteralProperty' + | 'parameter' + | 'parameterProperty' + | 'property' + | 'typeAlias' + | 'typeLike' + | 'typeMethod' + | 'typeParameter' + | 'typeProperty' + | 'variable' + | 'variableLike' + )[]; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'accessor' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | 'abstract' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'accessor'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'class' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('abstract' | 'exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'class'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'classMethod' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'classMethod'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'classProperty' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'classProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'default' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'const' + | 'destructured' + | 'exported' + | 'global' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + | 'unused' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'default'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'enum' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'enum'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'enumMember' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'enumMember'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'function' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('async' | 'exported' | 'global' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'function'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'interface' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'interface'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'memberLike' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'memberLike'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'method' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'method'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'objectLiteralMethod' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('async' | 'public' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'objectLiteralMethod'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'objectLiteralProperty' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('public' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'objectLiteralProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'parameter' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('destructured' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'parameter'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'parameterProperty' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('private' | 'protected' | 'public' | 'readonly')[]; + prefix?: PrefixSuffixConfig; + selector: 'parameterProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'property' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | '#private' + | 'abstract' + | 'async' + | 'override' + | 'private' + | 'protected' + | 'public' + | 'readonly' + | 'requiresQuotes' + | 'static' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'property'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'typeAlias' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeAlias'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'typeLike' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('abstract' | 'exported' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeLike'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'typeMethod' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('public' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeMethod'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'typeParameter' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeParameter'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } + /** Selector 'typeProperty' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('public' | 'readonly' | 'requiresQuotes')[]; + prefix?: PrefixSuffixConfig; + selector: 'typeProperty'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'variable' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ( + | 'async' + | 'const' + | 'destructured' + | 'exported' + | 'global' + | 'unused' + )[]; + prefix?: PrefixSuffixConfig; + selector: 'variable'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + types?: TypeModifiers[]; + } + /** Selector 'variableLike' */ + | { + custom?: MatchRegexConfig; + failureMessage?: string; + filter?: MatchRegexConfig | string; + format: FormatOptionsConfig; + leadingUnderscore?: UnderscoreOptions; + modifiers?: ('async' | 'unused')[]; + prefix?: PrefixSuffixConfig; + selector: 'variableLike'; + suffix?: PrefixSuffixConfig; + trailingUnderscore?: UnderscoreOptions; + } +)[]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot b/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot new file mode 100644 index 00000000000..fddb0ea6c63 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-array-constructor.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-array-constructor 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot new file mode 100644 index 00000000000..af652bc7e38 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-base-to-string.shot @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-base-to-string 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoredTypeNames": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + ignoredTypeNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot new file mode 100644 index 00000000000..6f0b386771a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-non-null-assertion.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-confusing-non-null-assertion 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot new file mode 100644 index 00000000000..b7481d1000c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-confusing-void-expression.shot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-confusing-void-expression 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreArrowShorthand": { + "type": "boolean" + }, + "ignoreVoidOperator": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + ignoreArrowShorthand?: boolean; + ignoreVoidOperator?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot b/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot new file mode 100644 index 00000000000..3860df1d232 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-dupe-class-members.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-dupe-class-members 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot new file mode 100644 index 00000000000..466f69dde1e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-enum-values.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-duplicate-enum-values 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot new file mode 100644 index 00000000000..d111b2e3729 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-duplicate-type-constituents.shot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-duplicate-type-constituents 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreIntersections": { + "type": "boolean" + }, + "ignoreUnions": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + ignoreIntersections?: boolean; + ignoreUnions?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot b/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot new file mode 100644 index 00000000000..3a77da1e1ca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-dynamic-delete.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-dynamic-delete 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot new file mode 100644 index 00000000000..c7660d3ec1e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-function.shot @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-empty-function 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allow": { + "items": { + "enum": [ + "arrowFunctions", + "asyncFunctions", + "asyncMethods", + "constructors", + "decoratedFunctions", + "functions", + "generatorFunctions", + "generatorMethods", + "getters", + "methods", + "overrideMethods", + "private-constructors", + "protected-constructors", + "setters" + ], + "type": "string" + }, + "type": "array", + "uniqueItems": true + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allow?: ( + | 'arrowFunctions' + | 'asyncFunctions' + | 'asyncMethods' + | 'constructors' + | 'decoratedFunctions' + | 'functions' + | 'generatorFunctions' + | 'generatorMethods' + | 'getters' + | 'methods' + | 'overrideMethods' + | 'private-constructors' + | 'protected-constructors' + | 'setters' + )[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot new file mode 100644 index 00000000000..fa4dbf83d2c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-empty-interface.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-empty-interface 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowSingleExtends": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowSingleExtends?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot b/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot new file mode 100644 index 00000000000..0a857d21554 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-explicit-any.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-explicit-any 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "fixToUnknown": { + "description": "Whether to enable auto-fixing in which the \`any\` type is converted to the \`unknown\` type.", + "type": "boolean" + }, + "ignoreRestArgs": { + "description": "Whether to ignore rest parameter arrays.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to enable auto-fixing in which the \`any\` type is converted to the \`unknown\` type. */ + fixToUnknown?: boolean; + /** Whether to ignore rest parameter arrays. */ + ignoreRestArgs?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot new file mode 100644 index 00000000000..1bdd3183789 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-non-null-assertion.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extra-non-null-assertion 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot new file mode 100644 index 00000000000..77abaa97a25 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-parens.shot @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extra-parens 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "items": [ + { + "enum": ["functions"] + } + ], + "maxItems": 1, + "minItems": 0, + "type": "array" + }, + { + "items": [ + { + "enum": ["all"] + }, + { + "additionalProperties": false, + "properties": { + "allowParensAfterCommentPattern": { + "type": "string" + }, + "conditionalAssign": { + "type": "boolean" + }, + "enforceForArrowConditionals": { + "type": "boolean" + }, + "enforceForFunctionPrototypeMethods": { + "type": "boolean" + }, + "enforceForNewInMemberExpressions": { + "type": "boolean" + }, + "enforceForSequenceExpressions": { + "type": "boolean" + }, + "ignoreJSX": { + "enum": ["all", "multi-line", "none", "single-line"] + }, + "nestedBinaryExpressions": { + "type": "boolean" + }, + "returnAssign": { + "type": "boolean" + }, + "ternaryOperandBinaryExpressions": { + "type": "boolean" + } + }, + "type": "object" + } + ], + "maxItems": 2, + "minItems": 0, + "type": "array" + } + ] +} + + +# TYPES: + +type Options = + | [] + | ['all'] + | ['functions'] + | [ + 'all', + { + allowParensAfterCommentPattern?: string; + conditionalAssign?: boolean; + enforceForArrowConditionals?: boolean; + enforceForFunctionPrototypeMethods?: boolean; + enforceForNewInMemberExpressions?: boolean; + enforceForSequenceExpressions?: boolean; + ignoreJSX?: 'all' | 'multi-line' | 'none' | 'single-line'; + nestedBinaryExpressions?: boolean; + returnAssign?: boolean; + ternaryOperandBinaryExpressions?: boolean; + }, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot new file mode 100644 index 00000000000..dc3b391ba2f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extra-semi.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extra-semi 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot b/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot new file mode 100644 index 00000000000..b02bb56e590 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-extraneous-class.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-extraneous-class 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowConstructorOnly": { + "description": "Whether to allow extraneous classes that contain only a constructor.", + "type": "boolean" + }, + "allowEmpty": { + "description": "Whether to allow extraneous classes that have no body (i.e. are empty).", + "type": "boolean" + }, + "allowStaticOnly": { + "description": "Whether to allow extraneous classes that only contain static members.", + "type": "boolean" + }, + "allowWithDecorator": { + "description": "Whether to allow extraneous classes that include a decorator.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow extraneous classes that contain only a constructor. */ + allowConstructorOnly?: boolean; + /** Whether to allow extraneous classes that have no body (i.e. are empty). */ + allowEmpty?: boolean; + /** Whether to allow extraneous classes that only contain static members. */ + allowStaticOnly?: boolean; + /** Whether to allow extraneous classes that include a decorator. */ + allowWithDecorator?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot new file mode 100644 index 00000000000..ac6669f651b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-floating-promises.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-floating-promises 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreIIFE": { + "description": "Whether to ignore async IIFEs (Immediately Invoked Function Expressions).", + "type": "boolean" + }, + "ignoreVoid": { + "description": "Whether to ignore \`void\` expressions.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore async IIFEs (Immediately Invoked Function Expressions). */ + ignoreIIFE?: boolean; + /** Whether to ignore \`void\` expressions. */ + ignoreVoid?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot b/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot new file mode 100644 index 00000000000..f5942d6181c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-for-in-array.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-for-in-array 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot b/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot new file mode 100644 index 00000000000..32ce767e813 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-implied-eval.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-implied-eval 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot b/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot new file mode 100644 index 00000000000..02d33924257 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-import-type-side-effects.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-import-type-side-effects 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot new file mode 100644 index 00000000000..c913653a007 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-inferrable-types.shot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-inferrable-types 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreParameters": { + "type": "boolean" + }, + "ignoreProperties": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + ignoreParameters?: boolean; + ignoreProperties?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot new file mode 100644 index 00000000000..75cd5974f14 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-this.shot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-invalid-this 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "capIsConstructor": { + "default": true, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + capIsConstructor?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot new file mode 100644 index 00000000000..a6d271f1a0f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-invalid-void-type.shot @@ -0,0 +1,43 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-invalid-void-type 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowAsThisParameter": { + "type": "boolean" + }, + "allowInGenericTypeArguments": { + "oneOf": [ + { + "type": "boolean" + }, + { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array" + } + ] + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowAsThisParameter?: boolean; + allowInGenericTypeArguments?: [string, ...string[]] | boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot b/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot new file mode 100644 index 00000000000..1509d5ece1b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-loop-func.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-loop-func 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot b/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot new file mode 100644 index 00000000000..54ee68e2e89 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-loss-of-precision.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-loss-of-precision 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot new file mode 100644 index 00000000000..5628d7b9927 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-magic-numbers.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-magic-numbers 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "detectObjects": { + "default": false, + "type": "boolean" + }, + "enforceConst": { + "default": false, + "type": "boolean" + }, + "ignore": { + "items": { + "anyOf": [ + { + "type": "number" + }, + { + "pattern": "^[+-]?(?:0|[1-9][0-9]*)n$", + "type": "string" + } + ] + }, + "type": "array", + "uniqueItems": true + }, + "ignoreArrayIndexes": { + "default": false, + "type": "boolean" + }, + "ignoreClassFieldInitialValues": { + "default": false, + "type": "boolean" + }, + "ignoreDefaultValues": { + "default": false, + "type": "boolean" + }, + "ignoreEnums": { + "type": "boolean" + }, + "ignoreNumericLiteralTypes": { + "type": "boolean" + }, + "ignoreReadonlyClassProperties": { + "type": "boolean" + }, + "ignoreTypeIndexes": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + detectObjects?: boolean; + enforceConst?: boolean; + ignore?: (number | string)[]; + ignoreArrayIndexes?: boolean; + ignoreClassFieldInitialValues?: boolean; + ignoreDefaultValues?: boolean; + ignoreEnums?: boolean; + ignoreNumericLiteralTypes?: boolean; + ignoreReadonlyClassProperties?: boolean; + ignoreTypeIndexes?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot new file mode 100644 index 00000000000..8f66e54f40d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-meaningless-void-operator.shot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-meaningless-void-operator 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "checkNever": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + checkNever?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot new file mode 100644 index 00000000000..52ae6ae98c0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-new.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-misused-new 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot new file mode 100644 index 00000000000..2ba6191f464 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-misused-promises.shot @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-misused-promises 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "checksConditionals": { + "type": "boolean" + }, + "checksSpreads": { + "type": "boolean" + }, + "checksVoidReturn": { + "oneOf": [ + { + "type": "boolean" + }, + { + "additionalProperties": false, + "properties": { + "arguments": { + "type": "boolean" + }, + "attributes": { + "type": "boolean" + }, + "properties": { + "type": "boolean" + }, + "returns": { + "type": "boolean" + }, + "variables": { + "type": "boolean" + } + }, + "type": "object" + } + ] + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + checksConditionals?: boolean; + checksSpreads?: boolean; + checksVoidReturn?: + | { + arguments?: boolean; + attributes?: boolean; + properties?: boolean; + returns?: boolean; + variables?: boolean; + } + | boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot b/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot new file mode 100644 index 00000000000..ce6f1562980 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-mixed-enums.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-mixed-enums 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot b/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot new file mode 100644 index 00000000000..79c1f36922d --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-namespace.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-namespace 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowDeclarations": { + "description": "Whether to allow \`declare\` with custom TypeScript namespaces.", + "type": "boolean" + }, + "allowDefinitionFiles": { + "description": "Whether to allow \`declare\` with custom TypeScript namespaces inside definition files.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow \`declare\` with custom TypeScript namespaces. */ + allowDeclarations?: boolean; + /** Whether to allow \`declare\` with custom TypeScript namespaces inside definition files. */ + allowDefinitionFiles?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot new file mode 100644 index 00000000000..ce0bfb40fe4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-nullish-coalescing.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-non-null-asserted-nullish-coalescing 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot new file mode 100644 index 00000000000..27c579c858c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-asserted-optional-chain.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-non-null-asserted-optional-chain 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot new file mode 100644 index 00000000000..f292b46e306 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-non-null-assertion.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-non-null-assertion 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot new file mode 100644 index 00000000000..61f33831a07 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redeclare.shot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-redeclare 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "builtinGlobals": { + "type": "boolean" + }, + "ignoreDeclarationMerge": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + builtinGlobals?: boolean; + ignoreDeclarationMerge?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot new file mode 100644 index 00000000000..e80f262a7ce --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-redundant-type-constituents.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-redundant-type-constituents 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot new file mode 100644 index 00000000000..bdb7cb32538 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-require-imports.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-require-imports 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot new file mode 100644 index 00000000000..e41e144b41c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-restricted-imports.shot @@ -0,0 +1,183 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-restricted-imports 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "allowTypeImports": { + "description": "Disallow value imports, but allow type-only imports.", + "type": "boolean" + }, + "importNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "minLength": 1, + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": ["name"], + "type": "object" + } + ] + }, + "type": "array", + "uniqueItems": true + }, + { + "additionalItems": false, + "items": [ + { + "additionalProperties": false, + "properties": { + "paths": { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "allowTypeImports": { + "description": "Disallow value imports, but allow type-only imports.", + "type": "boolean" + }, + "importNames": { + "items": { + "type": "string" + }, + "type": "array" + }, + "message": { + "minLength": 1, + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": ["name"], + "type": "object" + } + ] + }, + "type": "array", + "uniqueItems": true + }, + "patterns": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array", + "uniqueItems": true + }, + { + "items": { + "additionalProperties": false, + "properties": { + "allowTypeImports": { + "description": "Disallow value imports, but allow type-only imports.", + "type": "boolean" + }, + "caseSensitive": { + "type": "boolean" + }, + "group": { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "importNames": { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + }, + "message": { + "minLength": 1, + "type": "string" + } + }, + "required": ["group"], + "type": "object" + }, + "type": "array", + "uniqueItems": true + } + ] + } + }, + "type": "object" + } + ], + "type": "array" + } + ] +} + + +# TYPES: + +type Options = + | ( + | { + /** Disallow value imports, but allow type-only imports. */ + allowTypeImports?: boolean; + importNames?: string[]; + message?: string; + name: string; + } + | string + )[] + | [] + | [ + { + paths?: ( + | { + /** Disallow value imports, but allow type-only imports. */ + allowTypeImports?: boolean; + importNames?: string[]; + message?: string; + name: string; + } + | string + )[]; + patterns?: + | { + /** Disallow value imports, but allow type-only imports. */ + allowTypeImports?: boolean; + caseSensitive?: boolean; + group: [string, ...string[]]; + importNames?: [string, ...string[]]; + message?: string; + }[] + | string[]; + }, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot new file mode 100644 index 00000000000..78b85fbadc0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-shadow.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-shadow 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allow": { + "items": { + "type": "string" + }, + "type": "array" + }, + "builtinGlobals": { + "type": "boolean" + }, + "hoist": { + "enum": ["all", "functions", "never"], + "type": "string" + }, + "ignoreFunctionTypeParameterNameValueShadow": { + "type": "boolean" + }, + "ignoreOnInitialization": { + "type": "boolean" + }, + "ignoreTypeValueShadow": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allow?: string[]; + builtinGlobals?: boolean; + hoist?: 'all' | 'functions' | 'never'; + ignoreFunctionTypeParameterNameValueShadow?: boolean; + ignoreOnInitialization?: boolean; + ignoreTypeValueShadow?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot new file mode 100644 index 00000000000..7bf1f235430 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-this-alias.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-this-alias 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowDestructuring": { + "description": "Whether to ignore destructurings, such as \`const { props, state } = this\`.", + "type": "boolean" + }, + "allowedNames": { + "description": "Names to ignore, such as [\\"self\\"] for \`const self = this;\`.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore destructurings, such as \`const { props, state } = this\`. */ + allowDestructuring?: boolean; + /** Names to ignore, such as ["self"] for \`const self = this;\`. */ + allowedNames?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot b/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot new file mode 100644 index 00000000000..eb5380cdecc --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-throw-literal.shot @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-throw-literal 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowThrowingAny": { + "type": "boolean" + }, + "allowThrowingUnknown": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowThrowingAny?: boolean; + allowThrowingUnknown?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot new file mode 100644 index 00000000000..f2c6920de9c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-type-alias.shot @@ -0,0 +1,97 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-type-alias 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "expandedOptions": { + "enum": [ + "always", + "in-intersections", + "in-unions", + "in-unions-and-intersections", + "never" + ], + "type": "string" + }, + "simpleOptions": { + "enum": ["always", "never"], + "type": "string" + } + }, + "additionalProperties": false, + "properties": { + "allowAliases": { + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow direct one-to-one type aliases." + }, + "allowCallbacks": { + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases for callbacks." + }, + "allowConditionalTypes": { + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases for conditional types." + }, + "allowConstructors": { + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases with constructors." + }, + "allowGenerics": { + "$ref": "#/items/0/$defs/simpleOptions", + "description": "Whether to allow type aliases with generic types." + }, + "allowLiterals": { + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow type aliases with object literal types." + }, + "allowMappedTypes": { + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow type aliases with mapped types." + }, + "allowTupleTypes": { + "$ref": "#/items/0/$defs/expandedOptions", + "description": "Whether to allow type aliases with tuple types." + } + }, + "type": "object" + } +] + + +# TYPES: + +type ExpandedOptions = + | 'always' + | 'in-intersections' + | 'in-unions' + | 'in-unions-and-intersections' + | 'never'; + +type SimpleOptions = 'always' | 'never'; + +type Options = [ + { + /** Whether to allow direct one-to-one type aliases. */ + allowAliases?: ExpandedOptions; + /** Whether to allow type aliases for callbacks. */ + allowCallbacks?: SimpleOptions; + /** Whether to allow type aliases for conditional types. */ + allowConditionalTypes?: SimpleOptions; + /** Whether to allow type aliases with constructors. */ + allowConstructors?: SimpleOptions; + /** Whether to allow type aliases with generic types. */ + allowGenerics?: SimpleOptions; + /** Whether to allow type aliases with object literal types. */ + allowLiterals?: ExpandedOptions; + /** Whether to allow type aliases with mapped types. */ + allowMappedTypes?: ExpandedOptions; + /** Whether to allow type aliases with tuple types. */ + allowTupleTypes?: ExpandedOptions; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot new file mode 100644 index 00000000000..faf2bf9e182 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-boolean-literal-compare.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-boolean-literal-compare 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowComparingNullableBooleansToFalse": { + "description": "Whether to allow comparisons between nullable boolean variables and \`false\`.", + "type": "boolean" + }, + "allowComparingNullableBooleansToTrue": { + "description": "Whether to allow comparisons between nullable boolean variables and \`true\`.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow comparisons between nullable boolean variables and \`false\`. */ + allowComparingNullableBooleansToFalse?: boolean; + /** Whether to allow comparisons between nullable boolean variables and \`true\`. */ + allowComparingNullableBooleansToTrue?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot new file mode 100644 index 00000000000..4f7fef6518e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-condition.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-condition 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowConstantLoopConditions": { + "description": "Whether to ignore constant loop conditions, such as \`while (true)\`.", + "type": "boolean" + }, + "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "description": "Whether to not error when running with a tsconfig that has strictNullChecks turned.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore constant loop conditions, such as \`while (true)\`. */ + allowConstantLoopConditions?: boolean; + /** Whether to not error when running with a tsconfig that has strictNullChecks turned. */ + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot new file mode 100644 index 00000000000..728930a1d9c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-qualifier.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-qualifier 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot new file mode 100644 index 00000000000..275c98ba22f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-arguments.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-type-arguments 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot new file mode 100644 index 00000000000..b0954ae493b --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-assertion.shot @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-type-assertion 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "typesToIgnore": { + "description": "A list of type names to ignore.", + "items": { + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** A list of type names to ignore. */ + typesToIgnore?: string[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot new file mode 100644 index 00000000000..2a2fbcd8b92 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unnecessary-type-constraint.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unnecessary-type-constraint 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot new file mode 100644 index 00000000000..9acbeed8bf2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-argument.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-argument 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot new file mode 100644 index 00000000000..0df27b8f4bd --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-assignment.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-assignment 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot new file mode 100644 index 00000000000..6c7d5b0a83a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-call.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-call 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot new file mode 100644 index 00000000000..559a8bc7fe7 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-declaration-merging.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-declaration-merging 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot new file mode 100644 index 00000000000..1fc8fd77fbc --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-enum-comparison.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-enum-comparison 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot new file mode 100644 index 00000000000..bf7c89189dc --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-member-access.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-member-access 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot new file mode 100644 index 00000000000..a66f82fae7a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unsafe-return.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unsafe-return 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot new file mode 100644 index 00000000000..43950ac51ce --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-expressions.shot @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unused-expressions 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowShortCircuit": { + "default": false, + "type": "boolean" + }, + "allowTaggedTemplates": { + "default": false, + "type": "boolean" + }, + "allowTernary": { + "default": false, + "type": "boolean" + }, + "enforceForJSX": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowShortCircuit?: boolean; + allowTaggedTemplates?: boolean; + allowTernary?: boolean; + enforceForJSX?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot new file mode 100644 index 00000000000..a87d2016784 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-unused-vars.shot @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-unused-vars 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { + "enum": ["all", "local"], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "args": { + "enum": ["after-used", "all", "none"], + "type": "string" + }, + "argsIgnorePattern": { + "type": "string" + }, + "caughtErrors": { + "enum": ["all", "none"], + "type": "string" + }, + "caughtErrorsIgnorePattern": { + "type": "string" + }, + "destructuredArrayIgnorePattern": { + "type": "string" + }, + "ignoreRestSiblings": { + "type": "boolean" + }, + "vars": { + "enum": ["all", "local"], + "type": "string" + }, + "varsIgnorePattern": { + "type": "string" + } + }, + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + | 'all' + | 'local' + | { + args?: 'after-used' | 'all' | 'none'; + argsIgnorePattern?: string; + caughtErrors?: 'all' | 'none'; + caughtErrorsIgnorePattern?: string; + destructuredArrayIgnorePattern?: string; + ignoreRestSiblings?: boolean; + vars?: 'all' | 'local'; + varsIgnorePattern?: string; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot new file mode 100644 index 00000000000..624448da333 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-use-before-define.shot @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-use-before-define 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { + "enum": ["nofunc"], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "allowNamedExports": { + "type": "boolean" + }, + "classes": { + "type": "boolean" + }, + "enums": { + "type": "boolean" + }, + "functions": { + "type": "boolean" + }, + "ignoreTypeReferences": { + "type": "boolean" + }, + "typedefs": { + "type": "boolean" + }, + "variables": { + "type": "boolean" + } + }, + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + | 'nofunc' + | { + allowNamedExports?: boolean; + classes?: boolean; + enums?: boolean; + functions?: boolean; + ignoreTypeReferences?: boolean; + typedefs?: boolean; + variables?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot b/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot new file mode 100644 index 00000000000..59fac39b876 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-useless-constructor.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-useless-constructor 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot b/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot new file mode 100644 index 00000000000..40b42b0fa7e --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-useless-empty-export.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-useless-empty-export 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot b/packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot new file mode 100644 index 00000000000..992833a20ae --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/no-var-requires.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes no-var-requires 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot b/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot new file mode 100644 index 00000000000..483a62f5f09 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/non-nullable-type-assertion-style.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes non-nullable-type-assertion-style 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot new file mode 100644 index 00000000000..25f315066bb --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/object-curly-spacing.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes object-curly-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["always", "never"] + }, + { + "additionalProperties": false, + "properties": { + "arraysInObjects": { + "type": "boolean" + }, + "objectsInObjects": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + 'always' | 'never', + { + arraysInObjects?: boolean; + objectsInObjects?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot new file mode 100644 index 00000000000..63acbd25d50 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/padding-line-between-statements.shot @@ -0,0 +1,273 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes padding-line-between-statements 1`] = ` +" +# SCHEMA: + +{ + "$defs": { + "paddingType": { + "enum": ["always", "any", "never"], + "type": "string" + }, + "statementType": { + "anyOf": [ + { + "enum": [ + "*", + "block", + "block-like", + "break", + "case", + "class", + "const", + "continue", + "debugger", + "default", + "directive", + "do", + "empty", + "export", + "exports", + "expression", + "for", + "function", + "if", + "iife", + "import", + "interface", + "let", + "multiline-block-like", + "multiline-const", + "multiline-expression", + "multiline-let", + "multiline-var", + "require", + "return", + "singleline-const", + "singleline-let", + "singleline-var", + "switch", + "throw", + "try", + "type", + "var", + "while", + "with" + ], + "type": "string" + }, + { + "additionalItems": false, + "items": { + "enum": [ + "*", + "block", + "block-like", + "break", + "case", + "class", + "const", + "continue", + "debugger", + "default", + "directive", + "do", + "empty", + "export", + "exports", + "expression", + "for", + "function", + "if", + "iife", + "import", + "interface", + "let", + "multiline-block-like", + "multiline-const", + "multiline-expression", + "multiline-let", + "multiline-var", + "require", + "return", + "singleline-const", + "singleline-let", + "singleline-var", + "switch", + "throw", + "try", + "type", + "var", + "while", + "with" + ], + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + } + ] + } + }, + "additionalItems": false, + "items": { + "additionalProperties": false, + "properties": { + "blankLine": { + "$ref": "#/$defs/paddingType" + }, + "next": { + "$ref": "#/$defs/statementType" + }, + "prev": { + "$ref": "#/$defs/statementType" + } + }, + "required": ["blankLine", "prev", "next"], + "type": "object" + }, + "type": "array" +} + + +# TYPES: + +type PaddingType = 'always' | 'any' | 'never'; + +type StatementType = + | '*' + | 'block' + | 'block-like' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'directive' + | 'do' + | 'empty' + | 'export' + | 'exports' + | 'expression' + | 'for' + | 'function' + | 'if' + | 'iife' + | 'import' + | 'interface' + | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' + | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'switch' + | 'throw' + | 'try' + | 'type' + | 'var' + | 'while' + | 'with' + | [ + ( + | '*' + | 'block' + | 'block-like' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'directive' + | 'do' + | 'empty' + | 'export' + | 'exports' + | 'expression' + | 'for' + | 'function' + | 'if' + | 'iife' + | 'import' + | 'interface' + | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' + | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'switch' + | 'throw' + | 'try' + | 'type' + | 'var' + | 'while' + | 'with' + ), + ...( + | '*' + | 'block' + | 'block-like' + | 'break' + | 'case' + | 'class' + | 'const' + | 'continue' + | 'debugger' + | 'default' + | 'directive' + | 'do' + | 'empty' + | 'export' + | 'exports' + | 'expression' + | 'for' + | 'function' + | 'if' + | 'iife' + | 'import' + | 'interface' + | 'let' + | 'multiline-block-like' + | 'multiline-const' + | 'multiline-expression' + | 'multiline-let' + | 'multiline-var' + | 'require' + | 'return' + | 'singleline-const' + | 'singleline-let' + | 'singleline-var' + | 'switch' + | 'throw' + | 'try' + | 'type' + | 'var' + | 'while' + | 'with' + )[], + ]; + +type Options = { + blankLine: PaddingType; + next: StatementType; + prev: StatementType; +}[]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot new file mode 100644 index 00000000000..502e7b0387f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/parameter-properties.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes parameter-properties 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "modifier": { + "enum": [ + "private", + "private readonly", + "protected", + "protected readonly", + "public", + "public readonly", + "readonly" + ], + "type": "string" + } + }, + "additionalProperties": false, + "properties": { + "allow": { + "items": { + "$ref": "#/items/0/$defs/modifier" + }, + "type": "array" + }, + "prefer": { + "enum": ["class-property", "parameter-property"], + "type": "string" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Modifier = + | 'private readonly' + | 'private' + | 'protected readonly' + | 'protected' + | 'public readonly' + | 'public' + | 'readonly'; + +type Options = [ + { + allow?: Modifier[]; + prefer?: 'class-property' | 'parameter-property'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot new file mode 100644 index 00000000000..1e687c2a354 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-as-const.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-as-const 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot new file mode 100644 index 00000000000..281bbd737c0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-enum-initializers.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-enum-initializers 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot new file mode 100644 index 00000000000..07e7b0510c4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-for-of.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-for-of 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot new file mode 100644 index 00000000000..5c28dbbe392 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-function-type.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-function-type 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot new file mode 100644 index 00000000000..0315e76ddaa --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-includes.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-includes 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot new file mode 100644 index 00000000000..9bbb15fe6dd --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-literal-enum-member.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-literal-enum-member 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowBitwiseExpressions": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowBitwiseExpressions?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot new file mode 100644 index 00000000000..6ef076952a8 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-namespace-keyword.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-namespace-keyword 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot new file mode 100644 index 00000000000..622ae864994 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-nullish-coalescing.shot @@ -0,0 +1,64 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-nullish-coalescing 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "type": "boolean" + }, + "ignoreConditionalTests": { + "type": "boolean" + }, + "ignoreMixedLogicalExpressions": { + "type": "boolean" + }, + "ignorePrimitives": { + "properties": { + "bigint": { + "type": "boolean" + }, + "boolean": { + "type": "boolean" + }, + "number": { + "type": "boolean" + }, + "string": { + "type": "boolean" + } + }, + "type": "object" + }, + "ignoreTernaryTests": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + ignoreConditionalTests?: boolean; + ignoreMixedLogicalExpressions?: boolean; + ignorePrimitives?: { + bigint?: boolean; + boolean?: boolean; + number?: boolean; + string?: boolean; + [k: string]: unknown; + }; + ignoreTernaryTests?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot new file mode 100644 index 00000000000..d46855fc7ca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-optional-chain.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-optional-chain 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing": { + "description": "Allow autofixers that will change the return type of the expression. This option is considered unsafe as it may break the build.", + "type": "boolean" + }, + "checkAny": { + "description": "Check operands that are typed as \`any\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + }, + "checkBigInt": { + "description": "Check operands that are typed as \`bigint\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + }, + "checkBoolean": { + "description": "Check operands that are typed as \`boolean\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + }, + "checkNumber": { + "description": "Check operands that are typed as \`number\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + }, + "checkString": { + "description": "Check operands that are typed as \`string\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + }, + "checkUnknown": { + "description": "Check operands that are typed as \`unknown\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + }, + "requireNullish": { + "description": "Skip operands that are not typed with \`null\` and/or \`undefined\` when inspecting \\"loose boolean\\" operands.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Allow autofixers that will change the return type of the expression. This option is considered unsafe as it may break the build. */ + allowPotentiallyUnsafeFixesThatModifyTheReturnTypeIKnowWhatImDoing?: boolean; + /** Check operands that are typed as \`any\` when inspecting "loose boolean" operands. */ + checkAny?: boolean; + /** Check operands that are typed as \`bigint\` when inspecting "loose boolean" operands. */ + checkBigInt?: boolean; + /** Check operands that are typed as \`boolean\` when inspecting "loose boolean" operands. */ + checkBoolean?: boolean; + /** Check operands that are typed as \`number\` when inspecting "loose boolean" operands. */ + checkNumber?: boolean; + /** Check operands that are typed as \`string\` when inspecting "loose boolean" operands. */ + checkString?: boolean; + /** Check operands that are typed as \`unknown\` when inspecting "loose boolean" operands. */ + checkUnknown?: boolean; + /** Skip operands that are not typed with \`null\` and/or \`undefined\` when inspecting "loose boolean" operands. */ + requireNullish?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot new file mode 100644 index 00000000000..332e54184b3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly-parameter-types.shot @@ -0,0 +1,147 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-readonly-parameter-types 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allow": { + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "from": { + "enum": ["file"], + "type": "string" + }, + "name": { + "oneOf": [ + { + "type": "string" + }, + { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + } + ] + }, + "path": { + "type": "string" + } + }, + "required": ["from", "name"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "from": { + "enum": ["lib"], + "type": "string" + }, + "name": { + "oneOf": [ + { + "type": "string" + }, + { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + } + ] + } + }, + "required": ["from", "name"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "from": { + "enum": ["package"], + "type": "string" + }, + "name": { + "oneOf": [ + { + "type": "string" + }, + { + "items": { + "type": "string" + }, + "minItems": 1, + "type": "array", + "uniqueItems": true + } + ] + }, + "package": { + "type": "string" + } + }, + "required": ["from", "name", "package"], + "type": "object" + } + ] + }, + "type": "array" + }, + "checkParameterProperties": { + "type": "boolean" + }, + "ignoreInferredTypes": { + "type": "boolean" + }, + "treatMethodsAsReadonly": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allow?: ( + | { + from: 'file'; + name: [string, ...string[]] | string; + path?: string; + } + | { + from: 'lib'; + name: [string, ...string[]] | string; + } + | { + from: 'package'; + name: [string, ...string[]] | string; + package: string; + } + | string + )[]; + checkParameterProperties?: boolean; + ignoreInferredTypes?: boolean; + treatMethodsAsReadonly?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot new file mode 100644 index 00000000000..34e4a22204a --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-readonly.shot @@ -0,0 +1,28 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-readonly 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "onlyInlineLambdas": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + onlyInlineLambdas?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot new file mode 100644 index 00000000000..d3aa7a0217f --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-reduce-type-parameter.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-reduce-type-parameter 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot new file mode 100644 index 00000000000..7a34c379269 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-regexp-exec.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-regexp-exec 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot new file mode 100644 index 00000000000..043d5a211b5 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-return-this-type.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-return-this-type 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot new file mode 100644 index 00000000000..d05465a64ca --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-string-starts-ends-with.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-string-starts-ends-with 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot b/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot new file mode 100644 index 00000000000..44fe6704b60 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/prefer-ts-expect-error.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes prefer-ts-expect-error 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot new file mode 100644 index 00000000000..c073af42009 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/promise-function-async.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes promise-function-async 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowAny": { + "description": "Whether to consider \`any\` and \`unknown\` to be Promises.", + "type": "boolean" + }, + "allowedPromiseNames": { + "description": "Any extra names of classes or interfaces to be considered Promises.", + "items": { + "type": "string" + }, + "type": "array" + }, + "checkArrowFunctions": { + "type": "boolean" + }, + "checkFunctionDeclarations": { + "type": "boolean" + }, + "checkFunctionExpressions": { + "type": "boolean" + }, + "checkMethodDeclarations": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to consider \`any\` and \`unknown\` to be Promises. */ + allowAny?: boolean; + /** Any extra names of classes or interfaces to be considered Promises. */ + allowedPromiseNames?: string[]; + checkArrowFunctions?: boolean; + checkFunctionDeclarations?: boolean; + checkFunctionExpressions?: boolean; + checkMethodDeclarations?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/quotes.shot b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot new file mode 100644 index 00000000000..bf7bb170ed0 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/quotes.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes quotes 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["backtick", "double", "single"] + }, + { + "anyOf": [ + { + "enum": ["avoid-escape"] + }, + { + "additionalProperties": false, + "properties": { + "allowTemplateLiterals": { + "type": "boolean" + }, + "avoidEscape": { + "type": "boolean" + } + }, + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + 'backtick' | 'double' | 'single', + ( + | 'avoid-escape' + | { + allowTemplateLiterals?: boolean; + avoidEscape?: boolean; + } + ), +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot b/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot new file mode 100644 index 00000000000..979a8050716 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/require-array-sort-compare.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes require-array-sort-compare 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreStringArrays": { + "description": "Whether to ignore arrays in which all elements are strings.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to ignore arrays in which all elements are strings. */ + ignoreStringArrays?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/require-await.shot b/packages/eslint-plugin/tests/schema-snapshots/require-await.shot new file mode 100644 index 00000000000..61fb0467b29 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/require-await.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes require-await 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot new file mode 100644 index 00000000000..95359ef3159 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-plus-operands.shot @@ -0,0 +1,60 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes restrict-plus-operands 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowAny": { + "description": "Whether to allow \`any\` typed values.", + "type": "boolean" + }, + "allowBoolean": { + "description": "Whether to allow \`boolean\` typed values.", + "type": "boolean" + }, + "allowNullish": { + "description": "Whether to allow potentially \`null\` or \`undefined\` typed values.", + "type": "boolean" + }, + "allowNumberAndString": { + "description": "Whether to allow \`bigint\`/\`number\` typed values and \`string\` typed values to be added together.", + "type": "boolean" + }, + "allowRegExp": { + "description": "Whether to allow \`regexp\` typed values.", + "type": "boolean" + }, + "skipCompoundAssignments": { + "description": "Whether to skip compound assignments such as \`+=\`.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow \`any\` typed values. */ + allowAny?: boolean; + /** Whether to allow \`boolean\` typed values. */ + allowBoolean?: boolean; + /** Whether to allow potentially \`null\` or \`undefined\` typed values. */ + allowNullish?: boolean; + /** Whether to allow \`bigint\`/\`number\` typed values and \`string\` typed values to be added together. */ + allowNumberAndString?: boolean; + /** Whether to allow \`regexp\` typed values. */ + allowRegExp?: boolean; + /** Whether to skip compound assignments such as \`+=\`. */ + skipCompoundAssignments?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot new file mode 100644 index 00000000000..194ddc4260c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/restrict-template-expressions.shot @@ -0,0 +1,60 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes restrict-template-expressions 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowAny": { + "description": "Whether to allow \`any\` typed values in template expressions.", + "type": "boolean" + }, + "allowBoolean": { + "description": "Whether to allow \`boolean\` typed values in template expressions.", + "type": "boolean" + }, + "allowNever": { + "description": "Whether to allow \`never\` typed values in template expressions.", + "type": "boolean" + }, + "allowNullish": { + "description": "Whether to allow \`nullish\` typed values in template expressions.", + "type": "boolean" + }, + "allowNumber": { + "description": "Whether to allow \`number\` typed values in template expressions.", + "type": "boolean" + }, + "allowRegExp": { + "description": "Whether to allow \`regexp\` typed values in template expressions.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to allow \`any\` typed values in template expressions. */ + allowAny?: boolean; + /** Whether to allow \`boolean\` typed values in template expressions. */ + allowBoolean?: boolean; + /** Whether to allow \`never\` typed values in template expressions. */ + allowNever?: boolean; + /** Whether to allow \`nullish\` typed values in template expressions. */ + allowNullish?: boolean; + /** Whether to allow \`number\` typed values in template expressions. */ + allowNumber?: boolean; + /** Whether to allow \`regexp\` typed values in template expressions. */ + allowRegExp?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/return-await.shot b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot new file mode 100644 index 00000000000..5d79a331bf3 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/return-await.shot @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes return-await 1`] = ` +" +# SCHEMA: + +[ + { + "enum": ["always", "in-try-catch", "never"], + "type": "string" + } +] + + +# TYPES: + +type Options = ['always' | 'in-try-catch' | 'never']; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/semi.shot b/packages/eslint-plugin/tests/schema-snapshots/semi.shot new file mode 100644 index 00000000000..68c1a3b3df4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/semi.shot @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes semi 1`] = ` +" +# SCHEMA: + +{ + "anyOf": [ + { + "items": [ + { + "enum": ["never"] + }, + { + "additionalProperties": false, + "properties": { + "beforeStatementContinuationChars": { + "enum": ["always", "any", "never"] + } + }, + "type": "object" + } + ], + "maxItems": 2, + "minItems": 0, + "type": "array" + }, + { + "items": [ + { + "enum": ["always"] + }, + { + "additionalProperties": false, + "properties": { + "omitLastInOneLineBlock": { + "type": "boolean" + }, + "omitLastInOneLineClassBody": { + "type": "boolean" + } + }, + "type": "object" + } + ], + "maxItems": 2, + "minItems": 0, + "type": "array" + } + ] +} + + +# TYPES: + +type Options = + | [] + | ['always'] + | ['never'] + | [ + 'always', + { + omitLastInOneLineBlock?: boolean; + omitLastInOneLineClassBody?: boolean; + }, + ] + | [ + 'never', + { + beforeStatementContinuationChars?: 'always' | 'any' | 'never'; + }, + ]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot new file mode 100644 index 00000000000..3384c8b4d50 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/sort-type-constituents.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes sort-type-constituents 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "checkIntersections": { + "description": "Whether to check intersection types.", + "type": "boolean" + }, + "checkUnions": { + "description": "Whether to check union types.", + "type": "boolean" + }, + "groupOrder": { + "description": "Ordering of the groups.", + "items": { + "enum": [ + "conditional", + "function", + "import", + "intersection", + "keyword", + "literal", + "named", + "nullish", + "object", + "operator", + "tuple", + "union" + ], + "type": "string" + }, + "type": "array" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to check intersection types. */ + checkIntersections?: boolean; + /** Whether to check union types. */ + checkUnions?: boolean; + /** Ordering of the groups. */ + groupOrder?: ( + | 'conditional' + | 'function' + | 'import' + | 'intersection' + | 'keyword' + | 'literal' + | 'named' + | 'nullish' + | 'object' + | 'operator' + | 'tuple' + | 'union' + )[]; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot new file mode 100644 index 00000000000..96faea20aa2 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-blocks.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes space-before-blocks 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { + "enum": ["always", "never"] + }, + { + "additionalProperties": false, + "properties": { + "classes": { + "enum": ["always", "never", "off"] + }, + "functions": { + "enum": ["always", "never", "off"] + }, + "keywords": { + "enum": ["always", "never", "off"] + } + }, + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + | 'always' + | 'never' + | { + classes?: 'always' | 'never' | 'off'; + functions?: 'always' | 'never' | 'off'; + keywords?: 'always' | 'never' | 'off'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot new file mode 100644 index 00000000000..08a6df9b902 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/space-before-function-paren.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes space-before-function-paren 1`] = ` +" +# SCHEMA: + +[ + { + "oneOf": [ + { + "enum": ["always", "never"], + "type": "string" + }, + { + "additionalProperties": false, + "properties": { + "anonymous": { + "enum": ["always", "ignore", "never"], + "type": "string" + }, + "asyncArrow": { + "enum": ["always", "ignore", "never"], + "type": "string" + }, + "named": { + "enum": ["always", "ignore", "never"], + "type": "string" + } + }, + "type": "object" + } + ] + } +] + + +# TYPES: + +type Options = [ + | 'always' + | 'never' + | { + anonymous?: 'always' | 'ignore' | 'never'; + asyncArrow?: 'always' | 'ignore' | 'never'; + named?: 'always' | 'ignore' | 'never'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot b/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot new file mode 100644 index 00000000000..92fd6d7dd04 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/space-infix-ops.shot @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes space-infix-ops 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "int32Hint": { + "default": false, + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + int32Hint?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot new file mode 100644 index 00000000000..140b7e556a4 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/strict-boolean-expressions.shot @@ -0,0 +1,60 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes strict-boolean-expressions 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "allowAny": { + "type": "boolean" + }, + "allowNullableBoolean": { + "type": "boolean" + }, + "allowNullableEnum": { + "type": "boolean" + }, + "allowNullableNumber": { + "type": "boolean" + }, + "allowNullableObject": { + "type": "boolean" + }, + "allowNullableString": { + "type": "boolean" + }, + "allowNumber": { + "type": "boolean" + }, + "allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing": { + "type": "boolean" + }, + "allowString": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + allowAny?: boolean; + allowNullableBoolean?: boolean; + allowNullableEnum?: boolean; + allowNullableNumber?: boolean; + allowNullableObject?: boolean; + allowNullableString?: boolean; + allowNumber?: boolean; + allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing?: boolean; + allowString?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot b/packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot new file mode 100644 index 00000000000..b9d9916dc42 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/switch-exhaustiveness-check.shot @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes switch-exhaustiveness-check 1`] = ` +" +# SCHEMA: + +[] + + +# TYPES: + +/** No options declared */ +type Options = [];" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot new file mode 100644 index 00000000000..330be71ffe1 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/triple-slash-reference.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes triple-slash-reference 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "lib": { + "enum": ["always", "never"], + "type": "string" + }, + "path": { + "enum": ["always", "never"], + "type": "string" + }, + "types": { + "enum": ["always", "never", "prefer-import"], + "type": "string" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + lib?: 'always' | 'never'; + path?: 'always' | 'never'; + types?: 'always' | 'never' | 'prefer-import'; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot new file mode 100644 index 00000000000..5fc608ca4bc --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/type-annotation-spacing.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes type-annotation-spacing 1`] = ` +" +# SCHEMA: + +[ + { + "$defs": { + "spacingConfig": { + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "additionalProperties": false, + "properties": { + "after": { + "type": "boolean" + }, + "before": { + "type": "boolean" + }, + "overrides": { + "additionalProperties": false, + "properties": { + "arrow": { + "$ref": "#/items/0/$defs/spacingConfig" + }, + "colon": { + "$ref": "#/items/0/$defs/spacingConfig" + }, + "parameter": { + "$ref": "#/items/0/$defs/spacingConfig" + }, + "property": { + "$ref": "#/items/0/$defs/spacingConfig" + }, + "returnType": { + "$ref": "#/items/0/$defs/spacingConfig" + }, + "variable": { + "$ref": "#/items/0/$defs/spacingConfig" + } + }, + "type": "object" + } + }, + "type": "object" + } +] + + +# TYPES: + +type SpacingConfig = { + after?: boolean; + before?: boolean; +}; + +type Options = [ + { + after?: boolean; + before?: boolean; + overrides?: { + arrow?: SpacingConfig; + colon?: SpacingConfig; + parameter?: SpacingConfig; + property?: SpacingConfig; + returnType?: SpacingConfig; + variable?: SpacingConfig; + }; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/typedef.shot b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot new file mode 100644 index 00000000000..e244ad4d80c --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/typedef.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes typedef 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "arrayDestructuring": { + "type": "boolean" + }, + "arrowParameter": { + "type": "boolean" + }, + "memberVariableDeclaration": { + "type": "boolean" + }, + "objectDestructuring": { + "type": "boolean" + }, + "parameter": { + "type": "boolean" + }, + "propertyDeclaration": { + "type": "boolean" + }, + "variableDeclaration": { + "type": "boolean" + }, + "variableDeclarationIgnoreFunction": { + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + arrayDestructuring?: boolean; + arrowParameter?: boolean; + memberVariableDeclaration?: boolean; + objectDestructuring?: boolean; + parameter?: boolean; + propertyDeclaration?: boolean; + variableDeclaration?: boolean; + variableDeclarationIgnoreFunction?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot b/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot new file mode 100644 index 00000000000..4ce3ddd4a51 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/unbound-method.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes unbound-method 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreStatic": { + "description": "Whether to skip checking whether \`static\` methods are correctly bound.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether to skip checking whether \`static\` methods are correctly bound. */ + ignoreStatic?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot b/packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot new file mode 100644 index 00000000000..39b61b6dde7 --- /dev/null +++ b/packages/eslint-plugin/tests/schema-snapshots/unified-signatures.shot @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rule schemas should be convertible to TS types for documentation purposes unified-signatures 1`] = ` +" +# SCHEMA: + +[ + { + "additionalProperties": false, + "properties": { + "ignoreDifferentlyNamedParameters": { + "description": "Whether two parameters with different names at the same index should be considered different even if their types are the same.", + "type": "boolean" + } + }, + "type": "object" + } +] + + +# TYPES: + +type Options = [ + { + /** Whether two parameters with different names at the same index should be considered different even if their types are the same. */ + ignoreDifferentlyNamedParameters?: boolean; + }, +]; +" +`; diff --git a/packages/eslint-plugin/tests/schemas.test.ts b/packages/eslint-plugin/tests/schemas.test.ts new file mode 100644 index 00000000000..8ac28f96d82 --- /dev/null +++ b/packages/eslint-plugin/tests/schemas.test.ts @@ -0,0 +1,187 @@ +import 'jest-specific-snapshot'; + +import fs from 'node:fs'; +import path from 'node:path'; + +import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; +import { format, resolveConfig } from 'prettier'; + +import rules from '../src/rules/index'; +import { areOptionsValid } from './areOptionsValid'; + +const snapshotFolder = path.resolve(__dirname, 'schema-snapshots'); +try { + fs.mkdirSync(snapshotFolder); +} catch { + // ignore failure as it means it already exists probably +} + +const prettierConfigJson = { + ...(resolveConfig.sync(__filename) ?? {}), + filepath: path.join(__dirname, 'schema.json'), +}; + +const SKIPPED_RULES_FOR_TYPE_GENERATION = new Set(['indent']); +// Set this to a rule name to only run that rule +const ONLY = ''; + +describe('Rule schemas should be convertible to TS types for documentation purposes', () => { + for (const [ruleName, ruleDef] of Object.entries(rules)) { + if (SKIPPED_RULES_FOR_TYPE_GENERATION.has(ruleName)) { + // eslint-disable-next-line jest/no-disabled-tests -- intentional skip for documentation purposes + it.skip(ruleName, () => {}); + continue; + } + + (ruleName === ONLY ? it.only : it)(ruleName, () => { + const schemaString = format( + JSON.stringify( + ruleDef.meta.schema, + (k, v: unknown) => { + if (k === 'enum' && Array.isArray(v)) { + // sort enum arrays for consistency regardless of source order + v.sort(); + } else if ( + typeof v === 'object' && + v != null && + !Array.isArray(v) + ) { + // sort properties for consistency regardless of source order + return Object.fromEntries( + Object.entries(v).sort(([a], [b]) => a.localeCompare(b)), + ); + } + return v; + }, + // use the indent feature as it forces all objects to be multiline + // if we don't do this then prettier decides what objects are multiline + // based on what fits on a line - which looks less consistent + // and makes changes harder to understand as you can have multiple + // changes per line, or adding a prop can restructure an object + 2, + ), + prettierConfigJson, + ); + const compilationResult = compile(ruleDef.meta.schema); + + expect( + [ + '', + '# SCHEMA:', + '', + schemaString, + '', + '# TYPES:', + '', + compilationResult, + ].join('\n'), + ).toMatchSpecificSnapshot(path.join(snapshotFolder, `${ruleName}.shot`)); + }); + } +}); + +test('There should be no old snapshots for rules that have been deleted', () => { + const files = fs.readdirSync(snapshotFolder); + const names = new Set( + Object.keys(rules) + .filter(k => !SKIPPED_RULES_FOR_TYPE_GENERATION.has(k)) + .map(k => `${k}.shot`), + ); + + for (const file of files) { + expect(names).toContain(file); + } +}); + +const VALID_SCHEMA_PROPS = new Set([ + '$defs', + '$ref', + '$schema', + 'additionalItems', + 'additionalProperties', + 'allOf', + 'anyOf', + 'default', + 'definitions', + 'dependencies', + 'description', + 'enum', + 'exclusiveMaximum', + 'exclusiveMinimum', + 'extends', + 'format', + 'id', + 'items', + 'maximum', + 'maxItems', + 'maxLength', + 'maxProperties', + 'minimum', + 'minItems', + 'minLength', + 'minProperties', + 'multipleOf', + 'not', + 'oneOf', + 'pattern', + 'patternProperties', + 'properties', + 'required', + 'title', + 'type', + 'uniqueItems', +]); +describe('Rules should only define valid keys on schemas', () => { + for (const [ruleName, ruleDef] of Object.entries(rules)) { + (ruleName === ONLY ? it.only : it)(ruleName, () => { + JSON.stringify(ruleDef.meta.schema, (key, value: unknown) => { + if (key === '') { + // the root object will have key "" + return value; + } + if (key === '$defs' || key === 'definitions' || key === 'properties') { + // definition keys and property keys should not be validated, only the values + return Object.values(value as object); + } + if (parseInt(key).toString() === key) { + // hack to detect arrays as JSON.stringify will traverse them and stringify the number + return value; + } + + expect(VALID_SCHEMA_PROPS).toContain(key); + return value; + }); + }); + } +}); + +describe('Rule schemas should validate options correctly', () => { + // Normally, we use the rule's default options as an example of valid options. + // However, the defaults might not actually be valid (especially in the case + // where the defaults have to cover multiple incompatible options). + // This override allows providing example valid options for rules which don't + // accept their defaults. + const overrideValidOptions: Record = { + semi: ['never'], + 'func-call-spacing': ['never'], + }; + + for (const [ruleName, rule] of Object.entries(rules)) { + test(`${ruleName} must accept valid options`, () => { + if ( + !areOptionsValid( + rule, + overrideValidOptions[ruleName] ?? rule.defaultOptions, + ) + ) { + throw new Error(`Options failed validation against rule's schema`); + } + }); + + test(`${ruleName} rejects arbitrary options`, () => { + if (areOptionsValid(rule, [{ 'arbitrary-schemas.test.ts': true }])) { + throw new Error(`Options succeeded validation for arbitrary options`); + } + }); + } +}); diff --git a/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts b/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts index 2c7b7977ffb..52b0231420c 100644 --- a/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts +++ b/packages/eslint-plugin/tests/util/getWrappingFixer.test.ts @@ -1,7 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESTree } from '@typescript-eslint/utils'; import { createRule, getWrappingFixer } from '../../src/util'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rule = createRule({ name: 'void-everything', @@ -11,7 +12,6 @@ const rule = createRule({ fixable: 'code', docs: { description: 'Add void operator in random places for test purposes.', - recommended: false, }, messages: { addVoid: 'Please void this', diff --git a/packages/eslint-plugin/tests/util/isNodeEqual.test.ts b/packages/eslint-plugin/tests/util/isNodeEqual.test.ts index f087ddbddcd..a2473fb88db 100644 --- a/packages/eslint-plugin/tests/util/isNodeEqual.test.ts +++ b/packages/eslint-plugin/tests/util/isNodeEqual.test.ts @@ -1,7 +1,8 @@ +import { RuleTester } from '@typescript-eslint/rule-tester'; import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; import { createRule, isNodeEqual } from '../../src/util'; -import { getFixturesRootDir, RuleTester } from '../RuleTester'; +import { getFixturesRootDir } from '../RuleTester'; const rule = createRule({ name: 'no-useless-expression', @@ -11,7 +12,6 @@ const rule = createRule({ fixable: 'code', docs: { description: 'Remove useless expressions.', - recommended: false, }, messages: { removeExpression: 'Remove useless expression', diff --git a/packages/eslint-plugin/tools/generate-breaking-changes.ts b/packages/eslint-plugin/tools/generate-breaking-changes.mts similarity index 58% rename from packages/eslint-plugin/tools/generate-breaking-changes.ts rename to packages/eslint-plugin/tools/generate-breaking-changes.mts index 0b7da717287..d4ec9233e6c 100644 --- a/packages/eslint-plugin/tools/generate-breaking-changes.ts +++ b/packages/eslint-plugin/tools/generate-breaking-changes.mts @@ -1,18 +1,46 @@ -// eslint-disable-next-line @typescript-eslint/consistent-type-imports -type RulesFile = typeof import('../src/rules'); - -interface RulesObject { - default: RulesFile; -} +import type { TypeScriptESLintRules } from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; +import { fetch } from 'cross-fetch'; +// markdown-table is ESM, hence this file needs to be `.mts` +import { markdownTable } from 'markdown-table'; async function main(): Promise { - const { - default: { default: rules }, - } = - // @ts-expect-error -- We don't support ESM imports of local code yet. - (await import('../dist/rules/index.js')) as RulesObject; - const { markdownTable } = await import('markdown-table'); - const { fetch } = await import('cross-fetch'); + const rulesImport = await import('../src/rules/index.js'); + /* + weird TS resolution which adds an additional default layer in the type like: + { default: { default: Rules }} + instead of just + { default: Rules } + @ts-expect-error */ + const rules = rulesImport.default as TypeScriptESLintRules; + + // Annotate which rules are new since the last version + async function getNewRulesAsOfMajorVersion( + oldVersion: string, + ): Promise> { + // 1. Get the current list of rules (already done) + const newRuleNames = Object.keys(rules); + + // 2. Retrieve the old version of typescript-eslint from unpkg + const oldUrl = `https://unpkg.com/@typescript-eslint/eslint-plugin@${oldVersion}/dist/configs/all.js`; + const oldFileText = await (await fetch(oldUrl)).text(); + const oldObjectText = oldFileText.substring( + oldFileText.indexOf('{'), + oldFileText.lastIndexOf('}') + 1, + ); + // Normally we wouldn't condone using the 'eval' API... + // But this is an internal-only script and it's the easiest way to convert + // the JS raw text into a runtime object. 🤷 + let oldRulesObject!: { rules: TypeScriptESLintRules }; + eval('oldRulesObject = ' + oldObjectText); + const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); + + // 3. Get the keys that exist in (1) (new version) and not (2) (old version) + return new Set( + newRuleNames.filter( + newRuleName => !oldRuleNames.has(`@typescript-eslint/${newRuleName}`), + ), + ); + } const newRuleNames = await getNewRulesAsOfMajorVersion('5.0.0'); @@ -33,8 +61,17 @@ async function main(): Promise {
  • 🆕 = newly added to typescript-eslint
  • -
  • 🙅 = deprecated in the next major
  • -
  • ➖️ = to be removed from the plugin in the next version
  • +
  • 🙅 = to be deprecated in the next major
  • +
  • 💀 = currently deprecated; to be removed in the next version
  • +
+ + + + TC + Requires type checking? + +
    +
  • 💭 = yes
@@ -43,45 +80,43 @@ async function main(): Promise { Extension rule?
    -
  • ☑️ = yes
  • +
  • 🧱 = yes
- R + Rec'd Recommended
  • ➕ = add to recommended this version
  • -
  • ⚠️ = recommended as warning
  • -
  • 🛑 = recommended as an error
  • ➖️ = remove from recommended this version
  • +
  • 🟩 = stays in recommended this version
- RWT - Recommended-requiring-type-checking + Strict + Strict
    -
  • ➕ = add to recommended-with-typechecking this version
  • -
  • ⚠️ = recommended as warning
  • -
  • 🛑 = recommended as an error
  • -
  • ➖️ = remove from recommended this version
  • +
  • ➕ = add to strict this version
  • +
  • ➖️ = remove from strict this version
  • +
  • 🔵 = stays in strict this version
- Strict - Strict + Style + Style
    -
  • ➕ = add to strict this version
  • -
  • ⚠️ = recommended as warning
  • -
  • ➖️ = remove from strict this version
  • +
  • ➕ = add to stylistic this version
  • +
  • ➖️ = remove from stylistic this version
  • +
  • 🔸 = stays in stylistic this version
- + @@ -92,7 +127,7 @@ async function main(): Promise { console.log( markdownTable([ - ['Rule', 'Status', 'Ext', 'R', 'RWT', 'Strict', 'Comment'], + ['Rule', 'Status', 'TC', 'Ext', "Rec'd", 'Strict', 'Style', 'Comment'], ...Object.entries(rules).map(([ruleName, { meta }]) => { const { deprecated } = meta; const { extendsBaseRule, recommended, requiresTypeChecking } = @@ -100,55 +135,17 @@ async function main(): Promise { return [ `[\`${ruleName}\`](https://typescript-eslint.io/rules/${ruleName})`, - newRuleNames.has(ruleName) ? '🆕' : deprecated ? '🙅' : '', - extendsBaseRule ? '☑️' : '', - recommended && - ['error', 'warn'].includes(recommended) && - !requiresTypeChecking - ? '🛑' - : '', - recommended && - ['error', 'warn'].includes(recommended) && - requiresTypeChecking - ? '🛑' - : '', - recommended === 'strict' ? '⚠️' : '', + newRuleNames.has(ruleName) ? '🆕' : deprecated ? '💀' : '', + requiresTypeChecking ? '💭' : '', + extendsBaseRule ? '🧱' : '', + recommended === 'recommended' ? '🟩' : '', + recommended === 'strict' ? '🔵' : '', + recommended === 'stylistic' ? '🔸' : '', meta.type === 'layout' ? 'layout 💩' : '(todo)', ]; }), ]), ); - - // Annotate which rules are new since version 5.0.0 - async function getNewRulesAsOfMajorVersion( - oldVersion: string, - ): Promise> { - // 1. Get the current list of rules (already done) - const newRuleNames = Object.keys(rules); - - // 2. Use some CDN thing for the 5.X version of typescript-eslint - const oldUrl = `https://unpkg.com/@typescript-eslint/eslint-plugin@${oldVersion}/dist/configs/all.js`; - const oldFileText = await (await fetch(oldUrl)).text(); - const oldObjectText = oldFileText.substring( - oldFileText.indexOf('{'), - oldFileText.lastIndexOf('}') + 1, - ); - // Normally we wouldn't condone using the 'eval' API... - // But this is an internal-only script and it's the easiest way to convert - // the JS raw text into a runtime object. 🤷 - let oldRulesObject!: { rules: RulesFile }; - eval('oldRulesObject = ' + oldObjectText); - const oldRuleNames = new Set(Object.keys(oldRulesObject.rules)); - - // 3. Get the keys that exist in (1) (new version) and not (2) (old version) - return new Set( - newRuleNames.filter( - newRuleName => !oldRuleNames.has(`@typescript-eslint/${newRuleName}`), - ), - ); - } - - await getNewRulesAsOfMajorVersion('5.0.0'); } main().catch(error => { diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 30132f9b0f0..5056bdb7de4 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -1,247 +1,291 @@ import type { TSESLint } from '@typescript-eslint/utils'; -import chalk from 'chalk'; -import fs from 'fs'; -import path from 'path'; -import { format, resolveConfig } from 'prettier'; - -import rules from '../src/rules'; - -function addAutoGeneratedComment(code: string): string { - return [ - '// THIS CODE WAS AUTOMATICALLY GENERATED', - '// DO NOT EDIT THIS CODE BY HAND', - '// YOU CAN REGENERATE IT USING yarn generate:configs', - '', - code, - ].join('\n'); -} +import * as fs from 'fs'; +import * as path from 'path'; +import prettier from 'prettier'; +import * as url from 'url'; -const prettierConfig = resolveConfig.sync(__dirname); +import type RulesFile from '../src/rules'; -interface LinterConfigRules { - [name: string]: - | TSESLint.Linter.RuleLevel - | TSESLint.Linter.RuleLevelAndOptions; -} +// no need for us to bring in an entire dependency for a few simple terminal colors +const chalk = { + dim: (val: string): string => `\x1B[2m${val}\x1B[22m`, + green: (val: string): string => `\x1B[32m${val}\x1B[39m`, + red: (val: string): string => `\x1B[31m${val}\x1B[39m`, + blueBright: (val: string): string => `\x1B[94m${val}\x1B[39m`, + gray: (val: string): string => `\x1B[90m${val}\x1B[39m`, +}; -interface LinterConfig extends TSESLint.Linter.Config { - extends?: string | string[]; - plugins?: string[]; +interface RulesObject { + default: { + default: typeof RulesFile; + }; } -const RULE_NAME_PREFIX = '@typescript-eslint/'; -const MAX_RULE_NAME_LENGTH = Object.keys(rules).reduce( - (acc, name) => Math.max(acc, name.length), - 0, -); -const DEFAULT_RULE_SETTING = 'warn'; -const BASE_RULES_TO_BE_OVERRIDDEN = new Map( - Object.entries(rules) - .filter(([, rule]) => rule.meta.docs?.extendsBaseRule) - .map( - ([ruleName, rule]) => - [ - ruleName, - typeof rule.meta.docs?.extendsBaseRule === 'string' - ? rule.meta.docs?.extendsBaseRule - : ruleName, - ] as const, - ), -); -const EXTENDS = ['./configs/base', './configs/eslint-recommended']; - -type RuleEntry = [ - string, - TSESLint.RuleModule, -]; - -const ruleEntries: RuleEntry[] = Object.entries(rules).sort((a, b) => - a[0].localeCompare(b[0]), -); - -/** - * Helper function reduces records to key - value pairs. - * @param config - * @param entry - * @param settings - */ -function reducer( - config: LinterConfigRules, - entry: [string, TSESLint.RuleModule], - settings: { - errorLevel?: 'error' | 'warn'; - filterDeprecated: boolean; - filterRequiresTypeChecking?: 'include' | 'exclude'; - }, -): LinterConfigRules { - const key = entry[0]; - const value = entry[1]; - - if (settings.filterDeprecated && value.meta.deprecated) { - return config; +async function main(): Promise { + // TODO: Standardize & simplify these tools/* scripts once v6 is more stable + // @ts-expect-error -- ts-node allows us to use import.meta + const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); + + const { + default: { default: rules }, + } = + // @ts-expect-error -- We don't support ESM imports of local code yet. + (await import('../dist/rules/index.js')) as RulesObject; + + function addAutoGeneratedComment(code: string): string { + return [ + '// THIS CODE WAS AUTOMATICALLY GENERATED', + '// DO NOT EDIT THIS CODE BY HAND', + '// SEE https://typescript-eslint.io/linting/configs', + '//', + '// For developers working in the typescript-eslint monorepo:', + '// You can regenerate it using `yarn generate:configs`', + '', + code, + ].join('\n'); } - // Explicitly exclude rules requiring type-checking - if ( - settings.filterRequiresTypeChecking === 'exclude' && - value.meta.docs?.requiresTypeChecking === true - ) { - return config; + const prettierConfig = prettier.resolveConfig.sync(__dirname); + + interface LinterConfigRules { + [name: string]: TSESLint.Linter.RuleLevel; } - // Explicitly include rules requiring type-checking - if ( - settings.filterRequiresTypeChecking === 'include' && - value.meta.docs?.requiresTypeChecking !== true - ) { - return config; + interface LinterConfig extends TSESLint.Linter.Config { + extends?: string[] | string; + plugins?: string[]; + } + + const RULE_NAME_PREFIX = '@typescript-eslint/'; + const MAX_RULE_NAME_LENGTH = Object.keys(rules).reduce( + (acc, name) => Math.max(acc, name.length), + 0, + ); + const BASE_RULES_TO_BE_OVERRIDDEN = new Map( + Object.entries(rules) + .filter(([, rule]) => rule.meta.docs?.extendsBaseRule) + .map( + ([ruleName, rule]) => + [ + ruleName, + typeof rule.meta.docs?.extendsBaseRule === 'string' + ? rule.meta.docs?.extendsBaseRule + : ruleName, + ] as const, + ), + ); + const EXTENDS = ['./configs/base', './configs/eslint-recommended']; + + type RuleEntry = [ + string, + TSESLint.RuleModule, + ]; + + const allRuleEntries: RuleEntry[] = Object.entries(rules).sort((a, b) => + a[0].localeCompare(b[0]), + ); + + interface RuleFilter { + deprecated?: 'exclude'; + typeChecked?: 'exclude' | 'include-only'; + baseRuleForExtensionRule?: 'exclude'; + forcedRuleLevel?: TSESLint.Linter.RuleLevel; } - const ruleName = `${RULE_NAME_PREFIX}${key}`; - const recommendation = value.meta.docs?.recommended; + /** + * Helper function reduces records to key - value pairs. + */ + function reducer( + config: LinterConfigRules, + [key, value]: RuleEntry, + settings: RuleFilter = {}, + ): LinterConfigRules { + if (settings.deprecated && value.meta.deprecated) { + return config; + } + + // Explicitly exclude rules requiring type-checking + if ( + settings.typeChecked === 'exclude' && + value.meta.docs?.requiresTypeChecking === true + ) { + return config; + } - const usedSetting = settings.errorLevel - ? settings.errorLevel - : !recommendation - ? DEFAULT_RULE_SETTING - : recommendation === 'strict' - ? 'warn' - : recommendation; + if ( + settings.typeChecked === 'include-only' && + value.meta.docs?.requiresTypeChecking !== true + ) { + return config; + } - if (BASE_RULES_TO_BE_OVERRIDDEN.has(key)) { - const baseRuleName = BASE_RULES_TO_BE_OVERRIDDEN.get(key)!; + const ruleName = `${RULE_NAME_PREFIX}${key}`; + + if ( + settings.baseRuleForExtensionRule !== 'exclude' && + BASE_RULES_TO_BE_OVERRIDDEN.has(key) + ) { + const baseRuleName = BASE_RULES_TO_BE_OVERRIDDEN.get(key)!; + console.log( + baseRuleName + .padStart(RULE_NAME_PREFIX.length + baseRuleName.length) + .padEnd(RULE_NAME_PREFIX.length + MAX_RULE_NAME_LENGTH), + '=', + chalk.green('off'), + ); + config[baseRuleName] = 'off'; + } console.log( - baseRuleName - .padStart(RULE_NAME_PREFIX.length + baseRuleName.length) - .padEnd(RULE_NAME_PREFIX.length + MAX_RULE_NAME_LENGTH), + `${chalk.dim(RULE_NAME_PREFIX)}${key.padEnd(MAX_RULE_NAME_LENGTH)}`, '=', - chalk.green('off'), + chalk.red('error'), ); - config[baseRuleName] = 'off'; + config[ruleName] = settings.forcedRuleLevel ?? 'error'; + + return config; } - console.log( - `${chalk.dim(RULE_NAME_PREFIX)}${key.padEnd(MAX_RULE_NAME_LENGTH)}`, - '=', - usedSetting === 'error' - ? chalk.red(usedSetting) - : chalk.yellow(usedSetting), - ); - config[ruleName] = usedSetting; - return config; -} + /** + * Helper function writes configuration. + */ + function writeConfig(getConfig: () => LinterConfig, name: string): void { + const hyphens = '-'.repeat(35 - Math.ceil(name.length / 2)); + console.log(chalk.blueBright(`\n${hyphens} ${name}.ts ${hyphens}`)); + + // note: we use `export =` because ESLint will import these configs via a commonjs import + const code = `export = ${JSON.stringify(getConfig())};`; + const configStr = prettier.format(addAutoGeneratedComment(code), { + parser: 'typescript', + ...prettierConfig, + }); + fs.writeFileSync( + path.resolve(__dirname, `../src/configs/${name}.ts`), + configStr, + ); + } + + interface ExtendedConfigSettings { + extraExtends?: readonly string[]; + name: string; + filters?: RuleFilter; + ruleEntries: readonly RuleEntry[]; + } + + function writeExtendedConfig({ + extraExtends = [], + filters: ruleFilter, + name, + ruleEntries, + }: ExtendedConfigSettings): void { + writeConfig( + () => ({ + extends: [...EXTENDS, ...extraExtends], + rules: ruleEntries.reduce( + (config, entry) => reducer(config, entry, ruleFilter), + {}, + ), + }), + name, + ); + } -/** - * Helper function writes configuration. - */ -function writeConfig(config: LinterConfig, filePath: string): void { - // note: we use `export =` because ESLint will import these configs via a commonjs import - const code = `export = ${JSON.stringify(config)};`; - const configStr = format(addAutoGeneratedComment(code), { - parser: 'typescript', - ...prettierConfig, + function filterRuleEntriesTo( + ...recommendations: (TSESLint.RuleRecommendation | undefined)[] + ): RuleEntry[] { + return allRuleEntries.filter(([, rule]) => + recommendations.includes(rule.meta.docs?.recommended), + ); + } + + writeConfig((): LinterConfig => { + const baseConfig: LinterConfig = { + parser: '@typescript-eslint/parser', + parserOptions: { + sourceType: 'module', + }, + plugins: ['@typescript-eslint'], + }; + + console.log(chalk.gray('Config values:')); + + const longestKey = Object.keys(baseConfig).reduce( + (previous, next) => Math.max(previous, next.length), + 0, + ); + for (const [key, value] of Object.entries(baseConfig)) { + console.log(' ', key.padEnd(longestKey), value); + } + + return baseConfig; + }, 'base'); + + writeExtendedConfig({ + name: 'all', + filters: { + deprecated: 'exclude', + }, + ruleEntries: allRuleEntries, }); - fs.writeFileSync(filePath, configStr); -} -const recommendedValues = new Set([ - 'error', - 'warn', -]); + writeExtendedConfig({ + filters: { + typeChecked: 'exclude', + }, + name: 'recommended', + ruleEntries: filterRuleEntriesTo('recommended'), + }); -function entryIsRecommended(entry: RuleEntry): boolean { - return recommendedValues.has(entry[1].meta.docs?.recommended); -} + writeExtendedConfig({ + name: 'recommended-type-checked', + ruleEntries: filterRuleEntriesTo('recommended'), + }); -function entryIsStrict(entry: RuleEntry): boolean { - return entry[1].meta.docs?.recommended === 'strict'; -} + writeExtendedConfig({ + filters: { + typeChecked: 'exclude', + }, + name: 'strict', + ruleEntries: filterRuleEntriesTo('recommended', 'strict'), + }); -const baseConfig: LinterConfig = { - parser: '@typescript-eslint/parser', - parserOptions: { - sourceType: 'module', - }, - plugins: ['@typescript-eslint'], -}; -writeConfig(baseConfig, path.resolve(__dirname, '../src/configs/base.ts')); - -console.log(); -console.log( - '------------------------------------------------ all.ts ------------------------------------------------', -); -const allConfig: LinterConfig = { - extends: EXTENDS, - rules: ruleEntries.reduce( - (config, entry) => - reducer(config, entry, { errorLevel: 'error', filterDeprecated: true }), - {}, - ), -}; -writeConfig(allConfig, path.resolve(__dirname, '../src/configs/all.ts')); - -console.log(); -console.log( - '------------------------------ recommended.ts (should not require program) ------------------------------', -); -const recommendedRules = ruleEntries - .filter(entryIsRecommended) - .reduce( - (config, entry) => - reducer(config, entry, { - filterDeprecated: false, - filterRequiresTypeChecking: 'exclude', - }), - {}, - ); -const recommendedConfig: LinterConfig = { - extends: EXTENDS, - rules: recommendedRules, -}; -writeConfig( - recommendedConfig, - path.resolve(__dirname, '../src/configs/recommended.ts'), -); - -console.log(); -console.log( - '--------------------------------- recommended-requiring-type-checking.ts ---------------------------------', -); -const recommendedRulesRequiringProgram = ruleEntries - .filter(entryIsRecommended) - .reduce( - (config, entry) => - reducer(config, entry, { - filterDeprecated: false, - filterRequiresTypeChecking: 'include', - }), - {}, - ); -const recommendedRequiringTypeCheckingConfig: LinterConfig = { - extends: EXTENDS, - rules: recommendedRulesRequiringProgram, -}; -writeConfig( - recommendedRequiringTypeCheckingConfig, - path.resolve( - __dirname, - '../src/configs/recommended-requiring-type-checking.ts', - ), -); - -console.log(); -console.log( - '--------------------------------- strict.ts ---------------------------------', -); -const strictRules = ruleEntries.filter(entryIsStrict).reduce( - (config, entry) => - reducer(config, entry, { - filterDeprecated: false, + writeExtendedConfig({ + name: 'strict-type-checked', + ruleEntries: filterRuleEntriesTo('recommended', 'strict'), + }); + + writeExtendedConfig({ + filters: { + typeChecked: 'exclude', + }, + name: 'stylistic', + ruleEntries: filterRuleEntriesTo('stylistic'), + }); + + writeExtendedConfig({ + name: 'stylistic-type-checked', + ruleEntries: filterRuleEntriesTo('stylistic'), + }); + + writeConfig( + () => ({ + parserOptions: { + project: null, + program: null, + }, + rules: allRuleEntries.reduce( + (config, entry) => + reducer(config, entry, { + typeChecked: 'include-only', + baseRuleForExtensionRule: 'exclude', + forcedRuleLevel: 'off', + }), + {}, + ), }), - {}, -); -const strictConfig: LinterConfig = { - extends: EXTENDS, - rules: strictRules, -}; -writeConfig(strictConfig, path.resolve(__dirname, '../src/configs/strict.ts')); + 'disable-type-checked', + ); +} + +main().catch(error => { + console.error(error); +}); diff --git a/packages/eslint-plugin/tsconfig.build.json b/packages/eslint-plugin/tsconfig.build.json index af60c77e84f..49f58646073 100644 --- a/packages/eslint-plugin/tsconfig.build.json +++ b/packages/eslint-plugin/tsconfig.build.json @@ -2,6 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { // specifically disable declarations for the plugin + // see reasoning in packages/eslint-plugin/rules.d.ts "declaration": false, "declarationMap": false, "outDir": "./dist", diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 7801773b539..ae5a5e0f988 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -4,10 +4,11 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools", "index.d.ts"], + "include": ["src", "typings", "tests", "tools", "index.d.ts", "rules.d.ts"], "references": [ { "path": "../utils/tsconfig.build.json" }, { "path": "../parser/tsconfig.build.json" }, + { "path": "../rule-schema-to-typescript-types/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../type-utils/tsconfig.build.json" } ] diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 1726745df3f..295dd4d757c 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -8,10 +8,10 @@ declare module 'eslint/lib/rules/arrow-parens' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - | 'unexpectedParens' | 'expectedParens' - | 'unexpectedParensInline' - | 'expectedParensBlock', + | 'expectedParensBlock' + | 'unexpectedParens' + | 'unexpectedParensInline', [ 'always' | 'as-needed', { @@ -35,7 +35,7 @@ declare module 'eslint/lib/rules/camelcase' { allow?: string[]; ignoreDestructuring?: boolean; properties?: 'always' | 'never'; - genericType?: 'never' | 'always'; + genericType?: 'always' | 'never'; }, ], { @@ -52,7 +52,7 @@ declare module 'eslint/lib/rules/indent' { const rule: TSESLint.RuleModule< 'wrongIndentation', [ - ('tab' | number)?, + (number | 'tab')?, { SwitchCase?: number; VariableDeclarator?: @@ -107,9 +107,9 @@ declare module 'eslint/lib/rules/indent' { 'DoWhileStatement, WhileStatement, ForInStatement, ForOfStatement'( node: | TSESTree.DoWhileStatement - | TSESTree.WhileStatement | TSESTree.ForInStatement - | TSESTree.ForOfStatement, + | TSESTree.ForOfStatement + | TSESTree.WhileStatement, ): void; ExportNamedDeclaration(node: TSESTree.ExportNamedDeclaration): void; ForStatement(node: TSESTree.ForStatement): void; @@ -120,8 +120,8 @@ declare module 'eslint/lib/rules/indent' { ImportDeclaration(node: TSESTree.ImportDeclaration): void; 'MemberExpression, JSXMemberExpression, MetaProperty'( node: - | TSESTree.MemberExpression | TSESTree.JSXMemberExpression + | TSESTree.MemberExpression | TSESTree.MetaProperty, ): void; NewExpression(node: TSESTree.NewExpression): void; @@ -143,39 +143,39 @@ declare module 'eslint/lib/rules/indent' { declare module 'eslint/lib/rules/key-spacing' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; - import type { RuleFunction } from '@typescript-eslint/utils/dist/ts-eslint'; + import type { RuleFunction } from '@typescript-eslint/utils/ts-eslint'; type Options = [ { beforeColon?: boolean; afterColon?: boolean; - mode?: 'strict' | 'minimum'; + mode?: 'minimum' | 'strict'; align?: - | 'value' | 'colon' + | 'value' | { - on?: 'value' | 'colon'; + on?: 'colon' | 'value'; beforeColon?: boolean; afterColon?: boolean; - mode?: 'strict' | 'minimum'; + mode?: 'minimum' | 'strict'; }; singleLine?: { beforeColon?: boolean; afterColon?: boolean; - mode?: 'strict' | 'minimum'; + mode?: 'minimum' | 'strict'; }; multiLine?: { beforeColon?: boolean; afterColon?: boolean; - mode?: 'strict' | 'minimum'; + mode?: 'minimum' | 'strict'; align?: - | 'value' | 'colon' + | 'value' | { - on?: 'value' | 'colon'; + on?: 'colon' | 'value'; beforeColon?: boolean; afterColon?: boolean; - mode?: 'strict' | 'minimum'; + mode?: 'minimum' | 'strict'; }; }; }, @@ -195,7 +195,7 @@ declare module 'eslint/lib/rules/key-spacing' { declare module 'eslint/lib/rules/keyword-spacing' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; - import type { RuleFunction } from '@typescript-eslint/utils/dist/ts-eslint'; + import type { RuleFunction } from '@typescript-eslint/utils/ts-eslint'; type Options = [ { @@ -211,10 +211,10 @@ declare module 'eslint/lib/rules/keyword-spacing' { }, ]; type MessageIds = - | 'expectedBefore' | 'expectedAfter' - | 'unexpectedBefore' - | 'unexpectedAfter'; + | 'expectedBefore' + | 'unexpectedAfter' + | 'unexpectedBefore'; const rule: TSESLint.RuleModule< MessageIds, @@ -329,10 +329,10 @@ declare module 'eslint/lib/rules/no-implicit-globals' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - | 'globalNonLexicalBinding' + | 'assignmentToReadonlyGlobal' | 'globalLexicalBinding' + | 'globalNonLexicalBinding' | 'globalVariableLeak' - | 'assignmentToReadonlyGlobal' | 'redeclarationOfReadonlyGlobal', [], { @@ -402,7 +402,7 @@ declare module 'eslint/lib/rules/no-restricted-globals' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - 'defaultMessage' | 'customMessage', + 'customMessage' | 'defaultMessage', ( | string | { @@ -465,7 +465,7 @@ declare module 'eslint/lib/rules/no-unused-vars' { | { vars?: 'all' | 'local'; varsIgnorePattern?: string; - args?: 'all' | 'after-used' | 'none'; + args?: 'after-used' | 'all' | 'none'; ignoreRestSiblings?: boolean; argsIgnorePattern?: string; caughtErrors?: 'all' | 'none'; @@ -525,15 +525,15 @@ declare module 'eslint/lib/rules/strict' { const rule: TSESLint.RuleModule< | 'function' | 'global' + | 'implied' + | 'module' | 'multiple' | 'never' + | 'nonSimpleParameterList' | 'unnecessary' - | 'module' - | 'implied' | 'unnecessaryInClasses' - | 'nonSimpleParameterList' | 'wrap', - ['never' | 'global' | 'function' | 'safe'], + ['function' | 'global' | 'never' | 'safe'], { ArrowFunctionExpression(node: TSESTree.ArrowFunctionExpression): void; } @@ -565,7 +565,7 @@ declare module 'eslint/lib/rules/no-extra-parens' { conditionalAssign?: boolean; returnAssign?: boolean; nestedBinaryExpressions?: boolean; - ignoreJSX?: 'none' | 'all' | 'multi-line' | 'single-line'; + ignoreJSX?: 'all' | 'multi-line' | 'none' | 'single-line'; enforceForArrowConditionals?: boolean; }?, ], @@ -615,7 +615,7 @@ declare module 'eslint/lib/rules/semi' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - 'missingSemi' | 'extraSemi', + 'extraSemi' | 'missingSemi', [ 'always' | 'never', { @@ -647,7 +647,7 @@ declare module 'eslint/lib/rules/quotes' { const rule: TSESLint.RuleModule< 'wrongQuotes', [ - 'single' | 'double' | 'backtick', + 'backtick' | 'double' | 'single', { allowTemplateLiterals?: boolean; avoidEscape?: boolean; @@ -665,7 +665,7 @@ declare module 'eslint/lib/rules/block-spacing' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - 'missing' | 'extra', + 'extra' | 'missing', ['always' | 'never'], { BlockStatement(node: TSESTree.BlockStatement): void; @@ -680,14 +680,14 @@ declare module 'eslint/lib/rules/brace-style' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - | 'nextLineOpen' - | 'sameLineOpen' | 'blockSameLine' | 'nextLineClose' - | 'singleLineClose' - | 'sameLineClose', + | 'nextLineOpen' + | 'sameLineClose' + | 'sameLineOpen' + | 'singleLineClose', [ - '1tbs' | 'stroustrup' | 'allman', + '1tbs' | 'allman' | 'stroustrup', { allowSingleLine?: boolean; }?, @@ -839,7 +839,7 @@ declare module 'eslint/lib/rules/dot-notation' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - 'useDot' | 'useBrackets', + 'useBrackets' | 'useDot', [ { allowKeywords?: boolean; @@ -879,18 +879,18 @@ declare module 'eslint/lib/rules/comma-dangle' { | 'only-multiline'; type Selectors = | 'arrays' - | 'objects' - | 'imports' + | 'enums' | 'exports' | 'functions' - | 'enums' | 'generics' + | 'imports' + | 'objects' | 'tuples'; type ObjectOptions = Partial>; const rule: TSESLint.RuleModule< - 'unexpected' | 'missing', - [StringOptions | ObjectOptions], + 'missing' | 'unexpected', + [ObjectOptions | StringOptions], { TSEnumDeclaration(node: TSESTree.TSEnumDeclaration): void; TSTypeParameterDeclaration( @@ -902,32 +902,6 @@ declare module 'eslint/lib/rules/comma-dangle' { export = rule; } -declare module 'eslint/lib/rules/no-duplicate-imports' { - import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; - - const rule: TSESLint.RuleModule< - | 'import' - | 'importAs' - | 'export' - | 'exportAs' - | 'importType' - | 'importTypeAs' - | 'exportType' - | 'exportTypeAs', - [ - { - includeExports?: boolean; - }, - ], - { - ImportDeclaration(node: TSESTree.ImportDeclaration): void; - ExportNamedDeclaration?(node: TSESTree.ExportNamedDeclaration): void; - ExportAllDeclaration?(node: TSESTree.ExportAllDeclaration): void; - } - >; - export = rule; -} - declare module 'eslint/lib/rules/space-infix-ops' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; @@ -980,7 +954,7 @@ declare module 'eslint/lib/rules/prefer-const' { 'useConst', [ { - destructuring?: 'any' | 'all'; + destructuring?: 'all' | 'any'; ignoreReadBeforeAssign?: boolean; }, ], @@ -996,10 +970,10 @@ declare module 'eslint/lib/rules/object-curly-spacing' { import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; const rule: TSESLint.RuleModule< - | 'requireSpaceBefore' | 'requireSpaceAfter' - | 'unexpectedSpaceBefore' - | 'unexpectedSpaceAfter', + | 'requireSpaceBefore' + | 'unexpectedSpaceAfter' + | 'unexpectedSpaceBefore', [ 'always' | 'never', { @@ -1032,14 +1006,14 @@ declare module 'eslint/lib/rules/no-restricted-imports' { } )[]; export type ArrayOfStringOrObjectPatterns = - | string[] | { group: string[]; message?: string; caseSensitive?: boolean; // extended allowTypeImports?: boolean; - }[]; + }[] + | string[]; } interface ObjectOfPathsAndPatterns { @@ -1048,14 +1022,14 @@ declare module 'eslint/lib/rules/no-restricted-imports' { } const rule: TSESLint.RuleModule< - | 'path' - | 'pathWithCustomMessage' - | 'patterns' - | 'patternWithCustomMessage' | 'everything' | 'everythingWithCustomMessage' | 'importName' - | 'importNameWithCustomMessage', + | 'importNameWithCustomMessage' + | 'path' + | 'pathWithCustomMessage' + | 'patterns' + | 'patternWithCustomMessage', rule.ArrayOfStringOrObject | [ObjectOfPathsAndPatterns], { ImportDeclaration(node: TSESTree.ImportDeclaration): void; diff --git a/packages/eslint-plugin/typings/typescript.d.ts b/packages/eslint-plugin/typings/typescript.d.ts index 0f0b38a5ba6..e08a8fb4226 100644 --- a/packages/eslint-plugin/typings/typescript.d.ts +++ b/packages/eslint-plugin/typings/typescript.d.ts @@ -4,6 +4,8 @@ declare module 'typescript' { interface TypeChecker { // internal TS APIs + getContextualTypeForArgumentAtIndex(node: Node, argIndex: number): Type; + /** * @returns `true` if the given type is an array type: * - `Array` diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md deleted file mode 100644 index 0950f3b7c89..00000000000 --- a/packages/experimental-utils/CHANGELOG.md +++ /dev/null @@ -1,1094 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.55.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.1...v5.55.0) (2023-03-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [5.54.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.0...v5.54.1) (2023-03-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.54.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.53.0...v5.54.0) (2023-02-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.53.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.52.0...v5.53.0) (2023-02-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.52.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.51.0...v5.52.0) (2023-02-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.51.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.50.0...v5.51.0) (2023-02-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.50.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.49.0...v5.50.0) (2023-01-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.49.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.2...v5.49.0) (2023-01-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [5.48.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.1...v5.48.2) (2023-01-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -## [5.48.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.0...v5.48.1) (2023-01-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - - - - - -# [5.48.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) (2023-01-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.47.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.0...v5.47.1) (2022-12-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.47.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.1...v5.47.0) (2022-12-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.46.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.46.0...v5.46.1) (2022-12-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.46.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.1...v5.46.0) (2022-12-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.45.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.45.0...v5.45.1) (2022-12-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.45.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.44.0...v5.45.0) (2022-11-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.44.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.43.0...v5.44.0) (2022-11-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.43.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.1...v5.43.0) (2022-11-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.42.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.42.0...v5.42.1) (2022-11-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.42.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.41.0...v5.42.0) (2022-10-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.41.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.1...v5.41.0) (2022-10-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.40.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.40.0...v5.40.1) (2022-10-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.40.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.39.0...v5.40.0) (2022-10-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.39.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.1...v5.39.0) (2022-10-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.38.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.38.0...v5.38.1) (2022-09-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.38.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.37.0...v5.38.0) (2022-09-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.37.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.2...v5.37.0) (2022-09-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.36.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.1...v5.36.2) (2022-09-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.36.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.36.0...v5.36.1) (2022-08-30) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.36.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.1...v5.36.0) (2022-08-30) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.35.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.35.0...v5.35.1) (2022-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.35.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.34.0...v5.35.0) (2022-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.1...v5.34.0) (2022-08-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.33.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.33.0...v5.33.1) (2022-08-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.32.0...v5.33.0) (2022-08-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.31.0...v5.32.0) (2022-08-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.7...v5.31.0) (2022-07-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.6...v5.30.7) (2022-07-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.5...v5.30.6) (2022-07-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.4...v5.30.5) (2022-07-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.3...v5.30.4) (2022-07-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.2...v5.30.3) (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.30.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.30.1...v5.30.2) (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## 5.30.1 (2022-07-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.29.0...v5.30.0) (2022-06-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.28.0...v5.29.0) (2022-06-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.1...v5.28.0) (2022-06-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.27.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.27.0...v5.27.1) (2022-06-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.26.0...v5.27.0) (2022-05-30) - -### Features - -- [4.7] support new extensions ([#5027](https://github.com/typescript-eslint/typescript-eslint/issues/5027)) ([efc147b](https://github.com/typescript-eslint/typescript-eslint/commit/efc147b04dce52ab17415b6a4ae4076b944b9036)) - -# [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 - -# [5.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.23.0...v5.24.0) (2022-05-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.22.0...v5.23.0) (2022-05-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.21.0...v5.22.0) (2022-05-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.20.0...v5.21.0) (2022-04-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.19.0...v5.20.0) (2022-04-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.18.0...v5.19.0) (2022-04-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.17.0...v5.18.0) (2022-04-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.16.0...v5.17.0) (2022-03-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.15.0...v5.16.0) (2022-03-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.14.0...v5.15.0) (2022-03-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.13.0...v5.14.0) (2022-03-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.1...v5.13.0) (2022-02-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.12.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.12.0...v5.12.1) (2022-02-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.11.0...v5.12.0) (2022-02-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.2...v5.11.0) (2022-02-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.1...v5.10.2) (2022-01-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [5.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.10.0...v5.10.1) (2022-01-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.1...v5.10.0) (2022-01-17) - -### Features - -- rename `experimental-utils` to `utils` and make `experimental-utils` an alias to the new package ([#4172](https://github.com/typescript-eslint/typescript-eslint/issues/4172)) ([1d55a75](https://github.com/typescript-eslint/typescript-eslint/commit/1d55a7511b38d8e2b2eabe59f639e0a865e6c93f)) - -## [5.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.9.0...v5.9.1) (2022-01-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.1...v5.9.0) (2022-01-03) - -### Features - -- **experimental-utils:** move isTypeReadonly from eslint-plugin to experimental-utils ([#3658](https://github.com/typescript-eslint/typescript-eslint/issues/3658)) ([a9eb0b9](https://github.com/typescript-eslint/typescript-eslint/commit/a9eb0b9eb2db291ea36065ec34f84bf5c5504b43)) - -## [5.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.8.0...v5.8.1) (2021-12-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.7.0...v5.8.0) (2021-12-20) - -### Bug Fixes - -- **experimental-utils:** support immutable members ([#3844](https://github.com/typescript-eslint/typescript-eslint/issues/3844)) ([3d33a77](https://github.com/typescript-eslint/typescript-eslint/commit/3d33a77c57e5b752edf6f35ed152038bdb230b79)) - -# [5.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.6.0...v5.7.0) (2021-12-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.5.0...v5.6.0) (2021-12-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.4.0...v5.5.0) (2021-11-29) - -### Bug Fixes - -- **experimental-utils:** export RuleCreator interfaces ([#4199](https://github.com/typescript-eslint/typescript-eslint/issues/4199)) ([7821e4c](https://github.com/typescript-eslint/typescript-eslint/commit/7821e4c515ca2f11a14dcfa94dc77370da0287c5)) -- **experimental-utils:** fix types for eslint-utils ([#4173](https://github.com/typescript-eslint/typescript-eslint/issues/4173)) ([7079de2](https://github.com/typescript-eslint/typescript-eslint/commit/7079de26877a2313a7019845d4c33d0fc4d4b4a9)) - -# [5.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.1...v5.4.0) (2021-11-15) - -### Features - -- add RuleCreator.withoutDocs ([#4136](https://github.com/typescript-eslint/typescript-eslint/issues/4136)) ([87cfc6a](https://github.com/typescript-eslint/typescript-eslint/commit/87cfc6ad3e3312d7b6f98a592fb37e69d5d6880a)) -- **experimental-utils:** add default [] for RuleModule TOptions generic ([#4135](https://github.com/typescript-eslint/typescript-eslint/issues/4135)) ([62b8098](https://github.com/typescript-eslint/typescript-eslint/commit/62b8098fa7d361954c170ee6c190e47e95194b13)) - -## [5.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.3.0...v5.3.1) (2021-11-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.2.0...v5.3.0) (2021-11-01) - -### Bug Fixes - -- **experimental-utils:** add `name` property to test case interface ([#4067](https://github.com/typescript-eslint/typescript-eslint/issues/4067)) ([f3021c9](https://github.com/typescript-eslint/typescript-eslint/commit/f3021c94460e8d06e4169335bcc1a23854531f2a)) - -### Features - -- **experimental-utils:** extract `isTokenOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3977](https://github.com/typescript-eslint/typescript-eslint/issues/3977)) ([5229597](https://github.com/typescript-eslint/typescript-eslint/commit/5229597d9bfc998852c4b4fb421859e8f3d3d688)) - -# [5.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.1.0...v5.2.0) (2021-10-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [5.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.0.0...v5.1.0) (2021-10-18) - -### Features - -- **experimental-utils:** extract `ast-utils`' `predicates`' helpers ([#3976](https://github.com/typescript-eslint/typescript-eslint/issues/3976)) ([154ec9a](https://github.com/typescript-eslint/typescript-eslint/commit/154ec9aea8e81732cafe36af97c4822f1591b077)) - -# [5.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.33.0...v5.0.0) (2021-10-11) - -### Bug Fixes - -- **experimental-utils:** fix `isSetter`'s return type ([#3975](https://github.com/typescript-eslint/typescript-eslint/issues/3975)) ([d256856](https://github.com/typescript-eslint/typescript-eslint/commit/d2568561d0417fdfbdfd964ad942f9d00434af73)) - -### Features - -- **ast-spec:** bring `Node` objects in line with ESTree ([#3771](https://github.com/typescript-eslint/typescript-eslint/issues/3771)) ([dd14064](https://github.com/typescript-eslint/typescript-eslint/commit/dd140643b457aa515cc21fcda2b3cd4acc2a1c5c)) -- align class property representation with ESTree ([#3806](https://github.com/typescript-eslint/typescript-eslint/issues/3806)) ([22fa5c0](https://github.com/typescript-eslint/typescript-eslint/commit/22fa5c0c4705ed2898f00b7cacc5dd642d859275)), closes [#3430](https://github.com/typescript-eslint/typescript-eslint/issues/3430) [#3077](https://github.com/typescript-eslint/typescript-eslint/issues/3077) -- remove `meta.docs.category` from rules ([#3800](https://github.com/typescript-eslint/typescript-eslint/issues/3800)) ([71c9370](https://github.com/typescript-eslint/typescript-eslint/commit/71c93706e55f5f92a1285102b93c6ab1950c6df4)) -- remove `TSParenthesizedType` ([#3340](https://github.com/typescript-eslint/typescript-eslint/issues/3340)) ([c8ee432](https://github.com/typescript-eslint/typescript-eslint/commit/c8ee43269faea4c04ec02eaa2b81a0aa6eec5d3e)), closes [#3136](https://github.com/typescript-eslint/typescript-eslint/issues/3136) -- support ESLint v8 ([#3737](https://github.com/typescript-eslint/typescript-eslint/issues/3737)) ([4ca62ae](https://github.com/typescript-eslint/typescript-eslint/commit/4ca62aee6681d706e762a8db727541ca204364f2)) -- **experimental-utils:** extract `isNodeOfTypes` out of `ast-utils`' `predicates` ([#3836](https://github.com/typescript-eslint/typescript-eslint/issues/3836)) ([0cc509b](https://github.com/typescript-eslint/typescript-eslint/commit/0cc509b61df248cfb4b42fe64ec800f3cac69c69)) -- **experimental-utils:** remove `getComments` from `ESLint` `SourceCode` types ([#3766](https://github.com/typescript-eslint/typescript-eslint/issues/3766)) ([165a507](https://github.com/typescript-eslint/typescript-eslint/commit/165a507970d8e4a0ed12abdd5f0d892f7de83ffe)) - -# [4.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.32.0...v4.33.0) (2021-10-04) - -### Bug Fixes - -- **experimental-utils:** add `getPhysicalFilename()` to `RuleContext` ([#3934](https://github.com/typescript-eslint/typescript-eslint/issues/3934)) ([ee5dfd4](https://github.com/typescript-eslint/typescript-eslint/commit/ee5dfd4989ab465d65ba3424e36b7f0964558191)) -- **experimental-utils:** require fix in suggestions ([#3949](https://github.com/typescript-eslint/typescript-eslint/issues/3949)) ([f022fb1](https://github.com/typescript-eslint/typescript-eslint/commit/f022fb14c71dad25be2314252eb751964f34fcb8)) - -### Features - -- **experimental-utils:** extract `isNodeOfTypeWithConditions` out of `ast-utils`' `predicates` ([#3837](https://github.com/typescript-eslint/typescript-eslint/issues/3837)) ([214f898](https://github.com/typescript-eslint/typescript-eslint/commit/214f898178ba593146d06a444487d32ec3363854)) - -# [4.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.2...v4.32.0) (2021-09-27) - -### Bug Fixes - -- **experimental-utils:** add missing signature for `isParenthesized` ([#3887](https://github.com/typescript-eslint/typescript-eslint/issues/3887)) ([806eaac](https://github.com/typescript-eslint/typescript-eslint/commit/806eaac6af5325664634690e9ebd7ffaed276549)) - -## [4.31.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.1...v4.31.2) (2021-09-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.31.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.31.0...v4.31.1) (2021-09-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.30.0...v4.31.0) (2021-09-06) - -### Bug Fixes - -- **utils:** support immutable arrays in `ReportFixFunction` ([#3830](https://github.com/typescript-eslint/typescript-eslint/issues/3830)) ([8218055](https://github.com/typescript-eslint/typescript-eslint/commit/8218055d6dfd94c9e6c8645848f981d9d51ce08c)) - -### Features - -- **experimental-utils:** extract `isNodeOfType` out of `ast-utils`' `predicates` ([#3677](https://github.com/typescript-eslint/typescript-eslint/issues/3677)) ([4bfa437](https://github.com/typescript-eslint/typescript-eslint/commit/4bfa4375aff8f65057d4aa116e435803cbc6b464)) - -# [4.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.3...v4.30.0) (2021-08-30) - -### Features - -- **experimental-utils:** add literal types to `global` option ([#3634](https://github.com/typescript-eslint/typescript-eslint/issues/3634)) ([820965c](https://github.com/typescript-eslint/typescript-eslint/commit/820965c41c58be918770ff6bbae313c0cfc75d3c)) - -## [4.29.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.2...v4.29.3) (2021-08-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.29.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.1...v4.29.2) (2021-08-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.29.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.29.0...v4.29.1) (2021-08-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.5...v4.29.0) (2021-08-02) - -### Bug Fixes - -- **experimental-utils:** simplify `eslint-utils`' `findVariable`'s signature in `ast-utils` ([#3574](https://github.com/typescript-eslint/typescript-eslint/issues/3574)) ([3ef5267](https://github.com/typescript-eslint/typescript-eslint/commit/3ef5267b850e1ffb7115e263e89a98c455fd2532)) - -### Features - -- **ast-spec:** make `BaseNode` & `BaseToken` more type-safe ([#3560](https://github.com/typescript-eslint/typescript-eslint/issues/3560)) ([a6c5604](https://github.com/typescript-eslint/typescript-eslint/commit/a6c5604b65b6330d047aa016fc46b8a597a6ae58)) - -## [4.28.5](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.4...v4.28.5) (2021-07-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.4](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.3...v4.28.4) (2021-07-19) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.3](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.2...v4.28.3) (2021-07-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.1...v4.28.2) (2021-07-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.28.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.28.0...v4.28.1) (2021-06-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.27.0...v4.28.0) (2021-06-21) - -### Bug Fixes - -- **experimental-utils:** expand `RuleTester` config properties ([#3557](https://github.com/typescript-eslint/typescript-eslint/issues/3557)) ([ffbb3cf](https://github.com/typescript-eslint/typescript-eslint/commit/ffbb3cff18bc78467e70e794f9b1f0e79be4aff7)) -- **experimental-utils:** fix `eslint-utils`' negative predicates' return types ([#3462](https://github.com/typescript-eslint/typescript-eslint/issues/3462)) ([1e6016b](https://github.com/typescript-eslint/typescript-eslint/commit/1e6016b356ae40e4636a3cbe41fa02b6a61403ee)) -- **experimental-utils:** fix `eslint-utils`' negative predicates' return types in `ast-utils` ([#3461](https://github.com/typescript-eslint/typescript-eslint/issues/3461)) ([614b0a3](https://github.com/typescript-eslint/typescript-eslint/commit/614b0a38b4163eb4667cce7a415d534222d15dd3)) -- **experimental-utils:** make keys for `ReferenceTracker` options optional ([#3531](https://github.com/typescript-eslint/typescript-eslint/issues/3531)) ([a7fd7bb](https://github.com/typescript-eslint/typescript-eslint/commit/a7fd7bb25584cb3f72f0339025dc76efa6cccceb)) - -### Features - -- **experimental-utils:** add `only` property to `RuleTester` types ([#3555](https://github.com/typescript-eslint/typescript-eslint/issues/3555)) ([2a36e3e](https://github.com/typescript-eslint/typescript-eslint/commit/2a36e3e737f935cc6b967befb022d10a83c8bc9b)) -- **experimental-utils:** expose ReferenceTracker.ESM ([#3532](https://github.com/typescript-eslint/typescript-eslint/issues/3532)) ([4ac67c4](https://github.com/typescript-eslint/typescript-eslint/commit/4ac67c4c9401c5ce0e947a6409efbc11afe1eb3b)) -- **experimental-utils:** use mergable interface for `settings` property ([#3556](https://github.com/typescript-eslint/typescript-eslint/issues/3556)) ([abfc19b](https://github.com/typescript-eslint/typescript-eslint/commit/abfc19bf9364d881bdf594ee166a1deb23240630)) - -# [4.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.1...v4.27.0) (2021-06-14) - -### Bug Fixes - -- **typescript-estree:** allow providing more one than one existing program in config ([#3508](https://github.com/typescript-eslint/typescript-eslint/issues/3508)) ([4f1806e](https://github.com/typescript-eslint/typescript-eslint/commit/4f1806e548affb7265da360d1fc8d033e25de325)) - -## [4.26.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.26.0...v4.26.1) (2021-06-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.25.0...v4.26.0) (2021-05-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.24.0...v4.25.0) (2021-05-24) - -### Bug Fixes - -- **experimental-utils:** fix `isAwaitKeyword` predicate in ast-utils ([#3290](https://github.com/typescript-eslint/typescript-eslint/issues/3290)) ([c15da67](https://github.com/typescript-eslint/typescript-eslint/commit/c15da67b939b615ed063291cde12c55c0d6d236e)) - -# [4.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.23.0...v4.24.0) (2021-05-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.1...v4.23.0) (2021-05-10) - -### Features - -- **experimental-utils:** Include `getCwd()` in `RuleContext` type ([#3308](https://github.com/typescript-eslint/typescript-eslint/issues/3308)) ([2b75c11](https://github.com/typescript-eslint/typescript-eslint/commit/2b75c11d69bee88ca0cb77d7efd32b8d0387e6b3)) -- refactor to split AST specification out as its own module ([#2911](https://github.com/typescript-eslint/typescript-eslint/issues/2911)) ([25ea953](https://github.com/typescript-eslint/typescript-eslint/commit/25ea953cc60b118bd385c71e0a9b61c286c26fcf)) - -## [4.22.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.22.0...v4.22.1) (2021-05-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.21.0...v4.22.0) (2021-04-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.20.0...v4.21.0) (2021-04-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.19.0...v4.20.0) (2021-03-29) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.18.0...v4.19.0) (2021-03-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.17.0...v4.18.0) (2021-03-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.1...v4.17.0) (2021-03-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.16.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.16.0...v4.16.1) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.2...v4.16.0) (2021-03-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.15.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.1...v4.15.2) (2021-02-22) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.15.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.15.0...v4.15.1) (2021-02-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.2...v4.15.0) (2021-02-08) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.14.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.1...v4.14.2) (2021-02-01) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.14.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.14.0...v4.14.1) (2021-01-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.13.0...v4.14.0) (2021-01-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.12.0...v4.13.0) (2021-01-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.1...v4.12.0) (2021-01-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.11.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.11.0...v4.11.1) (2020-12-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.10.0...v4.11.0) (2020-12-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.1...v4.10.0) (2020-12-14) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.9.0...v4.9.1) (2020-12-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.2...v4.9.0) (2020-11-30) - -### Features - -- **eslint-plugin:** [no-unused-vars] fork the base rule ([#2768](https://github.com/typescript-eslint/typescript-eslint/issues/2768)) ([a8227a6](https://github.com/typescript-eslint/typescript-eslint/commit/a8227a6185dd24de4bfc7d766931643871155021)), closes [#2782](https://github.com/typescript-eslint/typescript-eslint/issues/2782) [#2714](https://github.com/typescript-eslint/typescript-eslint/issues/2714) [#2648](https://github.com/typescript-eslint/typescript-eslint/issues/2648) - -## [4.8.2](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.1...v4.8.2) (2020-11-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.8.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.8.0...v4.8.1) (2020-11-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.7.0...v4.8.0) (2020-11-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.1...v4.7.0) (2020-11-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.6.0...v4.6.1) (2020-11-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.5.0...v4.6.0) (2020-10-26) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.1...v4.5.0) (2020-10-19) - -### Features - -- **typescript-estree:** add flag EXPERIMENTAL_useSourceOfProjectReferenceRedirect ([#2669](https://github.com/typescript-eslint/typescript-eslint/issues/2669)) ([90a5878](https://github.com/typescript-eslint/typescript-eslint/commit/90a587845088da1b205e4d7d77dbc3f9447b1c5a)) - -## [4.4.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.4.0...v4.4.1) (2020-10-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.3.0...v4.4.0) (2020-10-05) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.2.0...v4.3.0) (2020-09-28) - -### Bug Fixes - -- **experimental-utils:** treat RuleTester arrays as readonly ([#2601](https://github.com/typescript-eslint/typescript-eslint/issues/2601)) ([8025777](https://github.com/typescript-eslint/typescript-eslint/commit/80257776b78bd2b2b4389d6bd530b009a75fb520)) - -# [4.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.1...v4.2.0) (2020-09-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.1.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.1.0...v4.1.1) (2020-09-14) - -### Bug Fixes - -- **eslint-plugin:** [no-use-before-define] false positive for function type arguments ([#2554](https://github.com/typescript-eslint/typescript-eslint/issues/2554)) ([189162d](https://github.com/typescript-eslint/typescript-eslint/commit/189162d46ecb116c420232937a7f86df913f4e79)), closes [#2527](https://github.com/typescript-eslint/typescript-eslint/issues/2527) - -# [4.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.1...v4.1.0) (2020-09-07) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [4.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v4.0.0...v4.0.1) (2020-08-31) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [4.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.1...v4.0.0) (2020-08-31) - -## [Please see the release notes for v4.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0) - -### Features - -- consume new scope analysis package ([#2039](https://github.com/typescript-eslint/typescript-eslint/issues/2039)) ([3be125d](https://github.com/typescript-eslint/typescript-eslint/commit/3be125d9bdbee1984ac6037874edf619213bd3d0)) -- support ESTree optional chaining representation ([#2308](https://github.com/typescript-eslint/typescript-eslint/issues/2308)) ([e9d2ab6](https://github.com/typescript-eslint/typescript-eslint/commit/e9d2ab638b6767700b52797e74b814ea059beaae)) - -## [3.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.10.0...v3.10.1) (2020-08-25) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.1...v3.10.0) (2020-08-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [3.9.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.9.0...v3.9.1) (2020-08-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.8.0...v3.9.0) (2020-08-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.1...v3.8.0) (2020-08-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [3.7.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.7.0...v3.7.1) (2020-07-27) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.1...v3.7.0) (2020-07-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [3.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.6.0...v3.6.1) (2020-07-13) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.5.0...v3.6.0) (2020-07-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.4.0...v3.5.0) (2020-06-29) - -### Features - -- add package scope-manager ([#1939](https://github.com/typescript-eslint/typescript-eslint/issues/1939)) ([682eb7e](https://github.com/typescript-eslint/typescript-eslint/commit/682eb7e009c3f22a542882dfd3602196a60d2a1e)) -- split types into their own package ([#2229](https://github.com/typescript-eslint/typescript-eslint/issues/2229)) ([5f45918](https://github.com/typescript-eslint/typescript-eslint/commit/5f4591886f3438329fbf2229b03ac66174334a24)) - -# [3.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.3.0...v3.4.0) (2020-06-22) - -### Bug Fixes - -- **experimental-utils:** correct types for TS versions older than 3.8 ([#2217](https://github.com/typescript-eslint/typescript-eslint/issues/2217)) ([5e4dda2](https://github.com/typescript-eslint/typescript-eslint/commit/5e4dda264a7d6a6a1626848e7599faea1ac34922)) -- **experimental-utils:** getParserServices takes a readonly context ([#2235](https://github.com/typescript-eslint/typescript-eslint/issues/2235)) ([26da8de](https://github.com/typescript-eslint/typescript-eslint/commit/26da8de7fcde9eddec63212d79af781c4bb22991)) - -# [3.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.2.0...v3.3.0) (2020-06-15) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [3.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.1.0...v3.2.0) (2020-06-08) - -### Bug Fixes - -- **eslint-plugin:** [prefer-optional-chain] handling first member expression ([#2156](https://github.com/typescript-eslint/typescript-eslint/issues/2156)) ([de18660](https://github.com/typescript-eslint/typescript-eslint/commit/de18660a8cf8f7033798646d8c5b0938d1accb12)) - -# [3.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.2...v3.1.0) (2020-06-01) - -### Bug Fixes - -- **experimental-utils:** downlevel type declarations for versions older than 3.8 ([#2133](https://github.com/typescript-eslint/typescript-eslint/issues/2133)) ([7925823](https://github.com/typescript-eslint/typescript-eslint/commit/792582326a8065270b69a0ffcaad5a7b4b103ff3)) - -### Features - -- **eslint-plugin:** [explicit-module-boundary-types] improve accuracy and coverage ([#2135](https://github.com/typescript-eslint/typescript-eslint/issues/2135)) ([caaa859](https://github.com/typescript-eslint/typescript-eslint/commit/caaa8599284d02ab3341e282cad35a52d0fb86c7)) - -## [3.0.2](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.1...v3.0.2) (2020-05-27) - -### Bug Fixes - -- regression for eslint v6 ([#2105](https://github.com/typescript-eslint/typescript-eslint/issues/2105)) ([31fc503](https://github.com/typescript-eslint/typescript-eslint/commit/31fc5039ed919e1515fda673c186d5c83eb5beb3)) - -## [3.0.1](https://github.com/typescript-eslint/typescript-eslint/compare/v3.0.0...v3.0.1) (2020-05-25) - -### Bug Fixes - -- **experimental-utils:** export `CLIEngine` & `ESLint` ([#2083](https://github.com/typescript-eslint/typescript-eslint/issues/2083)) ([014341b](https://github.com/typescript-eslint/typescript-eslint/commit/014341bb23261f609fc2a6fe7fece191466a084a)) - -# [3.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.34.0...v3.0.0) (2020-05-21) - -## [Please see the release notes for v3.0.0](https://github.com/typescript-eslint/typescript-eslint/releases/tag/v3.0.0) - -### Bug Fixes - -- **experimental-utils:** add back SourceCode.isSpaceBetweenTokens ([ae82ea4](https://github.com/typescript-eslint/typescript-eslint/commit/ae82ea4a85a4ca332ebe6104e96c59dba30411be)) -- **typescript-estree:** remove now defunct `Import` node type ([f199cbd](https://github.com/typescript-eslint/typescript-eslint/commit/f199cbdbbd892b5ba03bfff66f463f3d9c92ee9b)) - -### Features - -- **experimental-utils:** upgrade eslint types for v7 ([#2023](https://github.com/typescript-eslint/typescript-eslint/issues/2023)) ([06869c9](https://github.com/typescript-eslint/typescript-eslint/commit/06869c9656fa37936126666845aee40aad546ebd)) -- drop support for node v8 ([#1997](https://github.com/typescript-eslint/typescript-eslint/issues/1997)) ([b6c3b7b](https://github.com/typescript-eslint/typescript-eslint/commit/b6c3b7b84b8d199fa75a46432febd4a364a63217)) -- upgrade to ESLint v7 ([#2022](https://github.com/typescript-eslint/typescript-eslint/issues/2022)) ([208de71](https://github.com/typescript-eslint/typescript-eslint/commit/208de71059746bf38e94bd460346ffb2698a3e12)) -- **eslint-plugin:** [ban-types] rework default options ([#848](https://github.com/typescript-eslint/typescript-eslint/issues/848)) ([8e31d5d](https://github.com/typescript-eslint/typescript-eslint/commit/8e31d5dbe9fe5227fdbefcecfd50ce5dd51360c3)) -- **typescript-estree:** always return parserServices ([#716](https://github.com/typescript-eslint/typescript-eslint/issues/716)) ([5b23443](https://github.com/typescript-eslint/typescript-eslint/commit/5b23443c48f3f62424db3e742243f3568080b946)) - -# [2.34.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.33.0...v2.34.0) (2020-05-18) - -### Features - -- **experimental-utils:** add `suggestion` property for rule modules ([#2033](https://github.com/typescript-eslint/typescript-eslint/issues/2033)) ([f42a5b0](https://github.com/typescript-eslint/typescript-eslint/commit/f42a5b09ebfa173f418a99c552b0cbe221567194)) - -# [2.33.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.32.0...v2.33.0) (2020-05-12) - -### Bug Fixes - -- **experimental-utils:** remove accidental dep on json-schema ([#2010](https://github.com/typescript-eslint/typescript-eslint/issues/2010)) ([1875fba](https://github.com/typescript-eslint/typescript-eslint/commit/1875fbad41f2a3dda8f610f5dcd180c6205b73d3)) - -# [2.32.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.31.0...v2.32.0) (2020-05-11) - -### Features - -- bump dependencies and align AST ([#2007](https://github.com/typescript-eslint/typescript-eslint/issues/2007)) ([18668b7](https://github.com/typescript-eslint/typescript-eslint/commit/18668b78fd7d1e5281af7fc26c76e0ca53297f69)) - -# [2.31.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.30.0...v2.31.0) (2020-05-04) - -### Features - -- **experimental-utils:** expose our RuleTester extension ([#1948](https://github.com/typescript-eslint/typescript-eslint/issues/1948)) ([2dd1638](https://github.com/typescript-eslint/typescript-eslint/commit/2dd1638aaa2658ba99b2341861146b586f489121)) - -# [2.30.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.29.0...v2.30.0) (2020-04-27) - -### Features - -- **experimental-utils:** allow rule options to be a readonly tuple ([#1924](https://github.com/typescript-eslint/typescript-eslint/issues/1924)) ([4ef6788](https://github.com/typescript-eslint/typescript-eslint/commit/4ef67884962b6aac61cc895aaa3ba16aa892ecf4)) - -# [2.29.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.28.0...v2.29.0) (2020-04-20) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.28.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.27.0...v2.28.0) (2020-04-13) - -### Features - -- **eslint-plugin:** add rule `prefer-reduce-type-parameter` ([#1707](https://github.com/typescript-eslint/typescript-eslint/issues/1707)) ([c92d240](https://github.com/typescript-eslint/typescript-eslint/commit/c92d240e49113779053eac32038382b282812afc)) - -# [2.27.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.26.0...v2.27.0) (2020-04-06) - -### Features - -- **experimental-utils:** add types for suggestions from CLIEngine ([#1844](https://github.com/typescript-eslint/typescript-eslint/issues/1844)) ([7c11bd6](https://github.com/typescript-eslint/typescript-eslint/commit/7c11bd66f2d0e5ea9d3943e6b8c66e6ddff50862)) -- **experimental-utils:** update eslint types to match v6.8 ([#1846](https://github.com/typescript-eslint/typescript-eslint/issues/1846)) ([16ce74d](https://github.com/typescript-eslint/typescript-eslint/commit/16ce74d247781ac890dc0baa30c384f97e581b6b)) - -# [2.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.25.0...v2.26.0) (2020-03-30) - -### Features - -- **typescript-estree:** add option to ignore certain folders from glob resolution ([#1802](https://github.com/typescript-eslint/typescript-eslint/issues/1802)) ([1e29e69](https://github.com/typescript-eslint/typescript-eslint/commit/1e29e69b289d61107a7de67592beae331ba50222)) - -# [2.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.24.0...v2.25.0) (2020-03-23) - -### Features - -- **experimental-utils:** expose ast utility functions ([#1670](https://github.com/typescript-eslint/typescript-eslint/issues/1670)) ([3eb5d45](https://github.com/typescript-eslint/typescript-eslint/commit/3eb5d4525e95c8ab990f55588b8d830a02ce5a9c)) - -# [2.24.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.23.0...v2.24.0) (2020-03-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.23.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.22.0...v2.23.0) (2020-03-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.22.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.21.0...v2.22.0) (2020-03-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.21.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.20.0...v2.21.0) (2020-02-24) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.20.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.2...v2.20.0) (2020-02-17) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.19.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.1...v2.19.2) (2020-02-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.19.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.19.0...v2.19.1) (2020-02-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.19.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.18.0...v2.19.0) (2020-02-03) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) - -### Bug Fixes - -- improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) -- **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) - -### Features - -- **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) -- **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) - -# [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) - -### Features - -- **experimental-utils:** expose getParserServices from utils ([#1448](https://github.com/typescript-eslint/typescript-eslint/issues/1448)) ([982c8bc](https://github.com/typescript-eslint/typescript-eslint/commit/982c8bc)) - -# [2.16.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.15.0...v2.16.0) (2020-01-13) - -### Features - -- **typescript-estree:** add parserOption to turn on debug logs ([#1413](https://github.com/typescript-eslint/typescript-eslint/issues/1413)) ([25092fd](https://github.com/typescript-eslint/typescript-eslint/commit/25092fd)) -- **typescript-estree:** add strict type mapping to esTreeNodeToTSNodeMap ([#1382](https://github.com/typescript-eslint/typescript-eslint/issues/1382)) ([d3d70a3](https://github.com/typescript-eslint/typescript-eslint/commit/d3d70a3)) - -# [2.15.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.14.0...v2.15.0) (2020-01-06) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.14.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.13.0...v2.14.0) (2019-12-30) - -### Features - -- add internal eslint plugin for repo-specific lint rules ([#1373](https://github.com/typescript-eslint/typescript-eslint/issues/1373)) ([3a15413](https://github.com/typescript-eslint/typescript-eslint/commit/3a15413)) - -# [2.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.12.0...v2.13.0) (2019-12-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.11.0...v2.12.0) (2019-12-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.10.0...v2.11.0) (2019-12-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.9.0...v2.10.0) (2019-12-02) - -### Features - -- **eslint-plugin:** [no-non-null-assert] add suggestion fixer ([#1260](https://github.com/typescript-eslint/typescript-eslint/issues/1260)) ([e350a21](https://github.com/typescript-eslint/typescript-eslint/commit/e350a21)) -- **experimental-utils:** add isSpaceBetween declaration to Sou… ([#1268](https://github.com/typescript-eslint/typescript-eslint/issues/1268)) ([f83f04b](https://github.com/typescript-eslint/typescript-eslint/commit/f83f04b)) - -# [2.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.8.0...v2.9.0) (2019-11-25) - -### Features - -- suggestion types, suggestions for no-explicit-any ([#1250](https://github.com/typescript-eslint/typescript-eslint/issues/1250)) ([b16a4b6](https://github.com/typescript-eslint/typescript-eslint/commit/b16a4b6)) -- **eslint-plugin:** add prefer-nullish-coalescing ([#1069](https://github.com/typescript-eslint/typescript-eslint/issues/1069)) ([a9cd399](https://github.com/typescript-eslint/typescript-eslint/commit/a9cd399)) -- **eslint-plugin:** add rule prefer-optional-chain ([#1213](https://github.com/typescript-eslint/typescript-eslint/issues/1213)) ([ad7e1a7](https://github.com/typescript-eslint/typescript-eslint/commit/ad7e1a7)) - -# [2.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.7.0...v2.8.0) (2019-11-18) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.7.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.1...v2.7.0) (2019-11-11) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.6.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.6.0...v2.6.1) (2019-11-04) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.6.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.5.0...v2.6.0) (2019-10-28) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.5.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.4.0...v2.5.0) (2019-10-21) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.4.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.3...v2.4.0) (2019-10-14) - -### Bug Fixes - -- support long running "watch" lint sessions ([#973](https://github.com/typescript-eslint/typescript-eslint/issues/973)) ([854620e](https://github.com/typescript-eslint/typescript-eslint/commit/854620e)) - -### Features - -- **typescript-estree:** support for parsing 3.7 features ([#1045](https://github.com/typescript-eslint/typescript-eslint/issues/1045)) ([623febf](https://github.com/typescript-eslint/typescript-eslint/commit/623febf)) - -## [2.3.3](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.2...v2.3.3) (2019-10-07) - -### Bug Fixes - -- **experimental-utils:** remove Rule.meta.extraDescription ([#1036](https://github.com/typescript-eslint/typescript-eslint/issues/1036)) ([192e23d](https://github.com/typescript-eslint/typescript-eslint/commit/192e23d)) - -## [2.3.2](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.1...v2.3.2) (2019-09-30) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [2.3.1](https://github.com/typescript-eslint/typescript-eslint/compare/v2.3.0...v2.3.1) (2019-09-23) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.3.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.2.0...v2.3.0) (2019-09-16) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.2.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.1.0...v2.2.0) (2019-09-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.1.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.0.0...v2.1.0) (2019-09-02) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [2.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.13.0...v2.0.0) (2019-08-13) - -### Bug Fixes - -- **eslint-plugin:** add `Literal` to `RuleListener` types ([#824](https://github.com/typescript-eslint/typescript-eslint/issues/824)) ([3c902a1](https://github.com/typescript-eslint/typescript-eslint/commit/3c902a1)) -- **utils:** add ES2019 as valid `ecmaVersion` ([#746](https://github.com/typescript-eslint/typescript-eslint/issues/746)) ([d11fbbe](https://github.com/typescript-eslint/typescript-eslint/commit/d11fbbe)) - -### Features - -- explicitly support eslint v6 ([#645](https://github.com/typescript-eslint/typescript-eslint/issues/645)) ([34a7cf6](https://github.com/typescript-eslint/typescript-eslint/commit/34a7cf6)) - -- feat(eslint-plugin)!: recommended-requiring-type-checking config (#846) ([d3470c9](https://github.com/typescript-eslint/typescript-eslint/commit/d3470c9)), closes [#846](https://github.com/typescript-eslint/typescript-eslint/issues/846) -- feat(eslint-plugin)!: change recommended config (#729) ([428567d](https://github.com/typescript-eslint/typescript-eslint/commit/428567d)), closes [#729](https://github.com/typescript-eslint/typescript-eslint/issues/729) -- feat(eslint-plugin)!: add rule `consistent-type-assertions` (#731) ([92e98de](https://github.com/typescript-eslint/typescript-eslint/commit/92e98de)), closes [#731](https://github.com/typescript-eslint/typescript-eslint/issues/731) - -### BREAKING CHANGES - -- removed some rules from recommended config -- recommended config changes are considered breaking -- Merges both no-angle-bracket-type-assertion and no-object-literal-type-assertion into one rule -- Node 6 is no longer supported - -# [1.13.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.12.0...v1.13.0) (2019-07-21) - -### Bug Fixes - -- Correct `@types/json-schema` dependency ([#675](https://github.com/typescript-eslint/typescript-eslint/issues/675)) ([a5398ce](https://github.com/typescript-eslint/typescript-eslint/commit/a5398ce)) -- **utils:** move `typescript` from peer dep to dev dep ([#712](https://github.com/typescript-eslint/typescript-eslint/issues/712)) ([f949355](https://github.com/typescript-eslint/typescript-eslint/commit/f949355)) -- **utils:** RuleTester should not require a parser ([#713](https://github.com/typescript-eslint/typescript-eslint/issues/713)) ([158a417](https://github.com/typescript-eslint/typescript-eslint/commit/158a417)) - -### Features - -- **eslint-plugin:** add new rule no-misused-promises ([#612](https://github.com/typescript-eslint/typescript-eslint/issues/612)) ([28a131d](https://github.com/typescript-eslint/typescript-eslint/commit/28a131d)) - -# [1.12.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.11.0...v1.12.0) (2019-07-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) - -### Bug Fixes - -- **eslint-plugin:** Remove duplicated code ([#611](https://github.com/typescript-eslint/typescript-eslint/issues/611)) ([c4df4ff](https://github.com/typescript-eslint/typescript-eslint/commit/c4df4ff)) - -### Features - -- **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) - -## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -## [1.10.1](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.0...v1.10.1) (2019-06-09) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [1.10.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.9.0...v1.10.0) (2019-06-09) - -### Bug Fixes - -- **experimental-utils:** add `endLine` and `endColumn` ([#517](https://github.com/typescript-eslint/typescript-eslint/issues/517)) ([d9e5f15](https://github.com/typescript-eslint/typescript-eslint/commit/d9e5f15)) -- **experimental-utils:** Avoid typescript import at runtime ([#584](https://github.com/typescript-eslint/typescript-eslint/issues/584)) ([fac5c7d](https://github.com/typescript-eslint/typescript-eslint/commit/fac5c7d)), closes [/github.com/typescript-eslint/typescript-eslint/pull/425#issuecomment-498162293](https://github.com//github.com/typescript-eslint/typescript-eslint/pull/425/issues/issuecomment-498162293) - -### Features - -- make utils/TSESLint export typed classes instead of just types ([#526](https://github.com/typescript-eslint/typescript-eslint/issues/526)) ([370ac72](https://github.com/typescript-eslint/typescript-eslint/commit/370ac72)) -- support TypeScript versions >=3.2.1 <3.6.0 ([#597](https://github.com/typescript-eslint/typescript-eslint/issues/597)) ([5d2b962](https://github.com/typescript-eslint/typescript-eslint/commit/5d2b962)) - -# [1.9.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.8.0...v1.9.0) (2019-05-12) - -**Note:** Version bump only for package @typescript-eslint/experimental-utils - -# [1.8.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.7.0...v1.8.0) (2019-05-10) - -### Features - -- Move shared types into their own package ([#425](https://github.com/typescript-eslint/typescript-eslint/issues/425)) ([a7a03ce](https://github.com/typescript-eslint/typescript-eslint/commit/a7a03ce)) diff --git a/packages/experimental-utils/README.md b/packages/experimental-utils/README.md deleted file mode 100644 index a285229f638..00000000000 --- a/packages/experimental-utils/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# `@typescript-eslint/experimental-utils` - -Utilities for working with TypeScript + ESLint together. - -[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/experimental-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/experimental-utils) -[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/experimental-utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/experimental-utils) - -## Note - -**This package is purely a re-export of `@typescript-eslint/utils`.** -You should switch to importing from that non-experimental package instead. - -```diff -- import { RuleCreator } from '@typescript-eslint/experimental-utils'; -+ import { RuleCreator } from '@typescript-eslint/utils'; -``` - -> ⚠ A future major version of this old package will `console.warn` to ask you to switch. - -## Contributing - -[See the contributing guide here](https://typescript-eslint.io). diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json deleted file mode 100644 index 16aaf18752b..00000000000 --- a/packages/experimental-utils/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@typescript-eslint/experimental-utils", - "version": "5.56.0", - "description": "(Experimental) Utilities for working with TypeScript + ESLint together", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "files": [ - "dist", - "_ts3.4", - "package.json", - "README.md", - "LICENSE" - ], - "repository": { - "type": "git", - "url": "https://github.com/typescript-eslint/typescript-eslint.git", - "directory": "packages/experimental-utils" - }, - "bugs": { - "url": "https://github.com/typescript-eslint/typescript-eslint/issues" - }, - "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", - "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "nx lint", - "typecheck": "tsc -p tsconfig.json --noEmit" - }, - "dependencies": { - "@typescript-eslint/utils": "5.56.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "devDependencies": { - "typescript": "*" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } -} diff --git a/packages/experimental-utils/src/index.ts b/packages/experimental-utils/src/index.ts deleted file mode 100644 index ae481e0310b..00000000000 --- a/packages/experimental-utils/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -// TODO (#4139): Once typescript-eslint hits v7, this package will console.warn to switch... -export * from '@typescript-eslint/utils'; diff --git a/packages/experimental-utils/tsconfig.json b/packages/experimental-utils/tsconfig.json deleted file mode 100644 index 20ea2496c6b..00000000000 --- a/packages/experimental-utils/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "composite": false, - "rootDir": "." - }, - "include": ["src", "typings", "tests", "tools"], - "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } - ] -} diff --git a/packages/integration-tests/CHANGELOG.md b/packages/integration-tests/CHANGELOG.md new file mode 100644 index 00000000000..75be7c8d5ac --- /dev/null +++ b/packages/integration-tests/CHANGELOG.md @@ -0,0 +1,13 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Features + +* **eslint-plugin:** final final config changes for v6 ([#7157](https://github.com/typescript-eslint/typescript-eslint/issues/7157)) ([e35c5c1](https://github.com/typescript-eslint/typescript-eslint/commit/e35c5c1c39f3d76b916ad1c1ac2c7bf05b379193)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. diff --git a/tests/integration/README.md b/packages/integration-tests/README.md similarity index 86% rename from tests/integration/README.md rename to packages/integration-tests/README.md index 689dca29211..1c3d4745c83 100644 --- a/tests/integration/README.md +++ b/packages/integration-tests/README.md @@ -6,7 +6,7 @@ These tests are setup to run within temporary folders to ensure that each test i ## Adding a new integration test -1. Add a new folder in `/tests/integration/fixtures` +1. Add a new folder in `/fixtures/` 1. Add a `package.json` to your folder. 1. List the required dependencies under `devDependencies`. - Use `latest` for the dependency to ensure we are testing against the newest versions of the package. @@ -15,11 +15,11 @@ These tests are setup to run within temporary folders to ensure that each test i 1. Create the necessary files to test the integration. - Your test should have a lint error in it in an appropriate location. This is so that we can be certain the setup actually works correctly. -1. Add a test to `/tests/integration/tests` named the same as your folder. +1. Add a test to `/tests/` named the same as your folder. 1. Paste the following content into your test: ```ts - import { integrationTest } from '../integration-test-base'; + import { integrationTest } from '../tools/integration-test-base'; integrationTest( __filename, diff --git a/tests/integration/fixtures/eslint-v6/.eslintrc.js b/packages/integration-tests/fixtures/eslint-v7/.eslintrc.js similarity index 100% rename from tests/integration/fixtures/eslint-v6/.eslintrc.js rename to packages/integration-tests/fixtures/eslint-v7/.eslintrc.js diff --git a/tests/integration/fixtures/eslint-v6/index.ts b/packages/integration-tests/fixtures/eslint-v7/index.ts similarity index 100% rename from tests/integration/fixtures/eslint-v6/index.ts rename to packages/integration-tests/fixtures/eslint-v7/index.ts diff --git a/tests/integration/fixtures/eslint-v6/package.json b/packages/integration-tests/fixtures/eslint-v7/package.json similarity index 58% rename from tests/integration/fixtures/eslint-v6/package.json rename to packages/integration-tests/fixtures/eslint-v7/package.json index 71c2f5590c5..d939ab3f81c 100644 --- a/tests/integration/fixtures/eslint-v6/package.json +++ b/packages/integration-tests/fixtures/eslint-v7/package.json @@ -1,5 +1,5 @@ { "devDependencies": { - "eslint": "6.0.0" + "eslint": "7.0.0" } } diff --git a/packages/eslint-plugin-tslint/tests/tsconfig.json b/packages/integration-tests/fixtures/eslint-v7/tsconfig.json similarity index 100% rename from packages/eslint-plugin-tslint/tests/tsconfig.json rename to packages/integration-tests/fixtures/eslint-v7/tsconfig.json diff --git a/tests/integration/fixtures/markdown/.eslintrc.js b/packages/integration-tests/fixtures/markdown/.eslintrc.js similarity index 100% rename from tests/integration/fixtures/markdown/.eslintrc.js rename to packages/integration-tests/fixtures/markdown/.eslintrc.js diff --git a/tests/integration/fixtures/markdown/Doc.md b/packages/integration-tests/fixtures/markdown/Doc.md similarity index 100% rename from tests/integration/fixtures/markdown/Doc.md rename to packages/integration-tests/fixtures/markdown/Doc.md diff --git a/tests/integration/fixtures/markdown/package.json b/packages/integration-tests/fixtures/markdown/package.json similarity index 100% rename from tests/integration/fixtures/markdown/package.json rename to packages/integration-tests/fixtures/markdown/package.json diff --git a/tests/integration/fixtures/markdown/tsconfig.json b/packages/integration-tests/fixtures/markdown/tsconfig.json similarity index 100% rename from tests/integration/fixtures/markdown/tsconfig.json rename to packages/integration-tests/fixtures/markdown/tsconfig.json diff --git a/tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.js b/packages/integration-tests/fixtures/recommended-does-not-require-program/.eslintrc.js similarity index 100% rename from tests/integration/fixtures/recommended-does-not-require-program/.eslintrc.js rename to packages/integration-tests/fixtures/recommended-does-not-require-program/.eslintrc.js diff --git a/packages/integration-tests/fixtures/recommended-does-not-require-program/index.ts b/packages/integration-tests/fixtures/recommended-does-not-require-program/index.ts new file mode 100644 index 00000000000..5c59896bad3 --- /dev/null +++ b/packages/integration-tests/fixtures/recommended-does-not-require-program/index.ts @@ -0,0 +1 @@ +var foo: unknown = true; diff --git a/tests/integration/fixtures/recommended-does-not-require-program/package.json b/packages/integration-tests/fixtures/recommended-does-not-require-program/package.json similarity index 100% rename from tests/integration/fixtures/recommended-does-not-require-program/package.json rename to packages/integration-tests/fixtures/recommended-does-not-require-program/package.json diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js similarity index 88% rename from tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js rename to packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js index c82da766e2c..c86654dad2d 100644 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js +++ b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/.eslintrc.js @@ -12,7 +12,8 @@ module.exports = { ecmaFeatures: { jsx: false, }, - project: '/usr/linked/tsconfig.json', + tsconfigRootDir: __dirname, + project: './tsconfig.json', }, rules: { '@typescript-eslint/tslint/config': [ diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/index.ts b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/index.ts similarity index 100% rename from tests/integration/fixtures/typescript-and-tslint-plugins-together/index.ts rename to packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/index.ts diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/package.json b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/package.json similarity index 100% rename from tests/integration/fixtures/typescript-and-tslint-plugins-together/package.json rename to packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/package.json diff --git a/tests/integration/fixtures/eslint-v6/tsconfig.json b/packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/tsconfig.json similarity index 100% rename from tests/integration/fixtures/eslint-v6/tsconfig.json rename to packages/integration-tests/fixtures/typescript-and-tslint-plugins-together/tsconfig.json diff --git a/tests/integration/fixtures/vue-jsx/.eslintrc.js b/packages/integration-tests/fixtures/vue-jsx/.eslintrc.js similarity index 100% rename from tests/integration/fixtures/vue-jsx/.eslintrc.js rename to packages/integration-tests/fixtures/vue-jsx/.eslintrc.js diff --git a/tests/integration/fixtures/vue-jsx/Jsx.vue b/packages/integration-tests/fixtures/vue-jsx/Jsx.vue similarity index 100% rename from tests/integration/fixtures/vue-jsx/Jsx.vue rename to packages/integration-tests/fixtures/vue-jsx/Jsx.vue diff --git a/tests/integration/fixtures/vue-jsx/package.json b/packages/integration-tests/fixtures/vue-jsx/package.json similarity index 100% rename from tests/integration/fixtures/vue-jsx/package.json rename to packages/integration-tests/fixtures/vue-jsx/package.json diff --git a/tests/integration/fixtures/vue-jsx/tsconfig.json b/packages/integration-tests/fixtures/vue-jsx/tsconfig.json similarity index 100% rename from tests/integration/fixtures/vue-jsx/tsconfig.json rename to packages/integration-tests/fixtures/vue-jsx/tsconfig.json diff --git a/tests/integration/fixtures/vue-sfc/.eslintrc.js b/packages/integration-tests/fixtures/vue-sfc/.eslintrc.js similarity index 100% rename from tests/integration/fixtures/vue-sfc/.eslintrc.js rename to packages/integration-tests/fixtures/vue-sfc/.eslintrc.js diff --git a/tests/integration/fixtures/vue-sfc/Hello.vue b/packages/integration-tests/fixtures/vue-sfc/Hello.vue similarity index 100% rename from tests/integration/fixtures/vue-sfc/Hello.vue rename to packages/integration-tests/fixtures/vue-sfc/Hello.vue diff --git a/tests/integration/fixtures/vue-sfc/Utility.vue b/packages/integration-tests/fixtures/vue-sfc/Utility.vue similarity index 100% rename from tests/integration/fixtures/vue-sfc/Utility.vue rename to packages/integration-tests/fixtures/vue-sfc/Utility.vue diff --git a/tests/integration/fixtures/vue-sfc/World.vue b/packages/integration-tests/fixtures/vue-sfc/World.vue similarity index 100% rename from tests/integration/fixtures/vue-sfc/World.vue rename to packages/integration-tests/fixtures/vue-sfc/World.vue diff --git a/tests/integration/fixtures/vue-sfc/package.json b/packages/integration-tests/fixtures/vue-sfc/package.json similarity index 100% rename from tests/integration/fixtures/vue-sfc/package.json rename to packages/integration-tests/fixtures/vue-sfc/package.json diff --git a/tests/integration/fixtures/vue-sfc/tsconfig.json b/packages/integration-tests/fixtures/vue-sfc/tsconfig.json similarity index 100% rename from tests/integration/fixtures/vue-sfc/tsconfig.json rename to packages/integration-tests/fixtures/vue-sfc/tsconfig.json diff --git a/tests/integration/jest.config.js b/packages/integration-tests/jest.config.js similarity index 77% rename from tests/integration/jest.config.js rename to packages/integration-tests/jest.config.js index b12a54583fd..cc3649ab275 100644 --- a/tests/integration/jest.config.js +++ b/packages/integration-tests/jest.config.js @@ -5,10 +5,13 @@ require('ts-node').register({ transpileOnly: true, files: ['./pack-packages.ts'], }); -const { tseslintPackages } = require('./pack-packages'); +const { tseslintPackages } = require('./tools/pack-packages'); +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), + collectCoverage: false, globals: { tseslintPackages, }, diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json new file mode 100644 index 00000000000..7dc7599c542 --- /dev/null +++ b/packages/integration-tests/package.json @@ -0,0 +1,15 @@ +{ + "name": "@typescript-eslint/integration-tests", + "version": "6.0.0", + "private": true, + "scripts": { + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "lint": "nx lint", + "test": "jest --no-coverage", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "devDependencies": { + "ncp": "*", + "tmp": "*" + } +} diff --git a/packages/integration-tests/project.json b/packages/integration-tests/project.json new file mode 100644 index 00000000000..8905ec90f41 --- /dev/null +++ b/packages/integration-tests/project.json @@ -0,0 +1,18 @@ +{ + "name": "integration-tests", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "type": "library", + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/integration-tests/**/*.{mts,cts,ts,tsx}" + ], + "ignorePath": ".eslintignore" + } + } + } +} diff --git a/tests/integration/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap b/packages/integration-tests/tests/__snapshots__/eslint-v7.test.ts.snap similarity index 64% rename from tests/integration/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap rename to packages/integration-tests/tests/__snapshots__/eslint-v7.test.ts.snap index 40e5fd8d3da..eb23a06011e 100644 --- a/tests/integration/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap +++ b/packages/integration-tests/tests/__snapshots__/eslint-v7.test.ts.snap @@ -1,42 +1,30 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`recommended-does-not-require-program should lint successfully 1`] = ` +exports[`eslint-v7 should lint successfully 1`] = ` [ { - "errorCount": 0, - "fatalErrorCount": 0, + "errorCount": 1, "filePath": "/index.ts", "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": [ { - "column": 7, - "endColumn": 15, - "endLine": 1, - "line": 1, - "message": "'foo' is assigned a value but never used.", - "messageId": "unusedVar", - "nodeType": "Identifier", - "ruleId": "@typescript-eslint/no-unused-vars", - "severity": 1, - }, - { - "column": 12, - "endColumn": 15, + "column": 15, + "endColumn": 18, "endLine": 1, "line": 1, "message": "Unexpected any. Specify a different type.", "messageId": "unexpectedAny", "nodeType": "TSAnyKeyword", "ruleId": "@typescript-eslint/no-explicit-any", - "severity": 1, + "severity": 2, "suggestions": [ { "desc": "Use \`unknown\` instead, this will force you to explicitly, and safely assert the type is correct.", "fix": { "range": [ - 11, 14, + 17, ], "text": "unknown", }, @@ -46,8 +34,8 @@ exports[`recommended-does-not-require-program should lint successfully 1`] = ` "desc": "Use \`never\` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.", "fix": { "range": [ - 11, 14, + 17, ], "text": "never", }, @@ -56,11 +44,10 @@ exports[`recommended-does-not-require-program should lint successfully 1`] = ` ], }, ], - "output": "const foo: any = true; + "source": "const noSemi: any = true; ", - "suppressedMessages": [], "usedDeprecatedRules": [], - "warningCount": 2, + "warningCount": 0, }, ] `; diff --git a/tests/integration/tests/__snapshots__/markdown.test.ts.snap b/packages/integration-tests/tests/__snapshots__/markdown.test.ts.snap similarity index 100% rename from tests/integration/tests/__snapshots__/markdown.test.ts.snap rename to packages/integration-tests/tests/__snapshots__/markdown.test.ts.snap diff --git a/packages/integration-tests/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap b/packages/integration-tests/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap new file mode 100644 index 00000000000..83a2f0129c9 --- /dev/null +++ b/packages/integration-tests/tests/__snapshots__/recommended-does-not-require-program.test.ts.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`recommended-does-not-require-program should lint successfully 1`] = ` +[ + { + "errorCount": 1, + "fatalErrorCount": 0, + "filePath": "/index.ts", + "fixableErrorCount": 0, + "fixableWarningCount": 0, + "messages": [ + { + "column": 7, + "endColumn": 19, + "endLine": 1, + "line": 1, + "message": "'foo' is assigned a value but never used.", + "messageId": "unusedVar", + "nodeType": "Identifier", + "ruleId": "@typescript-eslint/no-unused-vars", + "severity": 2, + }, + ], + "output": "const foo: unknown = true; +", + "suppressedMessages": [], + "usedDeprecatedRules": [], + "warningCount": 0, + }, +] +`; diff --git a/tests/integration/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap b/packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap similarity index 53% rename from tests/integration/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap rename to packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap index c0d12dd74d1..06affd98eee 100644 --- a/tests/integration/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap +++ b/packages/integration-tests/tests/__snapshots__/typescript-and-tslint-plugins-together.test.ts.snap @@ -4,20 +4,25 @@ exports[`typescript-and-tslint-plugins-together should lint successfully 1`] = ` [ { "errorCount": 1, - "fatalErrorCount": 1, + "fatalErrorCount": 0, "filePath": "/index.ts", "fixableErrorCount": 0, "fixableWarningCount": 0, "messages": [ { - "fatal": true, - "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", - "ruleId": null, + "column": 7, + "endColumn": 13, + "endLine": 2, + "line": 2, + "message": "'noSemi' is assigned a value but never used.", + "messageId": "unusedVar", + "nodeType": "Identifier", + "ruleId": "@typescript-eslint/no-unused-vars", "severity": 2, }, ], - "source": "// prettier-ignore -const noSemi = true + "output": "// prettier-ignore +const noSemi = true; ", "suppressedMessages": [], "usedDeprecatedRules": [], diff --git a/tests/integration/tests/__snapshots__/vue-jsx.test.ts.snap b/packages/integration-tests/tests/__snapshots__/vue-jsx.test.ts.snap similarity index 100% rename from tests/integration/tests/__snapshots__/vue-jsx.test.ts.snap rename to packages/integration-tests/tests/__snapshots__/vue-jsx.test.ts.snap diff --git a/tests/integration/tests/__snapshots__/vue-sfc.test.ts.snap b/packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap similarity index 97% rename from tests/integration/tests/__snapshots__/vue-sfc.test.ts.snap rename to packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap index 107788a6336..54ab2732a85 100644 --- a/tests/integration/tests/__snapshots__/vue-sfc.test.ts.snap +++ b/packages/integration-tests/tests/__snapshots__/vue-sfc.test.ts.snap @@ -12,6 +12,7 @@ exports[`vue-sfc should lint successfully 1`] = ` { "fatal": true, "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "nodeType": null, "ruleId": null, "severity": 2, }, @@ -70,6 +71,7 @@ export default Vue.extend({ { "fatal": true, "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "nodeType": null, "ruleId": null, "severity": 2, }, @@ -104,6 +106,7 @@ export default class Utility { { "fatal": true, "message": "Parsing error: Cannot read file '/usr/linked/tsconfig.json'.", + "nodeType": null, "ruleId": null, "severity": 2, }, diff --git a/packages/integration-tests/tests/eslint-v7.test.ts b/packages/integration-tests/tests/eslint-v7.test.ts new file mode 100644 index 00000000000..8f0d81b8926 --- /dev/null +++ b/packages/integration-tests/tests/eslint-v7.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../tools/integration-test-base'; + +integrationTest(__filename, '*.ts'); diff --git a/packages/integration-tests/tests/markdown.test.ts b/packages/integration-tests/tests/markdown.test.ts new file mode 100644 index 00000000000..8c006309eff --- /dev/null +++ b/packages/integration-tests/tests/markdown.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../tools/integration-test-base'; + +integrationTest(__filename, '*.md'); diff --git a/packages/integration-tests/tests/recommended-does-not-require-program.test.ts b/packages/integration-tests/tests/recommended-does-not-require-program.test.ts new file mode 100644 index 00000000000..8f0d81b8926 --- /dev/null +++ b/packages/integration-tests/tests/recommended-does-not-require-program.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../tools/integration-test-base'; + +integrationTest(__filename, '*.ts'); diff --git a/packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts b/packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts new file mode 100644 index 00000000000..8f0d81b8926 --- /dev/null +++ b/packages/integration-tests/tests/typescript-and-tslint-plugins-together.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../tools/integration-test-base'; + +integrationTest(__filename, '*.ts'); diff --git a/packages/integration-tests/tests/vue-jsx.test.ts b/packages/integration-tests/tests/vue-jsx.test.ts new file mode 100644 index 00000000000..20e6b09b797 --- /dev/null +++ b/packages/integration-tests/tests/vue-jsx.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../tools/integration-test-base'; + +integrationTest(__filename, '*.vue'); diff --git a/packages/integration-tests/tests/vue-sfc.test.ts b/packages/integration-tests/tests/vue-sfc.test.ts new file mode 100644 index 00000000000..20e6b09b797 --- /dev/null +++ b/packages/integration-tests/tests/vue-sfc.test.ts @@ -0,0 +1,3 @@ +import { integrationTest } from '../tools/integration-test-base'; + +integrationTest(__filename, '*.vue'); diff --git a/tests/integration/integration-test-base.ts b/packages/integration-tests/tools/integration-test-base.ts similarity index 89% rename from tests/integration/integration-test-base.ts rename to packages/integration-tests/tools/integration-test-base.ts index f49a4e90a23..e148aee966d 100644 --- a/tests/integration/integration-test-base.ts +++ b/packages/integration-tests/tools/integration-test-base.ts @@ -11,7 +11,7 @@ interface PackageJSON { devDependencies: Record; } -const rootPackageJson: PackageJSON = require('../../package.json'); +const rootPackageJson: PackageJSON = require('../../../package.json'); tmp.setGracefulCleanup(); @@ -23,14 +23,13 @@ const tmpFile = promisify(tmp.file); const writeFile = promisify(fs.writeFile); const BASE_DEPENDENCIES: PackageJSON['devDependencies'] = { - // @ts-expect-error -- this is in `./pack-packages.ts` ...global.tseslintPackages, eslint: rootPackageJson.devDependencies.eslint, typescript: rootPackageJson.devDependencies.typescript, jest: rootPackageJson.devDependencies.jest, }; -const FIXTURES_DIR = path.join(__dirname, 'fixtures'); +const FIXTURES_DIR = path.join(__dirname, '..', 'fixtures'); // make sure that jest doesn't timeout the test jest.setTimeout(60000); @@ -64,7 +63,6 @@ export function integrationTest(testFilename: string, filesGlob: string): void { }, // ensure everything uses the locally packed versions instead of the NPM versions resolutions: { - // @ts-expect-error -- this is in `./pack-packages.ts` ...global.tseslintPackages, }, }), @@ -100,6 +98,7 @@ export function integrationTest(testFilename: string, filesGlob: string): void { // lint, outputting to a JSON file const outFile = await tmpFile(); + let stderr = ''; try { await execFile( 'yarn', @@ -120,6 +119,11 @@ export function integrationTest(testFilename: string, filesGlob: string): void { ); } catch (ex) { // we expect eslint will "fail" because we have intentional lint errors + + // useful for debugging + if (typeof ex === 'object' && ex != null && 'stderr' in ex) { + stderr = String(ex.stderr); + } } // console.log('Lint complete.'); @@ -134,7 +138,9 @@ export function integrationTest(testFilename: string, filesGlob: string): void { const lintOutput = JSON.parse(lintOutputRAW); expect(lintOutput).toMatchSnapshot(); } catch { - throw lintOutputRAW; + throw new Error( + `Lint output could not be parsed as JSON: \`${lintOutputRAW}\`. The error logs from eslint were: \`${stderr}\``, + ); } }); diff --git a/tests/integration/pack-packages.ts b/packages/integration-tests/tools/pack-packages.ts similarity index 95% rename from tests/integration/pack-packages.ts rename to packages/integration-tests/tools/pack-packages.ts index 7674f70a173..5755476cf3c 100644 --- a/tests/integration/pack-packages.ts +++ b/packages/integration-tests/tools/pack-packages.ts @@ -18,7 +18,7 @@ interface PackageJSON { devDependencies: Record; } -const PACKAGES_DIR = path.resolve(__dirname, '..', '..', 'packages'); +const PACKAGES_DIR = path.resolve(__dirname, '..', '..'); const PACKAGES = fs.readdirSync(PACKAGES_DIR); const tarFolder = tmp.dirSync({ diff --git a/packages/integration-tests/tsconfig.build.json b/packages/integration-tests/tsconfig.build.json new file mode 100644 index 00000000000..e7d657f8c5b --- /dev/null +++ b/packages/integration-tests/tsconfig.build.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + // specifically disable declarations for the plugin + "declaration": false, + "declarationMap": false, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "include": ["src", "typings"], + "references": [] +} diff --git a/packages/integration-tests/tsconfig.json b/packages/integration-tests/tsconfig.json new file mode 100644 index 00000000000..23640f1c418 --- /dev/null +++ b/packages/integration-tests/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "typings", "tests", "jest.config.js", "tools"], + "references": [] +} diff --git a/packages/integration-tests/typings/global.d.ts b/packages/integration-tests/typings/global.d.ts new file mode 100644 index 00000000000..1a4c2599eae --- /dev/null +++ b/packages/integration-tests/typings/global.d.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-var +declare var tseslintPackages: Record; diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index e3ed1e8b9aa..c68002f2808 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,207 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* **scope-manager:** ignore ECMA version ([#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889)) ([f2330f7](https://github.com/typescript-eslint/typescript-eslint/commit/f2330f79739eb93e3c290ccc6e810a01e097eda0)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) +* **typescript-estree:** added allowInvalidAST option to not throw on invalid tokens ([#6247](https://github.com/typescript-eslint/typescript-eslint/issues/6247)) ([a3b177d](https://github.com/typescript-eslint/typescript-eslint/commit/a3b177d59adaf8ea76b205befc8b12d86447f1fb)) +* **typescript-estree:** allow providing code as a ts.SourceFile ([#5892](https://github.com/typescript-eslint/typescript-eslint/issues/5892)) ([af41b7f](https://github.com/typescript-eslint/typescript-eslint/commit/af41b7fa7b9b8f3023fdabd40846598d5d4d4f61)) +* **typescript-estree:** deprecate createDefaultProgram ([#5890](https://github.com/typescript-eslint/typescript-eslint/issues/5890)) ([426d6b6](https://github.com/typescript-eslint/typescript-eslint/commit/426d6b647e6df3e312d1cef3e28dadaef6675fd3)) +* **typescript-estree:** remove optionality from AST boolean properties ([#6274](https://github.com/typescript-eslint/typescript-eslint/issues/6274)) ([df131e2](https://github.com/typescript-eslint/typescript-eslint/commit/df131e258c93e5714c88c0373cfeb2e1e75afc75)) + + +### BREAKING CHANGES + +* drop support for ESLint v6 +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/parser + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/parser + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/parser + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + + +### Bug Fixes + +* update getLib for new TypeScript targets ES2021, ES2022 ([#6782](https://github.com/typescript-eslint/typescript-eslint/issues/6782)) ([1c04664](https://github.com/typescript-eslint/typescript-eslint/commit/1c0466414300f338c6c4111f8d1eac0c3e6a8983)) + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/README.md b/packages/parser/README.md index f057b97f868..56ee655a56b 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -5,6 +5,8 @@ [![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/parser.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/parser) [![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/parser.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/parser) -👉 See **https://typescript-eslint.io/architecture/parser** for documentation on this package. +👉 See **https://typescript-eslint.io/packages/parser** for documentation on this package. > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/parser/package.json b/packages/parser/package.json index 06497a80af2..bf6d97207eb 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,17 +1,23 @@ { "name": "@typescript-eslint/parser", - "version": "5.56.0", + "version": "6.0.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", - "main": "dist/index.js", - "types": "dist/index.d.ts", "files": [ "dist", - "_ts3.4", + "_ts4.3", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "repository": { "type": "git", @@ -33,25 +39,25 @@ ], "scripts": { "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", + "postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4" }, "devDependencies": { - "@types/glob": "*", "glob": "*", "typescript": "*" }, @@ -65,9 +71,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } } diff --git a/packages/parser/project.json b/packages/parser/project.json index 39cc9637919..6163ef7c5bf 100644 --- a/packages/parser/project.json +++ b/packages/parser/project.json @@ -5,10 +5,11 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/parser/**/*.ts"] + "lintFilePatterns": ["packages/parser/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts index 7ed83e242d1..9ccf6b17ed8 100644 --- a/packages/parser/src/index.ts +++ b/packages/parser/src/index.ts @@ -1,6 +1,8 @@ export { parse, parseForESLint, ParserOptions } from './parser'; export { ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, clearCaches, createProgram, } from '@typescript-eslint/typescript-estree'; diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index f151cbdc143..8577dd61bcc 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -9,12 +9,10 @@ import type { ParserServices, TSESTreeOptions, } from '@typescript-eslint/typescript-estree'; -import { - parseAndGenerateServices, - visitorKeys, -} from '@typescript-eslint/typescript-estree'; +import { parseAndGenerateServices } from '@typescript-eslint/typescript-estree'; +import { visitorKeys } from '@typescript-eslint/visitor-keys'; import debug from 'debug'; -import type { CompilerOptions } from 'typescript'; +import type * as ts from 'typescript'; import { ScriptTarget } from 'typescript'; const log = debug('typescript-eslint:parser:parser'); @@ -41,23 +39,27 @@ function validateBoolean( } const LIB_FILENAME_REGEX = /lib\.(.+)\.d\.[cm]?ts$/; -function getLib(compilerOptions: CompilerOptions): Lib[] { +function getLib(compilerOptions: ts.CompilerOptions): Lib[] { if (compilerOptions.lib) { - return compilerOptions.lib.reduce((acc, lib) => { + return compilerOptions.lib.reduce((acc, lib) => { const match = LIB_FILENAME_REGEX.exec(lib.toLowerCase()); if (match) { acc.push(match[1] as Lib); } return acc; - }, [] as Lib[]); + }, []); } const target = compilerOptions.target ?? ScriptTarget.ES5; - // https://github.com/Microsoft/TypeScript/blob/59ad375234dc2efe38d8ee0ba58414474c1d5169/src/compiler/utilitiesPublic.ts#L13-L32 + // https://github.com/microsoft/TypeScript/blob/ae582a22ee1bb052e19b7c1bc4cac60509b574e0/src/compiler/utilitiesPublic.ts#L13-L36 switch (target) { case ScriptTarget.ESNext: return ['esnext.full']; + case ScriptTarget.ES2022: + return ['es2022.full']; + case ScriptTarget.ES2021: + return ['es2021.full']; case ScriptTarget.ES2020: return ['es2020.full']; case ScriptTarget.ES2019: @@ -76,14 +78,14 @@ function getLib(compilerOptions: CompilerOptions): Lib[] { } function parse( - code: string, + code: ts.SourceFile | string, options?: ParserOptions, ): ParseForESLintResult['ast'] { return parseForESLint(code, options).ast; } function parseForESLint( - code: string, + code: ts.SourceFile | string, options?: ParserOptions | null, ): ParseForESLintResult { if (!options || typeof options !== 'object') { @@ -105,7 +107,6 @@ function parseForESLint( jsx: validateBoolean(options.ecmaFeatures.jsx), }); const analyzeOptions: AnalyzeOptions = { - ecmaVersion: options.ecmaVersion === 'latest' ? 1e8 : options.ecmaVersion, globalReturn: options.ecmaFeatures.globalReturn, jsxPragma: options.jsxPragma, jsxFragmentName: options.jsxFragmentName, @@ -129,7 +130,7 @@ function parseForESLint( ast.sourceType = options.sourceType; let emitDecoratorMetadata = options.emitDecoratorMetadata === true; - if (services.hasFullTypeInformation) { + if (services.program) { // automatically apply the options configured for the program const compilerOptions = services.program.getCompilerOptions(); if (analyzeOptions.lib == null) { diff --git a/packages/parser/tests/fixtures/basics/do-while-statements.src.js b/packages/parser/tests/fixtures/basics/do-while-statements.src.js index f2c72e8efc5..3ef00852dcb 100644 --- a/packages/parser/tests/fixtures/basics/do-while-statements.src.js +++ b/packages/parser/tests/fixtures/basics/do-while-statements.src.js @@ -1,6 +1,7 @@ -do; while(1); +do; +while (1); var i = 0; do { - i += 1; + i += 1; } while (i < 5); diff --git a/packages/parser/tests/fixtures/basics/identifiers-double-underscore.src.js b/packages/parser/tests/fixtures/basics/identifiers-double-underscore.src.js index b765d562e14..f15cb8edc5a 100644 --- a/packages/parser/tests/fixtures/basics/identifiers-double-underscore.src.js +++ b/packages/parser/tests/fixtures/basics/identifiers-double-underscore.src.js @@ -1,9 +1,5 @@ var __test = 'ff'; -class __Foo { +class __Foo {} -} - -function __Bar() { - -} +function __Bar() {} diff --git a/packages/parser/tests/fixtures/basics/instanceof.src.js b/packages/parser/tests/fixtures/basics/instanceof.src.js index 909f769f83d..501323cfc91 100644 --- a/packages/parser/tests/fixtures/basics/instanceof.src.js +++ b/packages/parser/tests/fixtures/basics/instanceof.src.js @@ -1 +1 @@ -'' instanceof Set \ No newline at end of file +'' instanceof Set; diff --git a/packages/parser/tests/fixtures/basics/new-without-parens.src.js b/packages/parser/tests/fixtures/basics/new-without-parens.src.js index fd30dda06ab..24719857448 100644 --- a/packages/parser/tests/fixtures/basics/new-without-parens.src.js +++ b/packages/parser/tests/fixtures/basics/new-without-parens.src.js @@ -1,2 +1,2 @@ -function X () {} -new X; \ No newline at end of file +function X() {} +new X(); diff --git a/packages/parser/tests/fixtures/basics/typeof-expression.src.js b/packages/parser/tests/fixtures/basics/typeof-expression.src.js index 43d0ea77840..86cf9741979 100644 --- a/packages/parser/tests/fixtures/basics/typeof-expression.src.js +++ b/packages/parser/tests/fixtures/basics/typeof-expression.src.js @@ -1 +1 @@ -typeof 'str' +typeof 'str'; diff --git a/packages/parser/tests/fixtures/basics/update-expression.src.js b/packages/parser/tests/fixtures/basics/update-expression.src.js index 1c94b625bd2..9d77c1d8bda 100644 --- a/packages/parser/tests/fixtures/basics/update-expression.src.js +++ b/packages/parser/tests/fixtures/basics/update-expression.src.js @@ -2,4 +2,4 @@ var i = 0; function f() { i++; } -f(); \ No newline at end of file +f(); diff --git a/packages/parser/tests/fixtures/basics/void-expression.src.js b/packages/parser/tests/fixtures/basics/void-expression.src.js index 7da947c9a45..0ff5f668a4b 100644 --- a/packages/parser/tests/fixtures/basics/void-expression.src.js +++ b/packages/parser/tests/fixtures/basics/void-expression.src.js @@ -1,2 +1,2 @@ void 4; -void(3); +void 3; diff --git a/packages/parser/tests/fixtures/scope-analysis/535.ts b/packages/parser/tests/fixtures/scope-analysis/535.ts index 07dfa609258..a670cd761c2 100644 --- a/packages/parser/tests/fixtures/scope-analysis/535.ts +++ b/packages/parser/tests/fixtures/scope-analysis/535.ts @@ -1,3 +1,3 @@ function foo({ bar }: { bar: string }) { - bar; + bar; } diff --git a/packages/parser/tests/fixtures/scope-analysis/abstract-class.ts b/packages/parser/tests/fixtures/scope-analysis/abstract-class.ts index b71fd3e40cf..2bfac2c4006 100644 --- a/packages/parser/tests/fixtures/scope-analysis/abstract-class.ts +++ b/packages/parser/tests/fixtures/scope-analysis/abstract-class.ts @@ -1,4 +1,4 @@ abstract class A { - abstract a: string - abstract f(): number + abstract a: string; + abstract f(): number; } diff --git a/packages/parser/tests/fixtures/scope-analysis/class-implements.ts b/packages/parser/tests/fixtures/scope-analysis/class-implements.ts index 8da64a02531..5341664a965 100644 --- a/packages/parser/tests/fixtures/scope-analysis/class-implements.ts +++ b/packages/parser/tests/fixtures/scope-analysis/class-implements.ts @@ -1,3 +1 @@ -class Foo implements Component, {}>, Component2 { - -} +class Foo implements Component, {}>, Component2 {} diff --git a/packages/parser/tests/fixtures/scope-analysis/class-properties.ts b/packages/parser/tests/fixtures/scope-analysis/class-properties.ts index c44605051d9..74eb0583183 100644 --- a/packages/parser/tests/fixtures/scope-analysis/class-properties.ts +++ b/packages/parser/tests/fixtures/scope-analysis/class-properties.ts @@ -1,5 +1,5 @@ -const s = Symbol() +const s = Symbol(); class A { - a: typeof s - [s]: number + a: typeof s; + [s]: number; } diff --git a/packages/parser/tests/fixtures/scope-analysis/class-supper-type.ts b/packages/parser/tests/fixtures/scope-analysis/class-supper-type.ts index 14ad843ebe6..6d1280e6a33 100644 --- a/packages/parser/tests/fixtures/scope-analysis/class-supper-type.ts +++ b/packages/parser/tests/fixtures/scope-analysis/class-supper-type.ts @@ -1,11 +1,5 @@ -abstract class Foo extends Bar { +abstract class Foo extends Bar {} -} +declare class Foo2 extends Bar {} -declare class Foo2 extends Bar { - -} - -class Foo3 extends Bar { - -} +class Foo3 extends Bar {} diff --git a/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts b/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts index b821bc7f535..54e86d99c90 100644 --- a/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts +++ b/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-interface.ts @@ -1,5 +1,6 @@ -const s1 = Symbol(), s2 = Symbol() +const s1 = Symbol(), + s2 = Symbol(); interface A { - [s1]: number - [s2](s1: number, s2: number): number; + [s1]: number; + [s2](s1: number, s2: number): number; } diff --git a/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts b/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts index 46f729479dc..bb869c3b1be 100644 --- a/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts +++ b/packages/parser/tests/fixtures/scope-analysis/computed-properties-in-type.ts @@ -1,5 +1,6 @@ -const s1 = Symbol(), s2 = Symbol() +const s1 = Symbol(), + s2 = Symbol(); type A = { - [s1]: number - [s2](s1: number, s2: number): number; -} + [s1]: number; + [s2](s1: number, s2: number): number; +}; diff --git a/packages/parser/tests/fixtures/scope-analysis/declare-function.ts b/packages/parser/tests/fixtures/scope-analysis/declare-function.ts index ea6c15bb9c9..fda662f6bea 100644 --- a/packages/parser/tests/fixtures/scope-analysis/declare-function.ts +++ b/packages/parser/tests/fixtures/scope-analysis/declare-function.ts @@ -1,2 +1,2 @@ -declare function f(a: number): number -f +declare function f(a: number): number; +f; diff --git a/packages/parser/tests/fixtures/scope-analysis/declare-global.ts b/packages/parser/tests/fixtures/scope-analysis/declare-global.ts index 76c4bef203b..4ab135294f5 100644 --- a/packages/parser/tests/fixtures/scope-analysis/declare-global.ts +++ b/packages/parser/tests/fixtures/scope-analysis/declare-global.ts @@ -1,7 +1,7 @@ declare global { - let C: number + let C: number; } -C = 1 +C = 1; -export {} +export {}; diff --git a/packages/parser/tests/fixtures/scope-analysis/declare-module.ts b/packages/parser/tests/fixtures/scope-analysis/declare-module.ts index 9459128702d..b5ba72616b8 100644 --- a/packages/parser/tests/fixtures/scope-analysis/declare-module.ts +++ b/packages/parser/tests/fixtures/scope-analysis/declare-module.ts @@ -1,6 +1,6 @@ -const a = 1 -declare module "foo" { - export const a: number - export const b: typeof a +const a = 1; +declare module 'foo' { + export const a: number; + export const b: typeof a; } -a +a; diff --git a/packages/parser/tests/fixtures/scope-analysis/decorators.ts b/packages/parser/tests/fixtures/scope-analysis/decorators.ts index 34da4b56766..4d3363ea1c1 100644 --- a/packages/parser/tests/fixtures/scope-analysis/decorators.ts +++ b/packages/parser/tests/fixtures/scope-analysis/decorators.ts @@ -1,13 +1,12 @@ -function dec(target: any) { -} +function dec(target: any) {} function gec() { - return (target: any, propertyKey: string) => {} + return (target: any, propertyKey: string) => {}; } @dec class C { - @gec() field: string - @gec() method(): string { - return "" - } + @gec() field: string; + @gec() method(): string { + return ''; + } } diff --git a/packages/parser/tests/fixtures/scope-analysis/enum-string.ts b/packages/parser/tests/fixtures/scope-analysis/enum-string.ts index 754e3263772..da0816a0f5a 100644 --- a/packages/parser/tests/fixtures/scope-analysis/enum-string.ts +++ b/packages/parser/tests/fixtures/scope-analysis/enum-string.ts @@ -1,3 +1,3 @@ enum Foo { - BAR = 'bar' + BAR = 'bar', } diff --git a/packages/parser/tests/fixtures/scope-analysis/enum.ts b/packages/parser/tests/fixtures/scope-analysis/enum.ts index 98464d4e9bb..2865a0ca3dd 100644 --- a/packages/parser/tests/fixtures/scope-analysis/enum.ts +++ b/packages/parser/tests/fixtures/scope-analysis/enum.ts @@ -1,6 +1,6 @@ -const a: number = 1 +const a: number = 1; enum E { - A = a, - B = a + 1, - C = A + B + A = a, + B = a + 1, + C = A + B, } diff --git a/packages/parser/tests/fixtures/scope-analysis/expression-type-parameters.ts b/packages/parser/tests/fixtures/scope-analysis/expression-type-parameters.ts index f6f14f66592..04c7bfdcbc9 100644 --- a/packages/parser/tests/fixtures/scope-analysis/expression-type-parameters.ts +++ b/packages/parser/tests/fixtures/scope-analysis/expression-type-parameters.ts @@ -1,4 +1,4 @@ -const a, b, c, d, e, f +const a, b, c, d, e, f; new foo(a, b, c); diff --git a/packages/parser/tests/fixtures/scope-analysis/function-overload-2.ts b/packages/parser/tests/fixtures/scope-analysis/function-overload-2.ts index 548267aeb2e..ba1a1a463fa 100644 --- a/packages/parser/tests/fixtures/scope-analysis/function-overload-2.ts +++ b/packages/parser/tests/fixtures/scope-analysis/function-overload-2.ts @@ -1,2 +1,2 @@ -function f(): void -function f(a: number): void +function f(): void; +function f(a: number): void; diff --git a/packages/parser/tests/fixtures/scope-analysis/function-overload.ts b/packages/parser/tests/fixtures/scope-analysis/function-overload.ts index 7d23f50f4b3..836c5f1ed34 100644 --- a/packages/parser/tests/fixtures/scope-analysis/function-overload.ts +++ b/packages/parser/tests/fixtures/scope-analysis/function-overload.ts @@ -1,5 +1,5 @@ -function f(): void -function f(a: number): void +function f(): void; +function f(a: number): void; function f(a?: number): void { - // do something. + // do something. } diff --git a/packages/parser/tests/fixtures/scope-analysis/identifier-decorators.ts b/packages/parser/tests/fixtures/scope-analysis/identifier-decorators.ts index 00d04632efb..74514e89ee9 100644 --- a/packages/parser/tests/fixtures/scope-analysis/identifier-decorators.ts +++ b/packages/parser/tests/fixtures/scope-analysis/identifier-decorators.ts @@ -1,4 +1,3 @@ export class Test { - constructor(@Decorator config) { - } + constructor(@Decorator config) {} } diff --git a/packages/parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts b/packages/parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts index 45cabe3919d..f2f18b88bd0 100644 --- a/packages/parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts +++ b/packages/parser/tests/fixtures/scope-analysis/ignore-type-only-stuff.ts @@ -1,9 +1,9 @@ -type A = number +type A = number; interface B { - prop1: A + prop1: A; } interface C extends B { - method(a: { b: A }): { c: A } + method(a: { b: A }): { c: A }; } -var a: C +var a: C; diff --git a/packages/parser/tests/fixtures/scope-analysis/import-equals.ts b/packages/parser/tests/fixtures/scope-analysis/import-equals.ts index be7ce518477..8cb59408d93 100644 --- a/packages/parser/tests/fixtures/scope-analysis/import-equals.ts +++ b/packages/parser/tests/fixtures/scope-analysis/import-equals.ts @@ -1 +1 @@ -import foo = require('bar') +import foo = require('bar'); diff --git a/packages/parser/tests/fixtures/scope-analysis/interface-type.ts b/packages/parser/tests/fixtures/scope-analysis/interface-type.ts index 2590bf7a913..f272c4ca8ae 100644 --- a/packages/parser/tests/fixtures/scope-analysis/interface-type.ts +++ b/packages/parser/tests/fixtures/scope-analysis/interface-type.ts @@ -1,7 +1,5 @@ -interface C { - -} +interface C {} interface R { - foo: C + foo: C; } diff --git a/packages/parser/tests/fixtures/scope-analysis/method-overload.ts b/packages/parser/tests/fixtures/scope-analysis/method-overload.ts index fd8cbbdfd27..e304dbf4c0b 100644 --- a/packages/parser/tests/fixtures/scope-analysis/method-overload.ts +++ b/packages/parser/tests/fixtures/scope-analysis/method-overload.ts @@ -1,8 +1,8 @@ -const s = Symbol() +const s = Symbol(); class A { - f(): void - f(a: typeof s): void - f(a?: any): void { - // do something. - } + f(): void; + f(a: typeof s): void; + f(a?: any): void { + // do something. + } } diff --git a/packages/parser/tests/fixtures/scope-analysis/namespace.ts b/packages/parser/tests/fixtures/scope-analysis/namespace.ts index 216c093e580..18fc72d420d 100644 --- a/packages/parser/tests/fixtures/scope-analysis/namespace.ts +++ b/packages/parser/tests/fixtures/scope-analysis/namespace.ts @@ -1,7 +1,7 @@ -const a = 1 +const a = 1; namespace N { - export const a = 2 - a + export const a = 2; + a; } -a -N.a +a; +N.a; diff --git a/packages/parser/tests/fixtures/scope-analysis/type-alias.ts b/packages/parser/tests/fixtures/scope-analysis/type-alias.ts index 188a66b64f4..e3a533b01df 100644 --- a/packages/parser/tests/fixtures/scope-analysis/type-alias.ts +++ b/packages/parser/tests/fixtures/scope-analysis/type-alias.ts @@ -1 +1 @@ -type foo = string +type foo = string; diff --git a/packages/parser/tests/fixtures/scope-analysis/type-annotations.ts b/packages/parser/tests/fixtures/scope-analysis/type-annotations.ts index f5d4e63b7d5..c98d419b512 100644 --- a/packages/parser/tests/fixtures/scope-analysis/type-annotations.ts +++ b/packages/parser/tests/fixtures/scope-analysis/type-annotations.ts @@ -1,7 +1,7 @@ -type A = number -var a: { b: A } +type A = number; +var a: { b: A }; class C { - f(a: { b: A }): { b: A } { - return {b: 1} - } + f(a: { b: A }): { b: A } { + return { b: 1 }; + } } diff --git a/packages/parser/tests/fixtures/scope-analysis/type-assertions.ts b/packages/parser/tests/fixtures/scope-analysis/type-assertions.ts index 0a4caa7f0b7..28e52fe0a44 100644 --- a/packages/parser/tests/fixtures/scope-analysis/type-assertions.ts +++ b/packages/parser/tests/fixtures/scope-analysis/type-assertions.ts @@ -1,3 +1,3 @@ type A = number; -a =
b; +a = b; a = b as A; diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts index 023291c4e99..cf979859d0b 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof-in-assertions.ts @@ -1,3 +1,3 @@ -var obj = { value: 1 } +var obj = { value: 1 }; a = b; a = b as typeof obj; diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts index e3e90ce0838..c93ce5ab465 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof-in-call-signature.ts @@ -1,5 +1,5 @@ -const obj = { value: 1 } +const obj = { value: 1 }; interface A { - (a: typeof obj, b: T): typeof obj - new (a: typeof obj, b: T): typeof obj + (a: typeof obj, b: T): typeof obj; + new (a: typeof obj, b: T): typeof obj; } diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts index 15f6b7c33f2..65cebe657d5 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof-in-return-type.ts @@ -1,3 +1,4 @@ -function f(a: number): typeof a { // this `a` is the parameter `a`. - return 1 +function f(a: number): typeof a { + // this `a` is the parameter `a`. + return 1; } diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts index 2bf99cbfb58..e737a09494a 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof-in-type-parameters.ts @@ -1,3 +1,3 @@ function g(g: T): number { - return 1 + return 1; } diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts b/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts index c970514ecb6..8d34de61d71 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof-in-var.ts @@ -1,4 +1,4 @@ -var obj = { value: 1 } -var obj2: typeof obj = { value: 2 } -var { value }: typeof obj = { value: 2 } -var [element]: (typeof obj)[] = [{ value: 2 }] +var obj = { value: 1 }; +var obj2: typeof obj = { value: 2 }; +var { value }: typeof obj = { value: 2 }; +var [element]: (typeof obj)[] = [{ value: 2 }]; diff --git a/packages/parser/tests/fixtures/scope-analysis/typeof.ts b/packages/parser/tests/fixtures/scope-analysis/typeof.ts index 10e4143a731..f7971d1e59e 100644 --- a/packages/parser/tests/fixtures/scope-analysis/typeof.ts +++ b/packages/parser/tests/fixtures/scope-analysis/typeof.ts @@ -1,2 +1,2 @@ -var obj = { value: 1 } -type B = typeof obj +var obj = { value: 1 }; +type B = typeof obj; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-array-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-array-type.src.ts index 5d038fc71d9..78e59bf182a 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-array-type.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-array-type.src.ts @@ -1 +1 @@ -type Foo = string[] +type Foo = string[]; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-infer.ts b/packages/parser/tests/fixtures/scope-analysis/types-infer.ts index 45ab5c0f905..599aaa275dd 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-infer.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-infer.ts @@ -1,5 +1,7 @@ -type Unpacked = - T extends (infer U)[] ? U : - T extends infer U ? U : - T extends Promise ? U : - T; +type Unpacked = T extends (infer U)[] + ? U + : T extends infer U + ? U + : T extends Promise + ? U + : T; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts index 854fb5dbb2a..5003d88ba6a 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly-plus.src.ts @@ -1 +1 @@ -let map: { +readonly [P in string]+?: number; }; +let map: { +readonly [P in string]+?: number }; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts index ef13a053bf2..7594f4d2b2f 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-mapped-readonly.src.ts @@ -1 +1 @@ -let map: { readonly [P in string]?: number; }; +let map: { readonly [P in string]?: number }; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-mapped.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-mapped.src.ts index aca2ba15b93..0482553071a 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-mapped.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-mapped.src.ts @@ -1 +1 @@ -let map: { [P in string]: number; }; +let map: { [P in string]: number }; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-nested-types.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-nested-types.src.ts index adaf9a3cf30..0a55975787b 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-nested-types.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-nested-types.src.ts @@ -1 +1,3 @@ -type Foo = [number, string?, boolean?] | [{}, [number?] | null & boolean[]] & {} +type Foo = + | [number, string?, boolean?] + | ([{}, [number?] | (null & boolean[])] & {}); diff --git a/packages/parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts index 5a03e27ee67..8533ed3c8ab 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-parenthesized-type.src.ts @@ -1 +1 @@ -type Foo = (string | number) +type Foo = string | number; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts index 3b8d21ba958..c32cf4f129a 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-tuple-optional.src.ts @@ -1 +1 @@ -let x: [string, number?, (string | number)?] +let x: [string, number?, (string | number)?]; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts index d7719b2cb4e..5989494fba4 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-tuple-rest.src.ts @@ -1 +1 @@ -let x: [string, ...number[]] +let x: [string, ...number[]]; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts index 75a6d8e39f3..192fa76d491 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-tuple-type.src.ts @@ -1 +1 @@ -type Foo = [string, string?] +type Foo = [string, string?]; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts index 93f391fdc41..b7e93dbb2ed 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-union-intersection.src.ts @@ -1,4 +1,4 @@ let union: number | null | undefined; let intersection: number & string; -let precedence1: number | string & boolean; -let precedence2: number & string | boolean; +let precedence1: number | (string & boolean); +let precedence2: (number & string) | boolean; diff --git a/packages/parser/tests/fixtures/scope-analysis/types-union-type.src.ts b/packages/parser/tests/fixtures/scope-analysis/types-union-type.src.ts index a2cfaf9af40..75533833b76 100644 --- a/packages/parser/tests/fixtures/scope-analysis/types-union-type.src.ts +++ b/packages/parser/tests/fixtures/scope-analysis/types-union-type.src.ts @@ -1 +1 @@ -type Foo = string & number +type Foo = string & number; diff --git a/packages/parser/tests/lib/__snapshots__/services.ts.snap b/packages/parser/tests/lib/__snapshots__/services.ts.snap index 7dfa8a7b4d4..e9e804b60eb 100644 --- a/packages/parser/tests/lib/__snapshots__/services.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/services.ts.snap @@ -6,7 +6,9 @@ exports[`services fixtures/isolated-file.src 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -18,6 +20,7 @@ exports[`services fixtures/isolated-file.src 1`] = ` }, }, "name": "x", + "optional": false, "range": [ 6, 7, @@ -117,6 +120,7 @@ exports[`services fixtures/isolated-file.src 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts index 7f2f193e11d..e6bd731db07 100644 --- a/packages/parser/tests/lib/parser.ts +++ b/packages/parser/tests/lib/parser.ts @@ -1,6 +1,7 @@ -import * as scopeManager from '@typescript-eslint/scope-manager/dist/analyze'; +import * as scopeManager from '@typescript-eslint/scope-manager'; import type { ParserOptions } from '@typescript-eslint/types'; -import * as typescriptESTree from '@typescript-eslint/typescript-estree/dist/parser'; +import * as typescriptESTree from '@typescript-eslint/typescript-estree'; +import path from 'path'; import { parse, parseForESLint } from '../../src/parser'; @@ -19,11 +20,6 @@ describe('parser', () => { expect(() => parseForESLint(code, null)).not.toThrow(); }); - it("parseForESLint() should work if options.ecmaVersion is `'latest'`", () => { - const code = 'const valid = true;'; - expect(() => parseForESLint(code, { ecmaVersion: 'latest' })).not.toThrow(); - }); - it('parseAndGenerateServices() should be called with options', () => { const code = 'const valid = true;'; const spy = jest.spyOn(typescriptESTree, 'parseAndGenerateServices'); @@ -33,17 +29,15 @@ describe('parser', () => { range: false, tokens: false, sourceType: 'module' as const, - ecmaVersion: 2018, ecmaFeatures: { globalReturn: false, jsx: false, }, // ts-estree specific - filePath: 'isolated-file.src.ts', + filePath: './isolated-file.src.ts', project: 'tsconfig.json', - errorOnUnknownASTType: false, errorOnTypeScriptSyntacticAndSemanticIssues: false, - tsconfigRootDir: 'tests/fixtures/services', + tsconfigRootDir: path.resolve(__dirname, '../fixtures/services'), extraFileExtensions: ['.foo'], }; parseForESLint(code, config); @@ -84,7 +78,6 @@ describe('parser', () => { range: false, tokens: false, sourceType: 'module' as const, - ecmaVersion: 2018, ecmaFeatures: { globalReturn: false, jsx: false, @@ -96,15 +89,13 @@ describe('parser', () => { // ts-estree specific filePath: 'isolated-file.src.ts', project: 'tsconfig.json', - errorOnUnknownASTType: false, errorOnTypeScriptSyntacticAndSemanticIssues: false, - tsconfigRootDir: 'tests/fixtures/services', + tsconfigRootDir: path.join(__dirname, '../fixtures/services'), extraFileExtensions: ['.foo'], }; parseForESLint(code, config); expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenLastCalledWith(expect.anything(), { - ecmaVersion: 2018, globalReturn: false, lib: ['dom.iterable'], jsxPragma: 'Foo', diff --git a/packages/parser/tests/lib/services.ts b/packages/parser/tests/lib/services.ts index 89856370621..673512e5ed2 100644 --- a/packages/parser/tests/lib/services.ts +++ b/packages/parser/tests/lib/services.ts @@ -1,6 +1,6 @@ import { createProgram } from '@typescript-eslint/typescript-estree'; import fs from 'fs'; -import glob from 'glob'; +import glob = require('glob'); import path from 'path'; import type { ParserOptions } from '../../src/parser'; diff --git a/packages/parser/tests/tools/ts-error-serializer.ts b/packages/parser/tests/tools/ts-error-serializer.ts index 6d24367a526..5267898b526 100644 --- a/packages/parser/tests/tools/ts-error-serializer.ts +++ b/packages/parser/tests/tools/ts-error-serializer.ts @@ -1,4 +1,4 @@ -import { TSError } from '@typescript-eslint/typescript-estree/dist/node-utils'; +import { TSError } from '@typescript-eslint/typescript-estree'; import type { Plugin } from 'pretty-format'; export const serializer: Plugin = { diff --git a/packages/repo-tools/CHANGELOG.md b/packages/repo-tools/CHANGELOG.md new file mode 100644 index 00000000000..b75593b15a4 --- /dev/null +++ b/packages/repo-tools/CHANGELOG.md @@ -0,0 +1,14 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Features + +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* improve rule schemas, add test to validate schemas, add tooling to generate schema types ([#6899](https://github.com/typescript-eslint/typescript-eslint/issues/6899)) ([acc1a43](https://github.com/typescript-eslint/typescript-eslint/commit/acc1a43e02a403ff74a54c28c2c495f00d0be038)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. diff --git a/packages/repo-tools/README.md b/packages/repo-tools/README.md new file mode 100644 index 00000000000..9d1b671c9e5 --- /dev/null +++ b/packages/repo-tools/README.md @@ -0,0 +1,9 @@ +# `@typescript-eslint/eslint-plugin-internal` + +> Generic repo tools for the typescript-eslint project + +## ✋ Internal Package + +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). + +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/repo-tools/jest.config.js b/packages/repo-tools/jest.config.js new file mode 100644 index 00000000000..7d2ec5530a1 --- /dev/null +++ b/packages/repo-tools/jest.config.js @@ -0,0 +1,9 @@ +'use strict'; + +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ +module.exports = { + ...require('../../jest.config.base.js'), + coveragePathIgnorePatterns: ['src/index.ts$', 'src/configs/.*.ts$'], + passWithNoTests: true, +}; diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json new file mode 100644 index 00000000000..5b04f7e6949 --- /dev/null +++ b/packages/repo-tools/package.json @@ -0,0 +1,21 @@ +{ + "name": "@typescript-eslint/repo-tools", + "version": "6.0.0", + "private": true, + "scripts": { + "build": "tsc -b tsconfig.build.json", + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "generate-contributors": "tsx ./src/generate-contributors.ts", + "generate-sponsors": "tsx ./src/generate-sponsors.ts", + "lint": "nx lint", + "postinstall-script": "tsx ./src/postinstall.mts", + "test": "jest --coverage", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "devDependencies": { + "cross-fetch": "*", + "execa": "*", + "prettier": "*", + "tmp": "*" + } +} diff --git a/packages/experimental-utils/project.json b/packages/repo-tools/project.json similarity index 66% rename from packages/experimental-utils/project.json rename to packages/repo-tools/project.json index 74410fed05a..97a8d2b2854 100644 --- a/packages/experimental-utils/project.json +++ b/packages/repo-tools/project.json @@ -1,5 +1,5 @@ { - "name": "experimental-utils", + "name": "repo-tools", "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", "implicitDependencies": [], @@ -8,7 +8,8 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/experimental-utils/**/*.ts"] + "lintFilePatterns": ["packages/repo-tools/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/tools/generate-contributors.ts b/packages/repo-tools/src/generate-contributors.ts similarity index 81% rename from tools/generate-contributors.ts rename to packages/repo-tools/src/generate-contributors.ts index 10304672121..abf8f36ab25 100644 --- a/tools/generate-contributors.ts +++ b/packages/repo-tools/src/generate-contributors.ts @@ -32,7 +32,11 @@ interface User { html_url: string; } -async function getData(url: string): Promise { +async function getData(url: string | undefined): Promise { + if (url == null) { + return null; + } + const response = await fetch(url, { method: 'GET', headers: { @@ -52,7 +56,7 @@ async function* fetchUsers(page = 1): AsyncIterableIterator { ); if (!Array.isArray(contributors)) { - throw new Error(contributors.message); + throw new Error(contributors?.message ?? 'An error occurred'); } const thresholdedContributors = contributors.filter( @@ -77,6 +81,15 @@ function writeTable(contributors: User[], perLine = 5): void { const columns = contributors.length > perLine ? perLine : contributors.length; const lines = [ + '', + '', '# Contributors', '', 'Thanks goes to these wonderful people:', @@ -132,7 +145,7 @@ async function main(): Promise { } // fetch the user info - const users = await Promise.all( + const users = await Promise.allSettled( githubContributors // remove ignored users and bots .filter( @@ -143,7 +156,14 @@ async function main(): Promise { ); writeTable( - users.filter(c => c.login), + users + .map(result => { + if (result.status === 'fulfilled') { + return result.value; + } + return null; + }) + .filter((c): c is User => c?.login != null), 5, ); } diff --git a/tools/generate-sponsors.ts b/packages/repo-tools/src/generate-sponsors.ts similarity index 100% rename from tools/generate-sponsors.ts rename to packages/repo-tools/src/generate-sponsors.ts diff --git a/tools/postinstall.ts b/packages/repo-tools/src/postinstall.mts similarity index 53% rename from tools/postinstall.ts rename to packages/repo-tools/src/postinstall.mts index badd3f0137a..3dffe1eb1e0 100644 --- a/tools/postinstall.ts +++ b/packages/repo-tools/src/postinstall.mts @@ -1,4 +1,12 @@ -import * as execa from 'execa'; +import { $ as $_config } from 'execa'; +import path from 'path'; +import * as url from 'url'; + +const $ = $_config({ + stdout: 'inherit', + stderr: 'inherit', + verbose: true, +}); /** * In certain circumstances we want to skip the below the steps and it may not always @@ -14,24 +22,24 @@ if (process.env.SKIP_POSTINSTALL) { process.exit(0); } +const __dirname = url.fileURLToPath(new URL('.', import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, '..', '..'); + void (async function (): Promise { + // make sure we're running from the root + process.chdir(REPO_ROOT); + // Apply patches to installed node_modules await $`yarn patch-package`; // Install git hooks await $`yarn husky install`; - // Clean any caches that may be invalid now - await $`yarn clean`; + if (!process.env.SKIP_POSTINSTALL_BUILD) { + // Clean any caches that may be invalid now + await $`yarn clean`; - // Build all the packages ready for use - await $`yarn build`; + // Build all the packages ready for use + await $`yarn build`; + } })(); - -async function $(cmd: TemplateStringsArray): Promise { - const command = cmd.join(); - console.log(`\n$ ${command}`); - return execa.command(command, { - stdio: 'inherit', - }); -} diff --git a/packages/experimental-utils/tsconfig.build.json b/packages/repo-tools/tsconfig.build.json similarity index 52% rename from packages/experimental-utils/tsconfig.build.json rename to packages/repo-tools/tsconfig.build.json index e5c1077c5e5..b9ac3e1b977 100644 --- a/packages/experimental-utils/tsconfig.build.json +++ b/packages/repo-tools/tsconfig.build.json @@ -7,9 +7,5 @@ "resolveJsonModule": true }, "include": ["src", "typings"], - "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } - ] + "references": [] } diff --git a/packages/repo-tools/tsconfig.json b/packages/repo-tools/tsconfig.json new file mode 100644 index 00000000000..06b94d057fa --- /dev/null +++ b/packages/repo-tools/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "tests", "typings"], + "references": [] +} diff --git a/packages/rule-schema-to-typescript-types/CHANGELOG.md b/packages/rule-schema-to-typescript-types/CHANGELOG.md new file mode 100644 index 00000000000..cfd6bf78d61 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/CHANGELOG.md @@ -0,0 +1,20 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* correct handling of additionalProperties in object schemas ([#6939](https://github.com/typescript-eslint/typescript-eslint/issues/6939)) ([489c7a5](https://github.com/typescript-eslint/typescript-eslint/commit/489c7a50ae99ef66df152a68fd447f7e42a23558)) + + +### Features + +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* fork json schema types for better compat with ESLint rule validation ([#6963](https://github.com/typescript-eslint/typescript-eslint/issues/6963)) ([a4967f2](https://github.com/typescript-eslint/typescript-eslint/commit/a4967f2e8cc7b0432d8dfe804772e60042c5384c)) +* improve rule schemas, add test to validate schemas, add tooling to generate schema types ([#6899](https://github.com/typescript-eslint/typescript-eslint/issues/6899)) ([acc1a43](https://github.com/typescript-eslint/typescript-eslint/commit/acc1a43e02a403ff74a54c28c2c495f00d0be038)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. diff --git a/packages/rule-schema-to-typescript-types/README.md b/packages/rule-schema-to-typescript-types/README.md new file mode 100644 index 00000000000..25f004c77a1 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/README.md @@ -0,0 +1,9 @@ +# `@typescript-eslint/rule-schema-to-typescript-types` + +> Tool for generating TypeScript type definitions from a rule's options schema + +## ✋ Internal Package + +This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). + +👉 See **https://typescript-eslint.io** for docs on typescript-eslint. diff --git a/packages/experimental-utils/jest.config.js b/packages/rule-schema-to-typescript-types/jest.config.js similarity index 79% rename from packages/experimental-utils/jest.config.js rename to packages/rule-schema-to-typescript-types/jest.config.js index 5f1ea3f4bcb..209d055cc65 100644 --- a/packages/experimental-utils/jest.config.js +++ b/packages/rule-schema-to-typescript-types/jest.config.js @@ -4,5 +4,5 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.test\\.ts$', + passWithNoTests: true, }; diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json new file mode 100644 index 00000000000..1b60a669762 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/package.json @@ -0,0 +1,45 @@ +{ + "name": "@typescript-eslint/rule-schema-to-typescript-types", + "version": "6.0.0", + "private": true, + "type": "commonjs", + "exports": { + ".": { + "types": "./index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/rule-schema-to-typescript-types" + }, + "bugs": { + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" + }, + "license": "MIT", + "scripts": { + "build": "tsc -b tsconfig.build.json", + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "generate-contributors": "tsx ./src/generate-contributors.ts", + "generate-sponsors": "tsx ./src/generate-sponsors.ts", + "lint": "nx lint", + "postinstall-script": "tsx ./src/postinstall.ts", + "test": "jest --coverage", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "dependencies": { + "@typescript-eslint/type-utils": "6.0.0", + "@typescript-eslint/utils": "6.0.0", + "natural-compare": "^1.4.0", + "prettier": "*" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } +} diff --git a/packages/rule-schema-to-typescript-types/project.json b/packages/rule-schema-to-typescript-types/project.json new file mode 100644 index 00000000000..e0566604c1d --- /dev/null +++ b/packages/rule-schema-to-typescript-types/project.json @@ -0,0 +1,18 @@ +{ + "name": "rule-schema-to-typescript-types", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "type": "library", + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/rule-schema-to-typescript-types/**/*.{mts,cts,ts,tsx}" + ], + "ignorePath": ".eslintignore" + } + } + } +} diff --git a/packages/rule-schema-to-typescript-types/src/errors.ts b/packages/rule-schema-to-typescript-types/src/errors.ts new file mode 100644 index 00000000000..aa3168af5f9 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/errors.ts @@ -0,0 +1,17 @@ +export class NotSupportedError extends Error { + constructor(thing: string, target: unknown) { + super( + `Generating a type for ${thing} is not currently supported:\n${JSON.stringify( + target, + null, + 2, + )}`, + ); + } +} + +export class UnexpectedError extends Error { + constructor(error: string, target: unknown) { + super(`Unexpected Error: ${error}:\n${JSON.stringify(target, null, 2)}`); + } +} diff --git a/packages/rule-schema-to-typescript-types/src/generateArrayType.ts b/packages/rule-schema-to-typescript-types/src/generateArrayType.ts new file mode 100644 index 00000000000..3efe5ed0af1 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateArrayType.ts @@ -0,0 +1,160 @@ +import { TSUtils } from '@typescript-eslint/utils'; +import type { + JSONSchema4, + JSONSchema4ArraySchema, +} from '@typescript-eslint/utils/json-schema'; + +import { NotSupportedError, UnexpectedError } from './errors'; +import { generateType } from './generateType'; +import { getCommentLines } from './getCommentLines'; +import type { ArrayAST, AST, RefMap, TupleAST, UnionAST } from './types'; + +/** + * If there are more than 20 tuple items then we will not make it a tuple type + * and instead will just make it an array type for brevity + */ +const MAX_ITEMS_TO_TUPLIZE = 20; + +export function generateArrayType( + schema: JSONSchema4ArraySchema, + refMap: RefMap, +): ArrayAST | TupleAST | UnionAST { + if (!schema.items) { + // it's technically valid to declare things like {type: 'array'} -> any[] + // but that's obviously dumb and loose so let's not even bother with it + throw new UnexpectedError('Unexpected missing items', schema); + } + if ( + schema.items && + !TSUtils.isArray(schema.items) && + schema.additionalItems + ) { + throw new NotSupportedError( + 'singlely-typed array with additionalItems', + schema, + ); + } + + const commentLines = getCommentLines(schema); + + const minItems = schema.minItems ?? 0; + const maxItems = + schema.maxItems != null && schema.maxItems < MAX_ITEMS_TO_TUPLIZE + ? schema.maxItems + : -1; + const hasMinItems = minItems > 0; + const hasMaxItems = maxItems >= 0; + + let items: JSONSchema4[]; + let spreadItemSchema: JSONSchema4 | null = null; + + if (!TSUtils.isArray(schema.items)) { + if (hasMinItems || hasMaxItems) { + // treat as a tuple + items = Array( + (hasMaxItems && maxItems) || minItems || 0, + ).fill(schema.items); + if (!hasMaxItems) { + spreadItemSchema = + typeof schema.additionalItems === 'object' + ? schema.additionalItems + : schema.items; + } + } else { + // treat as an array type + return { + type: 'array', + elementType: generateType(schema.items, refMap), + commentLines, + }; + } + } else { + // treat as a tuple + items = schema.items; + if (hasMaxItems && items.length < maxItems) { + spreadItemSchema = + typeof schema.additionalItems === 'object' + ? schema.additionalItems + : { type: 'any' }; + } + } + + // quick validation so we generate sensible types + if (hasMaxItems && maxItems < items.length) { + throw new UnexpectedError( + `maxItems (${maxItems}) is smaller than the number of items schemas provided (${items.length})`, + schema, + ); + } + if (maxItems > items.length && spreadItemSchema == null) { + throw new UnexpectedError( + 'maxItems is larger than the number of items schemas, but there was not an additionalItems schema provided', + schema, + ); + } + + const itemTypes = items.map(i => generateType(i, refMap)); + const spreadItem = + spreadItemSchema == null ? null : generateType(spreadItemSchema, refMap); + + if (itemTypes.length > minItems) { + /* + if there are more items than the min, we return a union of tuples instead of + using the optional element operator. This is done because it is more type-safe. + + // optional element operator + type A = [string, string?, string?] + const a: A = ['a', undefined, 'c'] // no error + + // union of tuples + type B = [string] | [string, string] | [string, string, string] + const b: B = ['a', undefined, 'c'] // TS error + */ + const cumulativeTypesList = itemTypes.slice(0, minItems); + const typesToUnion: AST[] = []; + if (cumulativeTypesList.length > 0) { + // actually has minItems, so add the initial state + typesToUnion.push(createTupleType(cumulativeTypesList)); + } else { + // no minItems means it's acceptable to have an empty tuple type + typesToUnion.push(createTupleType([])); + } + + for (let i = minItems; i < itemTypes.length; i += 1) { + cumulativeTypesList.push(itemTypes[i]); + + if (i === itemTypes.length - 1) { + // only the last item in the union should have the spread parameter + typesToUnion.push(createTupleType(cumulativeTypesList, spreadItem)); + } else { + typesToUnion.push(createTupleType(cumulativeTypesList)); + } + } + + return { + type: 'union', + elements: typesToUnion, + commentLines, + }; + } + + return { + type: 'tuple', + elements: itemTypes, + spreadType: spreadItem, + commentLines, + }; +} + +function createTupleType( + elements: AST[], + spreadType: AST | null = null, +): TupleAST { + return { + type: 'tuple', + // clone the array because we know we'll keep mutating it + elements: [...elements], + spreadType, + commentLines: [], + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/generateObjectType.ts b/packages/rule-schema-to-typescript-types/src/generateObjectType.ts new file mode 100644 index 00000000000..6f493c498aa --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateObjectType.ts @@ -0,0 +1,55 @@ +import { requiresQuoting } from '@typescript-eslint/type-utils'; +import { TSUtils } from '@typescript-eslint/utils'; +import type { JSONSchema4ObjectSchema } from '@typescript-eslint/utils/json-schema'; + +import { generateType } from './generateType'; +import { getCommentLines } from './getCommentLines'; +import type { AST, ObjectAST, RefMap } from './types'; + +export function generateObjectType( + schema: JSONSchema4ObjectSchema, + refMap: RefMap, +): ObjectAST { + const commentLines = getCommentLines(schema); + + let indexSignature: AST | null = null; + if ( + schema.additionalProperties === true || + schema.additionalProperties === undefined + ) { + indexSignature = { + type: 'type-reference', + typeName: 'unknown', + commentLines: [], + }; + } else if (typeof schema.additionalProperties === 'object') { + const indexSigType = generateType(schema.additionalProperties, refMap); + indexSignature = indexSigType; + } + + const properties: ObjectAST['properties'] = []; + const required = new Set( + TSUtils.isArray(schema.required) ? schema.required : [], + ); + if (schema.properties) { + const propertyDefs = Object.entries(schema.properties); + for (const [propName, propSchema] of propertyDefs) { + const propType = generateType(propSchema, refMap); + const sanitisedPropName = requiresQuoting(propName) + ? `'${propName}'` + : propName; + properties.push({ + name: sanitisedPropName, + optional: !required.has(propName), + type: propType, + }); + } + } + + return { + type: 'object', + properties, + indexSignature, + commentLines, + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/generateType.ts b/packages/rule-schema-to-typescript-types/src/generateType.ts new file mode 100644 index 00000000000..a2477a54633 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateType.ts @@ -0,0 +1,124 @@ +import { TSUtils } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; + +import { NotSupportedError, UnexpectedError } from './errors'; +import { generateArrayType } from './generateArrayType'; +import { generateObjectType } from './generateObjectType'; +import { generateUnionType } from './generateUnionType'; +import { getCommentLines } from './getCommentLines'; +import type { AST, RefMap } from './types'; + +// keywords we probably should support but currently do not support +const UNSUPPORTED_KEYWORDS = new Set([ + 'allOf', + 'dependencies', + 'extends', + 'maxProperties', + 'minProperties', + 'multipleOf', + 'not', + 'patternProperties', +]); + +export function generateType(schema: JSONSchema4, refMap: RefMap): AST { + const unsupportedProps = Object.keys(schema).filter(key => + UNSUPPORTED_KEYWORDS.has(key), + ); + if (unsupportedProps.length > 0) { + throw new NotSupportedError(unsupportedProps.join(','), schema); + } + + const commentLines = getCommentLines(schema); + + if (schema.$ref) { + const refName = refMap.get(schema.$ref); + if (refName == null) { + throw new UnexpectedError( + `Could not find definition for $ref ${ + schema.$ref + }.\nAvailable refs:\n${Array.from(refMap.keys()).join('\n')})`, + schema, + ); + } + return { + type: 'type-reference', + typeName: refName, + commentLines, + }; + } + if ('enum' in schema && schema.enum) { + return { + ...generateUnionType(schema.enum, refMap), + commentLines, + }; + } + if ('anyOf' in schema && schema.anyOf) { + return { + // a union isn't *TECHNICALLY* correct - technically anyOf is actually + // anyOf: [T, U, V] -> T | U | V | T & U | T & V | U & V + // in practice though it is most used to emulate a oneOf + ...generateUnionType(schema.anyOf, refMap), + commentLines, + }; + } + if ('oneOf' in schema && schema.oneOf) { + return { + ...generateUnionType(schema.oneOf, refMap), + commentLines, + }; + } + + if (!('type' in schema) || schema.type == null) { + throw new NotSupportedError( + 'untyped schemas without one of [$ref, enum, oneOf]', + schema, + ); + } + if (TSUtils.isArray(schema.type)) { + throw new NotSupportedError('schemas with multiple types', schema); + } + + switch (schema.type) { + case 'any': + return { + type: 'type-reference', + typeName: 'unknown', + commentLines, + }; + + case 'null': + return { + type: 'type-reference', + typeName: 'null', + commentLines, + }; + + case 'number': + case 'string': + return { + type: 'literal', + code: schema.type, + commentLines, + }; + + case 'array': + return generateArrayType(schema, refMap); + + case 'boolean': + return { + type: 'type-reference', + typeName: 'boolean', + commentLines, + }; + + case 'integer': + return { + type: 'type-reference', + typeName: 'number', + commentLines, + }; + + case 'object': + return generateObjectType(schema, refMap); + } +} diff --git a/packages/rule-schema-to-typescript-types/src/generateUnionType.ts b/packages/rule-schema-to-typescript-types/src/generateUnionType.ts new file mode 100644 index 00000000000..9ec9dc3b7bd --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/generateUnionType.ts @@ -0,0 +1,53 @@ +import type { + JSONSchema4, + JSONSchema4Type, +} from '@typescript-eslint/utils/json-schema'; + +import { NotSupportedError } from './errors'; +import { generateType } from './generateType'; +import type { AST, RefMap, UnionAST } from './types'; + +export function generateUnionType( + members: (JSONSchema4 | JSONSchema4Type)[], + refMap: RefMap, +): UnionAST { + const elements: AST[] = []; + + for (const memberSchema of members) { + elements.push( + ((): AST => { + switch (typeof memberSchema) { + case 'string': + return { + type: 'literal', + code: `'${memberSchema.replace(/'/g, "\\'")}'`, + commentLines: [], + }; + + case 'number': + case 'boolean': + return { + type: 'literal', + code: `${memberSchema}`, + commentLines: [], + }; + + case 'object': + if (memberSchema == null) { + throw new NotSupportedError('null in an enum', memberSchema); + } + if (Array.isArray(memberSchema)) { + throw new NotSupportedError('array in an enum', memberSchema); + } + return generateType(memberSchema, refMap); + } + })(), + ); + } + + return { + type: 'union', + elements, + commentLines: [], + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/getCommentLines.ts b/packages/rule-schema-to-typescript-types/src/getCommentLines.ts new file mode 100644 index 00000000000..675bf374c22 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/getCommentLines.ts @@ -0,0 +1,9 @@ +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; + +export function getCommentLines(schema: JSONSchema4): string[] { + const lines: string[] = []; + if (schema.description) { + lines.push(schema.description); + } + return lines; +} diff --git a/packages/rule-schema-to-typescript-types/src/index.ts b/packages/rule-schema-to-typescript-types/src/index.ts new file mode 100644 index 00000000000..9101bc4026e --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/index.ts @@ -0,0 +1,98 @@ +import { TSUtils } from '@typescript-eslint/utils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; +import path from 'path'; +import { format as prettierFormat, resolveConfig } from 'prettier'; + +import { generateType } from './generateType'; +import { optimizeAST } from './optimizeAST'; +import { printTypeAlias } from './printAST'; +import type { AST } from './types'; + +const prettierConfig = { + ...(resolveConfig.sync(__filename) ?? {}), + filepath: path.join(__dirname, 'schema.ts'), +}; + +export function compile( + schemaIn: JSONSchema4 | readonly JSONSchema4[], +): string { + const { schema, isArraySchema } = (() => { + if (TSUtils.isArray(schemaIn)) { + return { + schema: schemaIn, + isArraySchema: true, + }; + } + return { + schema: [schemaIn], + isArraySchema: false, + }; + })(); + + if (schema.length === 0) { + return ['/** No options declared */', 'type Options = [];'].join('\n'); + } + + const refTypes: string[] = []; + const types: AST[] = []; + for (let i = 0; i < schema.length; i += 1) { + const result = compileSchema(schema[i], i); + refTypes.push(...result.refTypes); + types.push(result.type); + } + + const optionsType = isArraySchema + ? printTypeAlias('Options', { + type: 'tuple', + elements: types, + spreadType: null, + commentLines: [], + }) + : printTypeAlias('Options', types[0]); + + const unformattedCode = [...refTypes, optionsType].join('\n\n'); + try { + return prettierFormat(unformattedCode, prettierConfig); + } catch (e) { + if (e instanceof Error) { + e.message = e.message + `\n\nUnformatted Code:\n${unformattedCode}`; + } + throw e; + } +} + +function compileSchema( + schema: JSONSchema4, + index: number, +): { type: AST; refTypes: string[] } { + const refTypes: string[] = []; + + const refMap = new Map(); + // we only support defs at the top level for simplicity + const defs = (schema.$defs ?? schema.definitions) as + | Record + | undefined; + if (defs) { + for (const [defKey, defSchema] of Object.entries(defs)) { + const typeName = toPascalCase(defKey); + refMap.set(`#/$defs/${defKey}`, typeName); + refMap.set(`#/items/${index}/$defs/${defKey}`, typeName); + + const type = generateType(defSchema, refMap); + optimizeAST(type); + refTypes.push(printTypeAlias(typeName, type)); + } + } + + const type = generateType(schema, refMap); + optimizeAST(type); + + return { + type, + refTypes, + }; +} + +function toPascalCase(key: string): string { + return key[0].toUpperCase() + key.substring(1); +} diff --git a/packages/rule-schema-to-typescript-types/src/optimizeAST.ts b/packages/rule-schema-to-typescript-types/src/optimizeAST.ts new file mode 100644 index 00000000000..ba39aae909a --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/optimizeAST.ts @@ -0,0 +1,72 @@ +import type { AST, UnionAST } from './types'; + +export function optimizeAST(ast: AST | null): void { + if (ast == null) { + return; + } + + switch (ast.type) { + case 'array': { + optimizeAST(ast.elementType); + return; + } + + case 'literal': + return; + + case 'object': { + for (const property of ast.properties) { + optimizeAST(property.type); + } + optimizeAST(ast.indexSignature); + return; + } + + case 'tuple': { + for (const element of ast.elements) { + optimizeAST(element); + } + optimizeAST(ast.spreadType); + return; + } + + case 'type-reference': + return; + + case 'union': { + const elements = unwrapUnions(ast); + for (const element of elements) { + optimizeAST(element); + } + + // hacky way to deduplicate union members + const uniqueElementsMap = new Map(); + for (const element of elements) { + uniqueElementsMap.set(JSON.stringify(element), element); + } + const uniqueElements = Array.from(uniqueElementsMap.values()); + + // @ts-expect-error -- purposely overwriting the property with a flattened list + ast.elements = uniqueElements; + return; + } + } +} + +function unwrapUnions(union: UnionAST): AST[] { + const elements: AST[] = []; + for (const element of union.elements) { + if (element.type === 'union') { + elements.push(...unwrapUnions(element)); + } else { + elements.push(element); + } + } + + if (elements.length > 0) { + // preserve the union's comment lines by prepending them to the first element's lines + elements[0].commentLines.unshift(...union.commentLines); + } + + return elements; +} diff --git a/packages/rule-schema-to-typescript-types/src/printAST.ts b/packages/rule-schema-to-typescript-types/src/printAST.ts new file mode 100644 index 00000000000..70dd47924f4 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/printAST.ts @@ -0,0 +1,168 @@ +import naturalCompare from 'natural-compare'; + +import type { AST, TupleAST } from './types'; + +export function printTypeAlias(aliasName: string, ast: AST): string { + return `${printComment(ast)}type ${aliasName} = ${printAST(ast).code}`; +} + +export function printASTWithComment(ast: AST): string { + const result = printAST(ast); + return `${printComment(result)}${result.code}`; +} + +function printComment({ + commentLines: commentLinesIn, +}: { + readonly commentLines?: string[] | null | undefined; +}): string { + if (commentLinesIn == null || commentLinesIn.length === 0) { + return ''; + } + + const commentLines: string[] = []; + for (const line of commentLinesIn) { + commentLines.push(...line.split('\n')); + } + + if (commentLines.length === 1) { + return `/** ${commentLines[0]} */\n`; + } + + return ['/**', ...commentLines.map(l => ` * ${l}`), ' */', ''].join('\n'); +} + +interface CodeWithComments { + code: string; + commentLines: string[]; +} +function printAST(ast: AST): CodeWithComments { + switch (ast.type) { + case 'array': { + const code = printAndMaybeParenthesise(ast.elementType); + return { + code: `${code.code}[]`, + commentLines: ast.commentLines.concat(code.commentLines), + }; + } + + case 'literal': + return { + code: ast.code, + commentLines: ast.commentLines, + }; + + case 'object': { + const properties = []; + // sort the properties so that we get consistent output regardless + // of import declaration order + const sortedPropertyDefs = ast.properties.sort((a, b) => + naturalCompare(a.name, b.name), + ); + for (const property of sortedPropertyDefs) { + const result = printAST(property.type); + properties.push( + `${printComment(result)}${property.name}${ + property.optional ? '?:' : ':' + } ${result.code}`, + ); + } + + if (ast.indexSignature) { + const result = printAST(ast.indexSignature); + properties.push(`${printComment(result)}[k: string]: ${result.code}`); + } + return { + // force insert a newline so prettier consistently prints all objects as multiline + code: `{\n${properties.join(';\n')}}`, + commentLines: ast.commentLines, + }; + } + + case 'tuple': { + const elements = []; + for (const element of ast.elements) { + elements.push(printASTWithComment(element)); + } + if (ast.spreadType) { + const result = printAndMaybeParenthesise(ast.spreadType); + elements.push(`${printComment(result)}...${result.code}[]`); + } + + return { + code: `[${elements.join(',')}]`, + commentLines: ast.commentLines, + }; + } + + case 'type-reference': + return { + code: ast.typeName, + commentLines: ast.commentLines, + }; + + case 'union': + return { + code: ast.elements + .map(element => { + const result = printAST(element); + const code = `${printComment(result)} | ${result.code}`; + return { + code, + element, + }; + }) + // sort the union members so that we get consistent output regardless + // of declaration order + .sort((a, b) => compareElements(a, b)) + .map(el => el.code) + .join('\n'), + commentLines: ast.commentLines, + }; + } +} + +interface Element { + code: string; + element: AST; +} +function compareElements(a: Element, b: Element): number { + if (a.element.type !== b.element.type) { + return naturalCompare(a.code, b.code); + } + + switch (a.element.type) { + case 'array': + case 'literal': + case 'type-reference': + case 'object': + case 'union': + return naturalCompare(a.code, b.code); + + case 'tuple': { + // natural compare will sort longer tuples before shorter ones + // which is the opposite of what we want, so we sort first by length THEN + // by code to ensure shorter tuples come first + const aElement = a.element; + const bElement = b.element as TupleAST; + if (aElement.elements.length !== bElement.elements.length) { + return aElement.elements.length - bElement.elements.length; + } + return naturalCompare(a.code, b.code); + } + } +} + +function printAndMaybeParenthesise(ast: AST): CodeWithComments { + const printed = printAST(ast); + if (ast.type === 'union') { + return { + code: `(${printed.code})`, + commentLines: printed.commentLines, + }; + } + return { + code: `${printed.code}`, + commentLines: printed.commentLines, + }; +} diff --git a/packages/rule-schema-to-typescript-types/src/types.ts b/packages/rule-schema-to-typescript-types/src/types.ts new file mode 100644 index 00000000000..78d0bfa994d --- /dev/null +++ b/packages/rule-schema-to-typescript-types/src/types.ts @@ -0,0 +1,49 @@ +export type RefMap = ReadonlyMap< + // ref path + string, + // type name + string +>; + +export type AST = + | ArrayAST + | LiteralAST + | ObjectAST + | TupleAST + | TypeReferenceAST + | UnionAST; + +interface BaseASTNode { + readonly commentLines: string[]; +} + +export interface ArrayAST extends BaseASTNode { + readonly type: 'array'; + readonly elementType: AST; +} +export interface LiteralAST extends BaseASTNode { + readonly type: 'literal'; + readonly code: string; +} +export interface ObjectAST extends BaseASTNode { + readonly type: 'object'; + readonly properties: { + readonly name: string; + readonly optional: boolean; + readonly type: AST; + }[]; + readonly indexSignature: AST | null; +} +export interface TupleAST extends BaseASTNode { + readonly type: 'tuple'; + readonly elements: AST[]; + readonly spreadType: AST | null; +} +export interface TypeReferenceAST extends BaseASTNode { + readonly type: 'type-reference'; + readonly typeName: string; +} +export interface UnionAST extends BaseASTNode { + readonly type: 'union'; + readonly elements: AST[]; +} diff --git a/packages/rule-schema-to-typescript-types/tsconfig.build.json b/packages/rule-schema-to-typescript-types/tsconfig.build.json new file mode 100644 index 00000000000..b9ac3e1b977 --- /dev/null +++ b/packages/rule-schema-to-typescript-types/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "include": ["src", "typings"], + "references": [] +} diff --git a/packages/rule-schema-to-typescript-types/tsconfig.json b/packages/rule-schema-to-typescript-types/tsconfig.json new file mode 100644 index 00000000000..06b94d057fa --- /dev/null +++ b/packages/rule-schema-to-typescript-types/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "tests", "typings"], + "references": [] +} diff --git a/packages/rule-tester/CHANGELOG.md b/packages/rule-tester/CHANGELOG.md new file mode 100644 index 00000000000..db8fa2bab04 --- /dev/null +++ b/packages/rule-tester/CHANGELOG.md @@ -0,0 +1,21 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* correct jest.mock path post merge ([778d254](https://github.com/typescript-eslint/typescript-eslint/commit/778d254eefc5bb08f39e4ce7d691c67977e620ab)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* fork json schema types for better compat with ESLint rule validation ([#6963](https://github.com/typescript-eslint/typescript-eslint/issues/6963)) ([a4967f2](https://github.com/typescript-eslint/typescript-eslint/commit/a4967f2e8cc7b0432d8dfe804772e60042c5384c)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. diff --git a/packages/experimental-utils/LICENSE b/packages/rule-tester/LICENSE similarity index 94% rename from packages/experimental-utils/LICENSE rename to packages/rule-tester/LICENSE index a1164108d4d..d68c4a4557e 100644 --- a/packages/experimental-utils/LICENSE +++ b/packages/rule-tester/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 typescript-eslint and other contributors +Copyright (c) 2023 typescript-eslint and other contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/rule-tester/README.md b/packages/rule-tester/README.md new file mode 100644 index 00000000000..a00df5ee769 --- /dev/null +++ b/packages/rule-tester/README.md @@ -0,0 +1,10 @@ +# `@typescript-eslint/rule-tester` + +> Tooling to test ESLint rules + +[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/rule-tester.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/rule-tester) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/rule-tester.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/rule-tester) + +👉 See **https://typescript-eslint.io/packages/rule-tester** for documentation on this package. + + diff --git a/packages/rule-tester/jest.config.js b/packages/rule-tester/jest.config.js new file mode 100644 index 00000000000..910991b20cf --- /dev/null +++ b/packages/rule-tester/jest.config.js @@ -0,0 +1,7 @@ +'use strict'; + +// @ts-check +/** @type {import('@jest/types').Config.InitialOptions} */ +module.exports = { + ...require('../../jest.config.base.js'), +}; diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json new file mode 100644 index 00000000000..447e0d1de5e --- /dev/null +++ b/packages/rule-tester/package.json @@ -0,0 +1,82 @@ +{ + "name": "@typescript-eslint/rule-tester", + "version": "6.0.0", + "description": "Tooling to test ESLint rules", + "files": [ + "dist", + "_ts4.2", + "README.md", + "LICENSE" + ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/typescript-eslint/typescript-eslint.git", + "directory": "packages/rule-tester" + }, + "bugs": { + "url": "https://github.com/typescript-eslint/typescript-eslint/issues" + }, + "license": "MIT", + "keywords": [ + "eslint", + "typescript", + "estree" + ], + "scripts": { + "build": "tsc -b tsconfig.build.json", + "postbuild": "downlevel-dts dist _ts4.2/dist --to=4.2", + "clean": "tsc -b tsconfig.build.json --clean", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "lint": "nx lint", + "pretest-eslint-base": "tsc -b tsconfig.build.json", + "test-eslint-base": "mocha --require source-map-support/register ./tests/eslint-base/eslint-base.test.js", + "test": "jest --coverage", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70", + "dependencies": { + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/utils": "6.0.0", + "ajv": "^6.10.0", + "lodash.merge": "4.6.2", + "semver": "^7.5.4" + }, + "peerDependencies": { + "@eslint/eslintrc": ">=2", + "eslint": ">=8" + }, + "devDependencies": { + "@types/lodash.merge": "4.6.7", + "@typescript-eslint/parser": "6.0.0", + "chai": "^4.3.7", + "mocha": "^8.3.2", + "sinon": "^11.0.0", + "source-map-support": "^0.5.21" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "publishConfig": { + "access": "public" + }, + "typesVersions": { + "<3.8": { + "*": [ + "_ts3.4/*" + ] + } + } +} diff --git a/packages/rule-tester/project.json b/packages/rule-tester/project.json new file mode 100644 index 00000000000..f4c29cfeed1 --- /dev/null +++ b/packages/rule-tester/project.json @@ -0,0 +1,15 @@ +{ + "name": "rule-tester", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "type": "library", + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/rule-tester/**/*.ts"] + } + } + } +} diff --git a/packages/rule-tester/src/RuleTester.ts b/packages/rule-tester/src/RuleTester.ts new file mode 100644 index 00000000000..cc657761137 --- /dev/null +++ b/packages/rule-tester/src/RuleTester.ts @@ -0,0 +1,1026 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/rule-tester/rule-tester.js + +import assert from 'node:assert'; +import path from 'node:path'; +import util from 'node:util'; + +import type * as ParserType from '@typescript-eslint/parser'; +import type { TSESTree } from '@typescript-eslint/utils'; +import { deepMerge } from '@typescript-eslint/utils/eslint-utils'; +import type { + AnyRuleCreateFunction, + AnyRuleModule, + ParserOptions, + RuleContext, + RuleModule, +} from '@typescript-eslint/utils/ts-eslint'; +import { Linter } from '@typescript-eslint/utils/ts-eslint'; +// we intentionally import from eslint here because we need to use the same class +// that ESLint uses, not our custom override typed version +import { SourceCode } from 'eslint'; +import merge from 'lodash.merge'; + +import { TestFramework } from './TestFramework'; +import type { + InvalidTestCase, + NormalizedRunTests, + RuleTesterConfig, + RunTests, + TesterConfigWithDefaults, + ValidTestCase, +} from './types'; +import { ajvBuilder } from './utils/ajv'; +import { cloneDeeplyExcludesParent } from './utils/cloneDeeplyExcludesParent'; +import { validate } from './utils/config-validator'; +import { satisfiesAllDependencyConstraints } from './utils/dependencyConstraints'; +import { freezeDeeply } from './utils/freezeDeeply'; +import { getRuleOptionsSchema } from './utils/getRuleOptionsSchema'; +import { hasOwnProperty } from './utils/hasOwnProperty'; +import { interpolate } from './utils/interpolate'; +import { isReadonlyArray } from './utils/isReadonlyArray'; +import * as SourceCodeFixer from './utils/SourceCodeFixer'; +import { + emitLegacyRuleAPIWarning, + emitMissingSchemaWarning, + ERROR_OBJECT_PARAMETERS, + FRIENDLY_ERROR_OBJECT_PARAMETER_LIST, + FRIENDLY_SUGGESTION_OBJECT_PARAMETER_LIST, + getCommentsDeprecation, + REQUIRED_SCENARIOS, + RULE_TESTER_PARAMETERS, + sanitize, + SUGGESTION_OBJECT_PARAMETERS, + wrapParser, +} from './utils/validationHelpers'; + +const ajv = ajvBuilder({ strictDefaults: true }); +const TYPESCRIPT_ESLINT_PARSER = '@typescript-eslint/parser'; +const DUPLICATE_PARSER_ERROR_MESSAGE = `Do not set the parser at the test level unless you want to use a parser other than "${TYPESCRIPT_ESLINT_PARSER}"`; + +/* + * testerDefaultConfig must not be modified as it allows to reset the tester to + * the initial default configuration + */ +const testerDefaultConfig: Readonly = { + parser: TYPESCRIPT_ESLINT_PARSER, + rules: {}, + defaultFilenames: { ts: 'file.ts', tsx: 'react.tsx' }, +}; +let defaultConfig = deepMerge( + {}, + testerDefaultConfig, +) as TesterConfigWithDefaults; + +export class RuleTester extends TestFramework { + readonly #testerConfig: TesterConfigWithDefaults; + readonly #rules: Record = {}; + readonly #linter: Linter = new Linter(); + + /** + * Creates a new instance of RuleTester. + */ + constructor(testerConfig?: RuleTesterConfig) { + super(); + + /** + * The configuration to use for this tester. Combination of the tester + * configuration and the default configuration. + */ + this.#testerConfig = merge({}, defaultConfig, testerConfig, { + rules: { 'rule-tester/validate-ast': 'error' }, + // as of eslint 6 you have to provide an absolute path to the parser + // but that's not as clean to type, this saves us trying to manually enforce + // that contributors require.resolve everything + parser: require.resolve((testerConfig ?? defaultConfig).parser), + }); + + // make sure that the parser doesn't hold onto file handles between tests + // on linux (i.e. our CI env), there can be very a limited number of watch handles available + const constructor = this.constructor as typeof RuleTester; + constructor.afterAll(() => { + try { + // instead of creating a hard dependency, just use a soft require + // a bit weird, but if they're using this tooling, it'll be installed + const parser = require(TYPESCRIPT_ESLINT_PARSER) as typeof ParserType; + parser.clearCaches(); + } catch { + // ignored on purpose + } + }); + } + + /** + * Set the configuration to use for all future tests + */ + static setDefaultConfig(config: RuleTesterConfig): void { + if (typeof config !== 'object' || config == null) { + throw new TypeError( + 'RuleTester.setDefaultConfig: config must be an object', + ); + } + // Make sure the rules object exists since it is assumed to exist later + defaultConfig = deepMerge( + defaultConfig, + // @ts-expect-error -- no index signature + config, + ) as TesterConfigWithDefaults; + } + + /** + * Get the current configuration used for all tests + */ + static getDefaultConfig(): Readonly { + return defaultConfig; + } + + /** + * Reset the configuration to the initial configuration of the tester removing + * any changes made until now. + */ + static resetDefaultConfig(): void { + defaultConfig = merge({}, testerDefaultConfig); + } + + /** + * Adds the `only` property to a test to run it in isolation. + */ + static only>( + item: ValidTestCase | string, + ): ValidTestCase; + /** + * Adds the `only` property to a test to run it in isolation. + */ + static only>( + item: InvalidTestCase, + ): InvalidTestCase; + static only>( + item: + | InvalidTestCase + | ValidTestCase + | string, + ): InvalidTestCase | ValidTestCase { + if (typeof item === 'string') { + return { code: item, only: true }; + } + + return { ...item, only: true }; + } + + /** + * Define a rule for one particular run of tests. + */ + defineRule(name: string, rule: AnyRuleCreateFunction | AnyRuleModule): void { + this.#rules[name] = rule; + } + + #normalizeTests< + TMessageIds extends string, + TOptions extends readonly unknown[], + >( + rawTests: RunTests, + ): NormalizedRunTests { + /* + Automatically add a filename to the tests to enable type-aware tests to "just work". + This saves users having to verbosely and manually add the filename to every + single test case. + Hugely helps with the string-based valid test cases as it means they don't + need to be made objects! + */ + const getFilename = (testOptions?: ParserOptions): string => { + const resolvedOptions = deepMerge( + this.#testerConfig.parserOptions, + testOptions, + ) as ParserOptions; + const filename = resolvedOptions.ecmaFeatures?.jsx + ? this.#testerConfig.defaultFilenames.tsx + : this.#testerConfig.defaultFilenames.ts; + if (resolvedOptions.project) { + return path.join( + resolvedOptions.tsconfigRootDir ?? process.cwd(), + filename, + ); + } + return filename; + }; + const normalizeTest = < + TMessageIds extends string, + TOptions extends readonly unknown[], + T extends + | InvalidTestCase + | ValidTestCase, + >( + test: T, + ): T => { + if (test.parser === TYPESCRIPT_ESLINT_PARSER) { + throw new Error(DUPLICATE_PARSER_ERROR_MESSAGE); + } + if (!test.filename) { + return { + ...test, + filename: getFilename(test.parserOptions), + }; + } + return test; + }; + + const normalizedTests = { + valid: rawTests.valid + .map(test => { + if (typeof test === 'string') { + return { code: test }; + } + return test; + }) + .map(normalizeTest), + invalid: rawTests.invalid.map(normalizeTest), + }; + + // convenience iterator to make it easy to loop all tests without a concat + const allTestsIterator = { + *[Symbol.iterator](): Generator, void, unknown> { + for (const testCase of normalizedTests.valid) { + yield testCase; + } + for (const testCase of normalizedTests.invalid) { + yield testCase; + } + }, + }; + + const hasOnly = ((): boolean => { + for (const test of allTestsIterator) { + if (test.only) { + return true; + } + } + return false; + })(); + if (hasOnly) { + // if there is an `only: true` - don't try apply constraints - assume that + // we are in "local development" mode rather than "CI validation" mode + return normalizedTests; + } + + const hasConstraints = ((): boolean => { + for (const test of allTestsIterator) { + if ( + test.dependencyConstraints && + Object.keys(test.dependencyConstraints).length > 0 + ) { + return true; + } + } + return false; + })(); + if (!hasConstraints) { + return normalizedTests; + } + + /* + Mark all unsatisfactory tests as `skip: true`. + We do this instead of just omitting the tests entirely because it gives the + test framework the opportunity to log the test as skipped rather than the test + just disappearing without a trace. + */ + const maybeMarkAsOnly = < + T extends + | InvalidTestCase + | ValidTestCase, + >( + test: T, + ): T => { + return { + ...test, + skip: !satisfiesAllDependencyConstraints(test.dependencyConstraints), + }; + }; + normalizedTests.valid = normalizedTests.valid.map(maybeMarkAsOnly); + normalizedTests.invalid = normalizedTests.invalid.map(maybeMarkAsOnly); + + return normalizedTests; + } + + /** + * Adds a new rule test to execute. + */ + run( + ruleName: string, + rule: RuleModule, + test: RunTests, + ): void { + const constructor = this.constructor as typeof RuleTester; + + if ( + this.#testerConfig.dependencyConstraints && + !satisfiesAllDependencyConstraints( + this.#testerConfig.dependencyConstraints, + ) + ) { + // for frameworks like mocha or jest that have a "skip" version of their function + // we can provide a nice skipped test! + constructor.describeSkip(ruleName, () => { + constructor.it( + 'All tests skipped due to unsatisfied constructor dependency constraints', + () => { + // some frameworks error if there are no assertions + assert.equal(true, true); + }, + ); + }); + + // don't run any tests because we don't match the base constraint + return; + } + + if (!test || typeof test !== 'object') { + throw new TypeError( + `Test Scenarios for rule ${ruleName} : Could not find test scenario object`, + ); + } + + const scenarioErrors: string[] = []; + REQUIRED_SCENARIOS.forEach(scenarioType => { + if (!test[scenarioType]) { + scenarioErrors.push( + `Could not find any ${scenarioType} test scenarios`, + ); + } + }); + + if (scenarioErrors.length > 0) { + throw new Error( + [ + `Test Scenarios for rule ${ruleName} is invalid:`, + ...scenarioErrors, + ].join('\n'), + ); + } + + if (typeof rule === 'function') { + emitLegacyRuleAPIWarning(ruleName); + } + + this.#linter.defineRule( + ruleName, + Object.assign({}, rule, { + // Create a wrapper rule that freezes the `context` properties. + create(context: RuleContext) { + freezeDeeply(context.options); + freezeDeeply(context.settings); + freezeDeeply(context.parserOptions); + + return (typeof rule === 'function' ? rule : rule.create)(context); + }, + }), + ); + + this.#linter.defineRules(this.#rules); + + const normalizedTests = this.#normalizeTests(test); + + function getTestMethod( + test: ValidTestCase, + ): 'it' | 'itOnly' | 'itSkip' { + if (test.skip) { + return 'itSkip'; + } + if (test.only) { + return 'itOnly'; + } + return 'it'; + } + + /* + * This creates a test suite and pipes all supplied info through + * one of the templates above. + */ + constructor.describe(ruleName, () => { + constructor.describe('valid', () => { + normalizedTests.valid.forEach(valid => { + const testName = ((): string => { + if (valid.name == null || valid.name.length === 0) { + return valid.code; + } + return valid.name; + })(); + constructor[getTestMethod(valid)](sanitize(testName), () => { + this.#testValidTemplate(ruleName, rule, valid); + }); + }); + }); + + constructor.describe('invalid', () => { + normalizedTests.invalid.forEach(invalid => { + const name = ((): string => { + if (invalid.name == null || invalid.name.length === 0) { + return invalid.code; + } + return invalid.name; + })(); + constructor[getTestMethod(invalid)](sanitize(name), () => { + this.#testInvalidTemplate(ruleName, rule, invalid); + }); + }); + }); + }); + } + + /** + * Run the rule for the given item + * @throws {Error} If an invalid schema. + * Use @private instead of #private to expose it for testing purposes + */ + private runRuleForItem< + TMessageIds extends string, + TOptions extends readonly unknown[], + >( + ruleName: string, + rule: RuleModule, + item: InvalidTestCase | ValidTestCase, + ): { + messages: Linter.LintMessage[]; + output: string; + beforeAST: TSESTree.Program; + afterAST: TSESTree.Program; + } { + let config: TesterConfigWithDefaults = merge({}, this.#testerConfig); + let code; + let filename; + let output; + let beforeAST: TSESTree.Program; + let afterAST: TSESTree.Program; + + if (typeof item === 'string') { + code = item; + } else { + code = item.code; + + /* + * Assumes everything on the item is a config except for the + * parameters used by this tester + */ + const itemConfig: Record = { ...item }; + + for (const parameter of RULE_TESTER_PARAMETERS) { + delete itemConfig[parameter]; + } + + /* + * Create the config object from the tester config and this item + * specific configurations. + */ + config = merge(config, itemConfig); + } + + if (item.filename) { + filename = item.filename; + } + + if (hasOwnProperty(item, 'options')) { + assert(Array.isArray(item.options), 'options must be an array'); + if ( + item.options.length > 0 && + typeof rule === 'object' && + (!rule.meta || (rule.meta && rule.meta.schema == null)) + ) { + emitMissingSchemaWarning(ruleName); + } + config.rules[ruleName] = ['error', ...item.options]; + } else { + config.rules[ruleName] = 'error'; + } + + const schema = getRuleOptionsSchema(rule); + + /* + * Setup AST getters. + * The goal is to check whether or not AST was modified when + * running the rule under test. + */ + this.#linter.defineRule('rule-tester/validate-ast', { + create() { + return { + Program(node): void { + beforeAST = cloneDeeplyExcludesParent(node); + }, + 'Program:exit'(node): void { + afterAST = node; + }, + }; + }, + }); + + if (typeof config.parser === 'string') { + assert( + path.isAbsolute(config.parser), + 'Parsers provided as strings to RuleTester must be absolute paths', + ); + } else { + config.parser = require.resolve(TYPESCRIPT_ESLINT_PARSER); + } + + this.#linter.defineParser( + config.parser, + wrapParser(require(config.parser) as Linter.ParserModule), + ); + + if (schema) { + ajv.validateSchema(schema); + + if (ajv.errors) { + const errors = ajv.errors + .map(error => { + const field = + error.dataPath[0] === '.' + ? error.dataPath.slice(1) + : error.dataPath; + + return `\t${field}: ${error.message}`; + }) + .join('\n'); + + throw new Error( + [`Schema for rule ${ruleName} is invalid:`, errors].join( + // no space after comma to match eslint core + ',', + ), + ); + } + + /* + * `ajv.validateSchema` checks for errors in the structure of the schema (by comparing the schema against a "meta-schema"), + * and it reports those errors individually. However, there are other types of schema errors that only occur when compiling + * the schema (e.g. using invalid defaults in a schema), and only one of these errors can be reported at a time. As a result, + * the schema is compiled here separately from checking for `validateSchema` errors. + */ + try { + ajv.compile(schema); + } catch (err) { + throw new Error( + `Schema for rule ${ruleName} is invalid: ${(err as Error).message}`, + ); + } + } + + validate(config, 'rule-tester', id => (id === ruleName ? rule : null)); + + // Verify the code. + // @ts-expect-error -- we don't define deprecated members on our types + const { getComments } = SourceCode.prototype as { getComments: unknown }; + let messages; + + try { + // @ts-expect-error -- we don't define deprecated members on our types + SourceCode.prototype.getComments = getCommentsDeprecation; + messages = this.#linter.verify(code, config, filename); + } finally { + // @ts-expect-error -- we don't define deprecated members on our types + SourceCode.prototype.getComments = getComments; + } + + const fatalErrorMessage = messages.find(m => m.fatal); + + assert( + !fatalErrorMessage, + `A fatal parsing error occurred: ${fatalErrorMessage?.message}`, + ); + + // Verify if autofix makes a syntax error or not. + if (messages.some(m => m.fix)) { + output = SourceCodeFixer.applyFixes(code, messages).output; + const errorMessageInFix = this.#linter + .verify(output, config, filename) + .find(m => m.fatal); + + assert( + !errorMessageInFix, + [ + 'A fatal parsing error occurred in autofix.', + `Error: ${errorMessageInFix?.message}`, + 'Autofix output:', + output, + ].join('\n'), + ); + } else { + output = code; + } + + return { + messages, + output, + // is definitely assigned within the `rule-tester/validate-ast` rule + beforeAST: beforeAST!, + // is definitely assigned within the `rule-tester/validate-ast` rule + afterAST: cloneDeeplyExcludesParent(afterAST!), + }; + } + + /** + * Check if the template is valid or not + * all valid cases go through this + */ + #testValidTemplate< + TMessageIds extends string, + TOptions extends readonly unknown[], + >( + ruleName: string, + rule: RuleModule, + itemIn: ValidTestCase | string, + ): void { + const item: ValidTestCase = + typeof itemIn === 'object' ? itemIn : { code: itemIn }; + + assert.ok( + typeof item.code === 'string', + "Test case must specify a string value for 'code'", + ); + if (item.name) { + assert.ok( + typeof item.name === 'string', + "Optional test case property 'name' must be a string", + ); + } + + const result = this.runRuleForItem(ruleName, rule, item); + const messages = result.messages; + + assert.strictEqual( + messages.length, + 0, + util.format( + 'Should have no errors but had %d: %s', + messages.length, + util.inspect(messages), + ), + ); + + assertASTDidntChange(result.beforeAST, result.afterAST); + } + + /** + * Check if the template is invalid or not + * all invalid cases go through this. + */ + #testInvalidTemplate< + TMessageIds extends string, + TOptions extends readonly unknown[], + >( + ruleName: string, + rule: RuleModule, + item: InvalidTestCase, + ): void { + assert.ok( + typeof item.code === 'string', + "Test case must specify a string value for 'code'", + ); + if (item.name) { + assert.ok( + typeof item.name === 'string', + "Optional test case property 'name' must be a string", + ); + } + assert.ok( + item.errors || item.errors === 0, + `Did not specify errors for an invalid test of ${ruleName}`, + ); + + if (Array.isArray(item.errors) && item.errors.length === 0) { + assert.fail('Invalid cases must have at least one error'); + } + + const ruleHasMetaMessages = + hasOwnProperty(rule, 'meta') && hasOwnProperty(rule.meta, 'messages'); + const friendlyIDList = ruleHasMetaMessages + ? `[${Object.keys(rule.meta.messages) + .map(key => `'${key}'`) + .join(', ')}]` + : null; + + const result = this.runRuleForItem(ruleName, rule, item); + const messages = result.messages; + + if (typeof item.errors === 'number') { + if (item.errors === 0) { + assert.fail("Invalid cases must have 'error' value greater than 0"); + } + + assert.strictEqual( + messages.length, + item.errors, + util.format( + 'Should have %d error%s but had %d: %s', + item.errors, + item.errors === 1 ? '' : 's', + messages.length, + util.inspect(messages), + ), + ); + } else { + assert.strictEqual( + messages.length, + item.errors.length, + util.format( + 'Should have %d error%s but had %d: %s', + item.errors.length, + item.errors.length === 1 ? '' : 's', + messages.length, + util.inspect(messages), + ), + ); + + const hasMessageOfThisRule = messages.some(m => m.ruleId === ruleName); + + for (let i = 0, l = item.errors.length; i < l; i++) { + const error = item.errors[i]; + const message = messages[i]; + + assert( + hasMessageOfThisRule, + 'Error rule name should be the same as the name of the rule being tested', + ); + + if (typeof error === 'string' || error instanceof RegExp) { + // Just an error message. + assertMessageMatches(message.message, error); + } else if (typeof error === 'object' && error != null) { + /* + * Error object. + * This may have a message, messageId, data, node type, line, and/or + * column. + */ + + Object.keys(error).forEach(propertyName => { + assert.ok( + ERROR_OBJECT_PARAMETERS.has(propertyName), + `Invalid error property name '${propertyName}'. Expected one of ${FRIENDLY_ERROR_OBJECT_PARAMETER_LIST}.`, + ); + }); + + // @ts-expect-error -- we purposely don't define `message` on our types as the current standard is `messageId` + if (hasOwnProperty(error, 'message')) { + assert.ok( + !hasOwnProperty(error, 'messageId'), + "Error should not specify both 'message' and a 'messageId'.", + ); + assert.ok( + !hasOwnProperty(error, 'data'), + "Error should not specify both 'data' and 'message'.", + ); + assertMessageMatches( + message.message, + // @ts-expect-error -- we purposely don't define `message` on our types as the current standard is `messageId` + error.message as unknown, + ); + } else if (hasOwnProperty(error, 'messageId')) { + assert.ok( + ruleHasMetaMessages, + "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'.", + ); + if (!hasOwnProperty(rule.meta.messages, error.messageId)) { + assert( + false, + `Invalid messageId '${error.messageId}'. Expected one of ${friendlyIDList}.`, + ); + } + assert.strictEqual( + message.messageId, + error.messageId, + `messageId '${message.messageId}' does not match expected messageId '${error.messageId}'.`, + ); + if (hasOwnProperty(error, 'data')) { + /* + * if data was provided, then directly compare the returned message to a synthetic + * interpolated message using the same message ID and data provided in the test. + * See https://github.com/eslint/eslint/issues/9890 for context. + */ + const unformattedOriginalMessage = + rule.meta.messages[error.messageId]; + const rehydratedMessage = interpolate( + unformattedOriginalMessage, + error.data, + ); + + assert.strictEqual( + message.message, + rehydratedMessage, + `Hydrated message "${rehydratedMessage}" does not match "${message.message}"`, + ); + } + } + + assert.ok( + hasOwnProperty(error, 'data') + ? hasOwnProperty(error, 'messageId') + : true, + "Error must specify 'messageId' if 'data' is used.", + ); + + if (error.type) { + assert.strictEqual( + message.nodeType, + error.type, + `Error type should be ${error.type}, found ${message.nodeType}`, + ); + } + + if (hasOwnProperty(error, 'line')) { + assert.strictEqual( + message.line, + error.line, + `Error line should be ${error.line}`, + ); + } + + if (hasOwnProperty(error, 'column')) { + assert.strictEqual( + message.column, + error.column, + `Error column should be ${error.column}`, + ); + } + + if (hasOwnProperty(error, 'endLine')) { + assert.strictEqual( + message.endLine, + error.endLine, + `Error endLine should be ${error.endLine}`, + ); + } + + if (hasOwnProperty(error, 'endColumn')) { + assert.strictEqual( + message.endColumn, + error.endColumn, + `Error endColumn should be ${error.endColumn}`, + ); + } + + if (hasOwnProperty(error, 'suggestions')) { + // Support asserting there are no suggestions + if ( + !error.suggestions || + (isReadonlyArray(error.suggestions) && + error.suggestions.length === 0) + ) { + if ( + Array.isArray(message.suggestions) && + message.suggestions.length > 0 + ) { + assert.fail( + `Error should have no suggestions on error with message: "${message.message}"`, + ); + } + } else { + assert( + Array.isArray(message.suggestions), + `Error should have an array of suggestions. Instead received "${String( + message.suggestions, + )}" on error with message: "${message.message}"`, + ); + const messageSuggestions = message.suggestions; + assert.strictEqual( + messageSuggestions.length, + error.suggestions.length, + `Error should have ${error.suggestions.length} suggestions. Instead found ${messageSuggestions.length} suggestions`, + ); + + error.suggestions.forEach((expectedSuggestion, index) => { + assert.ok( + typeof expectedSuggestion === 'object' && + expectedSuggestion != null, + "Test suggestion in 'suggestions' array must be an object.", + ); + Object.keys(expectedSuggestion).forEach(propertyName => { + assert.ok( + SUGGESTION_OBJECT_PARAMETERS.has(propertyName), + `Invalid suggestion property name '${propertyName}'. Expected one of ${FRIENDLY_SUGGESTION_OBJECT_PARAMETER_LIST}.`, + ); + }); + + const actualSuggestion = messageSuggestions[index]; + const suggestionPrefix = `Error Suggestion at index ${index} :`; + + // @ts-expect-error -- we purposely don't define `desc` on our types as the current standard is `messageId` + if (hasOwnProperty(expectedSuggestion, 'desc')) { + assert.ok( + !hasOwnProperty(expectedSuggestion, 'data'), + `${suggestionPrefix} Test should not specify both 'desc' and 'data'.`, + ); + // @ts-expect-error -- we purposely don't define `desc` on our types as the current standard is `messageId` + const expectedDesc = expectedSuggestion.desc as string; + assert.strictEqual( + actualSuggestion.desc, + expectedDesc, + `${suggestionPrefix} desc should be "${expectedDesc}" but got "${actualSuggestion.desc}" instead.`, + ); + } + + if (hasOwnProperty(expectedSuggestion, 'messageId')) { + assert.ok( + ruleHasMetaMessages, + `${suggestionPrefix} Test can not use 'messageId' if rule under test doesn't define 'meta.messages'.`, + ); + assert.ok( + hasOwnProperty( + rule.meta.messages, + expectedSuggestion.messageId, + ), + `${suggestionPrefix} Test has invalid messageId '${expectedSuggestion.messageId}', the rule under test allows only one of ${friendlyIDList}.`, + ); + assert.strictEqual( + actualSuggestion.messageId, + expectedSuggestion.messageId, + `${suggestionPrefix} messageId should be '${expectedSuggestion.messageId}' but got '${actualSuggestion.messageId}' instead.`, + ); + if (hasOwnProperty(expectedSuggestion, 'data')) { + const unformattedMetaMessage = + rule.meta.messages[expectedSuggestion.messageId]; + const rehydratedDesc = interpolate( + unformattedMetaMessage, + expectedSuggestion.data, + ); + + assert.strictEqual( + actualSuggestion.desc, + rehydratedDesc, + `${suggestionPrefix} Hydrated test desc "${rehydratedDesc}" does not match received desc "${actualSuggestion.desc}".`, + ); + } + } else { + assert.ok( + !hasOwnProperty(expectedSuggestion, 'data'), + `${suggestionPrefix} Test must specify 'messageId' if 'data' is used.`, + ); + } + + if (hasOwnProperty(expectedSuggestion, 'output')) { + const codeWithAppliedSuggestion = SourceCodeFixer.applyFixes( + item.code, + [actualSuggestion], + ).output; + + assert.strictEqual( + codeWithAppliedSuggestion, + expectedSuggestion.output, + `Expected the applied suggestion fix to match the test suggestion output for suggestion at index: ${index} on error with message: "${message.message}"`, + ); + } + }); + } + } + } else { + // Message was an unexpected type + assert.fail( + `Error should be a string, object, or RegExp, but found (${util.inspect( + message, + )})`, + ); + } + } + } + + if (hasOwnProperty(item, 'output')) { + if (item.output == null) { + assert.strictEqual( + result.output, + item.code, + 'Expected no autofixes to be suggested', + ); + } else { + assert.strictEqual(result.output, item.output, 'Output is incorrect.'); + } + } else { + assert.strictEqual( + result.output, + item.code, + "The rule fixed the code. Please add 'output' property.", + ); + } + + assertASTDidntChange(result.beforeAST, result.afterAST); + } +} + +/** + * Check if the AST was changed + */ +function assertASTDidntChange(beforeAST: unknown, afterAST: unknown): void { + assert.deepStrictEqual(beforeAST, afterAST, 'Rule should not modify AST.'); +} + +/** + * Asserts that the message matches its expected value. If the expected + * value is a regular expression, it is checked against the actual + * value. + */ +function assertMessageMatches(actual: string, expected: RegExp | string): void { + if (expected instanceof RegExp) { + // assert.js doesn't have a built-in RegExp match function + assert.ok( + expected.test(actual), + `Expected '${actual}' to match ${expected}`, + ); + } else { + assert.strictEqual(actual, expected); + } +} diff --git a/packages/rule-tester/src/TestFramework.ts b/packages/rule-tester/src/TestFramework.ts new file mode 100644 index 00000000000..dea77d74624 --- /dev/null +++ b/packages/rule-tester/src/TestFramework.ts @@ -0,0 +1,220 @@ +/** + * @param text a string describing the rule + * @param callback the test callback + */ +export type RuleTesterTestFrameworkFunctionBase = ( + text: string, + callback: () => void, +) => void; +export type RuleTesterTestFrameworkFunction = + RuleTesterTestFrameworkFunctionBase & { + /** + * Skips running the tests inside this `describe` for the current file + */ + skip?: RuleTesterTestFrameworkFunctionBase; + }; +export type RuleTesterTestFrameworkItFunction = + RuleTesterTestFrameworkFunctionBase & { + /** + * Only runs this test in the current file. + */ + only?: RuleTesterTestFrameworkFunctionBase; + /** + * Skips running this test in the current file. + */ + skip?: RuleTesterTestFrameworkFunctionBase; + }; + +type Maybe = T | null | undefined; + +/** + * @param fn a callback called after all the tests are done + */ +type AfterAll = (fn: () => void) => void; + +let OVERRIDE_AFTER_ALL: Maybe = null; +let OVERRIDE_DESCRIBE: Maybe = null; +let OVERRIDE_DESCRIBE_SKIP: Maybe = null; +let OVERRIDE_IT: Maybe = null; +let OVERRIDE_IT_ONLY: Maybe = null; +let OVERRIDE_IT_SKIP: Maybe = null; + +/* + * NOTE - If people use `mocha test.js --watch` command, the test function + * instances are different for each execution. + * This is why the getters get fresh instance always. + */ + +/** + * Defines a test framework used by the rule tester + * This class defaults to using functions defined on the global scope, but also + * allows the user to manually supply functions in case they want to roll their + * own tooling + */ +export abstract class TestFramework { + /** + * Runs a function after all the tests in this file have completed. + */ + static get afterAll(): AfterAll { + if (OVERRIDE_AFTER_ALL != null) { + return OVERRIDE_AFTER_ALL; + } + if (typeof afterAll === 'function') { + return afterAll; + } + throw new Error( + 'Missing definition for `afterAll` - you must set one using `RuleTester.afterAll` or there must be one defined globally as `afterAll`.', + ); + } + static set afterAll(value: Maybe) { + OVERRIDE_AFTER_ALL = value; + } + + /** + * Creates a test grouping + */ + static get describe(): RuleTesterTestFrameworkFunction { + if (OVERRIDE_DESCRIBE != null) { + return OVERRIDE_DESCRIBE; + } + if (typeof describe === 'function') { + return describe; + } + throw new Error( + 'Missing definition for `describe` - you must set one using `RuleTester.describe` or there must be one defined globally as `describe`.', + ); + } + static set describe(value: Maybe) { + OVERRIDE_DESCRIBE = value; + } + + /** + * Skips running the tests inside this `describe` for the current file + */ + static get describeSkip(): RuleTesterTestFrameworkFunctionBase { + if (OVERRIDE_DESCRIBE_SKIP != null) { + return OVERRIDE_DESCRIBE_SKIP; + } + if ( + typeof OVERRIDE_DESCRIBE === 'function' && + typeof OVERRIDE_DESCRIBE.skip === 'function' + ) { + return OVERRIDE_DESCRIBE.skip.bind(OVERRIDE_DESCRIBE); + } + if (typeof describe === 'function' && typeof describe.skip === 'function') { + return describe.skip.bind(describe); + } + if ( + typeof OVERRIDE_DESCRIBE === 'function' || + typeof OVERRIDE_IT === 'function' + ) { + throw new Error( + 'Set `RuleTester.describeSkip` to use `dependencyConstraints` with a custom test framework.', + ); + } + if (typeof describe === 'function') { + throw new Error( + 'The current test framework does not support skipping tests tests with `dependencyConstraints`.', + ); + } + throw new Error( + 'Missing definition for `describeSkip` - you must set one using `RuleTester.describeSkip` or there must be one defined globally as `describe.skip`.', + ); + } + static set describeSkip(value: Maybe) { + OVERRIDE_DESCRIBE_SKIP = value; + } + + /** + * Creates a test closure + */ + static get it(): RuleTesterTestFrameworkItFunction { + if (OVERRIDE_IT != null) { + return OVERRIDE_IT; + } + if (typeof it === 'function') { + return it; + } + throw new Error( + 'Missing definition for `it` - you must set one using `RuleTester.it` or there must be one defined globally as `it`.', + ); + } + static set it(value: Maybe) { + OVERRIDE_IT = value; + } + + /** + * Only runs this test in the current file. + */ + static get itOnly(): RuleTesterTestFrameworkFunctionBase { + if (OVERRIDE_IT_ONLY != null) { + return OVERRIDE_IT_ONLY; + } + if ( + typeof OVERRIDE_IT === 'function' && + typeof OVERRIDE_IT.only === 'function' + ) { + return OVERRIDE_IT.only.bind(OVERRIDE_IT); + } + if (typeof it === 'function' && typeof it.only === 'function') { + return it.only.bind(it); + } + if ( + typeof OVERRIDE_DESCRIBE === 'function' || + typeof OVERRIDE_IT === 'function' + ) { + throw new Error( + 'Set `RuleTester.itOnly` to use `only` with a custom test framework.\n' + + 'See https://eslint.org/docs/latest/integrate/nodejs-api#customizing-ruletester for more.', + ); + } + if (typeof it === 'function') { + throw new Error( + 'The current test framework does not support exclusive tests with `only`.', + ); + } + throw new Error( + 'Missing definition for `itOnly` - you must set one using `RuleTester.itOnly` or there must be one defined globally as `it.only`.', + ); + } + static set itOnly(value: Maybe) { + OVERRIDE_IT_ONLY = value; + } + + /** + * Skips running this test in the current file. + */ + static get itSkip(): RuleTesterTestFrameworkFunctionBase { + if (OVERRIDE_IT_SKIP != null) { + return OVERRIDE_IT_SKIP; + } + if ( + typeof OVERRIDE_IT === 'function' && + typeof OVERRIDE_IT.skip === 'function' + ) { + return OVERRIDE_IT.skip.bind(OVERRIDE_IT); + } + if (typeof it === 'function' && typeof it.skip === 'function') { + return it.skip.bind(it); + } + if ( + typeof OVERRIDE_DESCRIBE === 'function' || + typeof OVERRIDE_IT === 'function' + ) { + throw new Error( + 'Set `RuleTester.itSkip` to use `only` with a custom test framework.', + ); + } + if (typeof it === 'function') { + throw new Error( + 'The current test framework does not support exclusive tests with `only`.', + ); + } + throw new Error( + 'Missing definition for `itSkip` - you must set one using `RuleTester.itSkip` or there must be one defined globally as `it.only`.', + ); + } + static set itSkip(value: Maybe) { + OVERRIDE_IT_SKIP = value; + } +} diff --git a/packages/rule-tester/src/index.ts b/packages/rule-tester/src/index.ts new file mode 100644 index 00000000000..6ea08fc5add --- /dev/null +++ b/packages/rule-tester/src/index.ts @@ -0,0 +1,16 @@ +export { RuleTester } from './RuleTester'; +export { noFormat } from './noFormat'; +export type { + InvalidTestCase, + RuleTesterConfig, + RunTests, + SuggestionOutput, + TestCaseError, + ValidTestCase, +} from './types'; +export type { + AtLeastVersionConstraint, + DependencyConstraint, + SemverVersionConstraint, + VersionConstraint, +} from './types/DependencyConstraint'; diff --git a/packages/rule-tester/src/noFormat.ts b/packages/rule-tester/src/noFormat.ts new file mode 100644 index 00000000000..e52001cdb66 --- /dev/null +++ b/packages/rule-tester/src/noFormat.ts @@ -0,0 +1,7 @@ +/** + * Simple no-op tag to mark code samples as "should not format with prettier" + * for the plugin-test-formatting lint rule + */ +export function noFormat(raw: TemplateStringsArray, ...keys: string[]): string { + return String.raw({ raw }, ...keys); +} diff --git a/packages/rule-tester/src/types/DependencyConstraint.ts b/packages/rule-tester/src/types/DependencyConstraint.ts new file mode 100644 index 00000000000..ecb86e912cd --- /dev/null +++ b/packages/rule-tester/src/types/DependencyConstraint.ts @@ -0,0 +1,20 @@ +import type { RangeOptions } from 'semver'; + +export interface SemverVersionConstraint { + readonly range: string; + readonly options?: RangeOptions | boolean; +} +export type AtLeastVersionConstraint = + | `${number}.${number}.${number}-${string}` + | `${number}.${number}.${number}` + | `${number}.${number}` + | `${number}`; +export type VersionConstraint = + | AtLeastVersionConstraint + | SemverVersionConstraint; +export interface DependencyConstraint { + /** + * Passing a string for the value is shorthand for a '>=' constraint + */ + readonly [packageName: string]: VersionConstraint; +} diff --git a/packages/rule-tester/src/types/InvalidTestCase.ts b/packages/rule-tester/src/types/InvalidTestCase.ts new file mode 100644 index 00000000000..1bef9e2b89f --- /dev/null +++ b/packages/rule-tester/src/types/InvalidTestCase.ts @@ -0,0 +1,80 @@ +import type { AST_NODE_TYPES, AST_TOKEN_TYPES } from '@typescript-eslint/utils'; +import type { ReportDescriptorMessageData } from '@typescript-eslint/utils/ts-eslint'; + +import type { DependencyConstraint } from './DependencyConstraint'; +import type { ValidTestCase } from './ValidTestCase'; + +export interface SuggestionOutput { + /** + * Reported message ID. + */ + readonly messageId: TMessageIds; + /** + * The data used to fill the message template. + */ + readonly data?: ReportDescriptorMessageData; + /** + * NOTE: Suggestions will be applied as a stand-alone change, without triggering multi-pass fixes. + * Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion. + */ + readonly output: string; + + // we disallow this because it's much better to use messageIds for reusable errors that are easily testable + // readonly desc?: string; +} + +export interface TestCaseError { + /** + * The 1-based column number of the reported start location. + */ + readonly column?: number; + /** + * The data used to fill the message template. + */ + readonly data?: ReportDescriptorMessageData; + /** + * The 1-based column number of the reported end location. + */ + readonly endColumn?: number; + /** + * The 1-based line number of the reported end location. + */ + readonly endLine?: number; + /** + * The 1-based line number of the reported start location. + */ + readonly line?: number; + /** + * Reported message ID. + */ + readonly messageId: TMessageIds; + /** + * Reported suggestions. + */ + readonly suggestions?: readonly SuggestionOutput[] | null; + /** + * The type of the reported AST node. + */ + readonly type?: AST_NODE_TYPES | AST_TOKEN_TYPES; + + // we disallow this because it's much better to use messageIds for reusable errors that are easily testable + // readonly message?: string | RegExp; +} + +export interface InvalidTestCase< + TMessageIds extends string, + TOptions extends Readonly, +> extends ValidTestCase { + /** + * Expected errors. + */ + readonly errors: readonly TestCaseError[]; + /** + * The expected code after autofixes are applied. If set to `null`, the test runner will assert that no autofix is suggested. + */ + readonly output?: string | null; + /** + * Constraints that must pass in the current environment for the test to run + */ + readonly dependencyConstraints?: DependencyConstraint; +} diff --git a/packages/rule-tester/src/types/RuleTesterConfig.ts b/packages/rule-tester/src/types/RuleTesterConfig.ts new file mode 100644 index 00000000000..c722c5be074 --- /dev/null +++ b/packages/rule-tester/src/types/RuleTesterConfig.ts @@ -0,0 +1,27 @@ +import type { Linter, ParserOptions } from '@typescript-eslint/utils/ts-eslint'; + +import type { DependencyConstraint } from './DependencyConstraint'; + +export interface RuleTesterConfig extends Linter.Config { + /** + * The default parser to use for tests. + * @default '@typescript-eslint/parser' + */ + readonly parser: string; + /** + * The default parser options to use for tests. + */ + readonly parserOptions?: Readonly; + /** + * Constraints that must pass in the current environment for any tests to run. + */ + readonly dependencyConstraints?: DependencyConstraint; + /** + * The default filenames to use for type-aware tests. + * @default { ts: 'file.ts', tsx: 'react.tsx' } + */ + readonly defaultFilenames?: Readonly<{ + ts: string; + tsx: string; + }>; +} diff --git a/packages/rule-tester/src/types/ValidTestCase.ts b/packages/rule-tester/src/types/ValidTestCase.ts new file mode 100644 index 00000000000..74776b58f19 --- /dev/null +++ b/packages/rule-tester/src/types/ValidTestCase.ts @@ -0,0 +1,57 @@ +import type { + ParserOptions, + SharedConfigurationSettings, +} from '@typescript-eslint/utils/ts-eslint'; + +import type { DependencyConstraint } from './DependencyConstraint'; + +export interface ValidTestCase> { + /** + * Name for the test case. + */ + readonly name?: string; + /** + * Code for the test case. + */ + readonly code: string; + /** + * Environments for the test case. + */ + readonly env?: Readonly>; + /** + * The fake filename for the test case. Useful for rules that make assertion about filenames. + */ + readonly filename?: string; + /** + * The additional global variables. + */ + readonly globals?: Record; + /** + * Options for the test case. + */ + readonly options?: Readonly; + /** + * The absolute path for the parser. + */ + readonly parser?: string; + /** + * Options for the parser. + */ + readonly parserOptions?: Readonly; + /** + * Settings for the test case. + */ + readonly settings?: Readonly; + /** + * Run this case exclusively for debugging in supported test frameworks. + */ + readonly only?: boolean; + /** + * Skip this case in supported test frameworks. + */ + readonly skip?: boolean; + /** + * Constraints that must pass in the current environment for the test to run + */ + readonly dependencyConstraints?: DependencyConstraint; +} diff --git a/packages/rule-tester/src/types/index.ts b/packages/rule-tester/src/types/index.ts new file mode 100644 index 00000000000..a4901875d9e --- /dev/null +++ b/packages/rule-tester/src/types/index.ts @@ -0,0 +1,36 @@ +import type { InvalidTestCase } from './InvalidTestCase'; +import type { RuleTesterConfig } from './RuleTesterConfig'; +import type { ValidTestCase } from './ValidTestCase'; + +type Mutable = { + -readonly [P in keyof T]: T[P]; +}; +export type TesterConfigWithDefaults = Mutable< + Required> & + RuleTesterConfig +>; + +export interface RunTests< + TMessageIds extends string, + TOptions extends Readonly, +> { + // RuleTester.run also accepts strings for valid cases + readonly valid: readonly (ValidTestCase | string)[]; + readonly invalid: readonly InvalidTestCase[]; +} + +export interface NormalizedRunTests< + TMessageIds extends string, + TOptions extends Readonly, +> { + readonly valid: readonly ValidTestCase[]; + readonly invalid: readonly InvalidTestCase[]; +} + +export type { ValidTestCase } from './ValidTestCase'; +export type { + InvalidTestCase, + SuggestionOutput, + TestCaseError, +} from './InvalidTestCase'; +export type { RuleTesterConfig } from './RuleTesterConfig'; diff --git a/packages/rule-tester/src/utils/SourceCodeFixer.ts b/packages/rule-tester/src/utils/SourceCodeFixer.ts new file mode 100644 index 00000000000..9346b42b080 --- /dev/null +++ b/packages/rule-tester/src/utils/SourceCodeFixer.ts @@ -0,0 +1,117 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/linter/source-code-fixer.js + +import type { Linter } from '@typescript-eslint/utils/ts-eslint'; + +import { hasOwnProperty } from './hasOwnProperty'; + +type LintMessage = Linter.LintMessage | Linter.LintSuggestion; +type LintMessageWithFix = LintMessage & Required>; + +const BOM = '\uFEFF'; + +/** + * Compares items in a messages array by range. + * @returns -1 if a comes before b, 1 if a comes after b, 0 if equal. + */ +function compareMessagesByFixRange( + a: LintMessageWithFix, + b: LintMessageWithFix, +): number { + return a.fix.range[0] - b.fix.range[0] || a.fix.range[1] - b.fix.range[1]; +} + +/** + * Compares items in a messages array by line and column. + * @returns -1 if a comes before b, 1 if a comes after b, 0 if equal. + */ +function compareMessagesByLocation(a: LintMessage, b: LintMessage): number { + // @ts-expect-error -- it's not possible for suggestions to reach this location + return a.line - b.line || a.column - b.column; +} + +/** + * Applies the fixes specified by the messages to the given text. Tries to be + * smart about the fixes and won't apply fixes over the same area in the text. + * @param sourceText The text to apply the changes to. + * @param messages The array of messages reported by ESLint. + * @returns {Object} An object containing the fixed text and any unfixed messages. + */ +export function applyFixes( + sourceText: string, + messages: readonly LintMessage[], +): { + fixed: boolean; + messages: readonly LintMessage[]; + output: string; +} { + // clone the array + const remainingMessages: LintMessage[] = []; + const fixes: LintMessageWithFix[] = []; + const bom = sourceText.startsWith(BOM) ? BOM : ''; + const text = bom ? sourceText.slice(1) : sourceText; + let lastPos = Number.NEGATIVE_INFINITY; + let output = bom; + + /** + * Try to use the 'fix' from a problem. + * @param {Message} problem The message object to apply fixes from + * @returns {boolean} Whether fix was successfully applied + */ + function attemptFix(problem: LintMessageWithFix): boolean { + const fix = problem.fix; + const start = fix.range[0]; + const end = fix.range[1]; + + // Remain it as a problem if it's overlapped or it's a negative range + if (lastPos >= start || start > end) { + remainingMessages.push(problem); + return false; + } + + // Remove BOM. + if ((start < 0 && end >= 0) || (start === 0 && fix.text.startsWith(BOM))) { + output = ''; + } + + // Make output to this fix. + output += text.slice(Math.max(0, lastPos), Math.max(0, start)); + output += fix.text; + lastPos = end; + return true; + } + + messages.forEach(problem => { + if (hasOwnProperty(problem, 'fix')) { + fixes.push(problem); + } else { + remainingMessages.push(problem); + } + }); + + if (fixes.length) { + let fixesWereApplied = false; + + for (const problem of fixes.sort(compareMessagesByFixRange)) { + attemptFix(problem); + + /* + * The only time attemptFix will fail is if a previous fix was + * applied which conflicts with it. So we can mark this as true. + */ + fixesWereApplied = true; + } + output += text.slice(Math.max(0, lastPos)); + + return { + fixed: fixesWereApplied, + messages: remainingMessages.sort(compareMessagesByLocation), + output, + }; + } + + return { + fixed: false, + messages, + output: bom + text, + }; +} diff --git a/packages/rule-tester/src/utils/ajv.ts b/packages/rule-tester/src/utils/ajv.ts new file mode 100644 index 00000000000..f3dcacc641d --- /dev/null +++ b/packages/rule-tester/src/utils/ajv.ts @@ -0,0 +1,23 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/ajv.js + +import Ajv from 'ajv'; +import metaSchema from 'ajv/lib/refs/json-schema-draft-04.json'; + +export function ajvBuilder(additionalOptions = {}): Ajv.Ajv { + const ajv = new Ajv({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: 'ignore', + verbose: true, + schemaId: 'auto', + ...additionalOptions, + }); + + ajv.addMetaSchema(metaSchema); + + // @ts-expect-error -- this is an untyped part of the ajv API + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; +} diff --git a/packages/rule-tester/src/utils/cloneDeeplyExcludesParent.ts b/packages/rule-tester/src/utils/cloneDeeplyExcludesParent.ts new file mode 100644 index 00000000000..b3bb23869a7 --- /dev/null +++ b/packages/rule-tester/src/utils/cloneDeeplyExcludesParent.ts @@ -0,0 +1,23 @@ +/** + * Clones a given value deeply. + * Note: This ignores `parent` property. + */ +export function cloneDeeplyExcludesParent(x: T): T { + if (typeof x === 'object' && x != null) { + if (Array.isArray(x)) { + return x.map(cloneDeeplyExcludesParent) as T; + } + + const retv = {} as typeof x; + + for (const key in x) { + if (key !== 'parent' && Object.prototype.hasOwnProperty.call(x, key)) { + retv[key] = cloneDeeplyExcludesParent(x[key]); + } + } + + return retv; + } + + return x; +} diff --git a/packages/rule-tester/src/utils/config-schema.ts b/packages/rule-tester/src/utils/config-schema.ts new file mode 100644 index 00000000000..8aaa46d4cac --- /dev/null +++ b/packages/rule-tester/src/utils/config-schema.ts @@ -0,0 +1,91 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/conf/config-schema.js + +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; + +const baseConfigProperties: Record = { + $schema: { type: 'string' }, + defaultFilenames: { + type: 'object', + properties: { + ts: { type: 'string' }, + tsx: { type: 'string' }, + }, + required: ['ts', 'tsx'], + additionalProperties: false, + }, + dependencyConstraints: { + type: 'object', + additionalProperties: { + type: 'string', + }, + }, + env: { type: 'object' }, + extends: { $ref: '#/definitions/stringOrStrings' }, + globals: { type: 'object' }, + noInlineConfig: { type: 'boolean' }, + overrides: { + type: 'array', + items: { $ref: '#/definitions/overrideConfig' }, + additionalItems: false, + }, + parser: { type: ['string', 'null'] }, + parserOptions: { type: 'object' }, + plugins: { type: 'array' }, + processor: { type: 'string' }, + reportUnusedDisableDirectives: { type: 'boolean' }, + rules: { type: 'object' }, + settings: { type: 'object' }, + + ecmaFeatures: { type: 'object' }, // deprecated; logs a warning when used +}; + +export const configSchema: JSONSchema4 = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: 'string' }, + { + type: 'array', + items: { type: 'string' }, + additionalItems: false, + }, + ], + }, + stringOrStringsRequired: { + oneOf: [ + { type: 'string' }, + { + type: 'array', + items: { type: 'string' }, + additionalItems: false, + minItems: 1, + }, + ], + }, + + // Config at top-level. + objectConfig: { + type: 'object', + properties: { + root: { type: 'boolean' }, + ignorePatterns: { $ref: '#/definitions/stringOrStrings' }, + ...baseConfigProperties, + }, + additionalProperties: false, + }, + + // Config in `overrides`. + overrideConfig: { + type: 'object', + properties: { + excludedFiles: { $ref: '#/definitions/stringOrStrings' }, + files: { $ref: '#/definitions/stringOrStringsRequired' }, + ...baseConfigProperties, + }, + required: ['files'], + additionalProperties: false, + }, + }, + + $ref: '#/definitions/objectConfig', +}; diff --git a/packages/rule-tester/src/utils/config-validator.ts b/packages/rule-tester/src/utils/config-validator.ts new file mode 100644 index 00000000000..ef88f7e664e --- /dev/null +++ b/packages/rule-tester/src/utils/config-validator.ts @@ -0,0 +1,288 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/config-validator.js + +import util from 'node:util'; + +import { Legacy } from '@eslint/eslintrc'; +import type { AnyRuleModule, Linter } from '@typescript-eslint/utils/ts-eslint'; +import type { + AdditionalPropertiesParams, + ErrorObject as AjvErrorObject, + ValidateFunction, +} from 'ajv'; +import { builtinRules } from 'eslint/use-at-your-own-risk'; + +import type { TesterConfigWithDefaults } from '../types'; +import { ajvBuilder } from './ajv'; +import { configSchema } from './config-schema'; +import { emitDeprecationWarning } from './deprecation-warnings'; +import { getRuleOptionsSchema } from './getRuleOptionsSchema'; +import { hasOwnProperty } from './hasOwnProperty'; + +type GetAdditionalRule = (ruleId: string) => AnyRuleModule | null; + +const { ConfigOps, environments: BuiltInEnvironments } = Legacy; +const ajv = ajvBuilder(); +const ruleValidators = new WeakMap(); + +let validateSchema: ValidateFunction; +const severityMap = { + error: 2, + warn: 1, + off: 0, +} as const; + +/** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param options The given options for the rule. + * @throws {Error} Wrong severity value. + */ +function validateRuleSeverity(options: Linter.RuleEntry): number | string { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = + typeof severity === 'string' + ? severityMap[severity.toLowerCase() as Linter.SeverityString] + : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error( + `\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util + .inspect(severity) + .replace(/'/gu, '"') + .replace(/\n/gu, '')}').\n`, + ); +} + +/** + * Validates the non-severity options passed to a rule, based on its schema. + * @param rule The rule to validate + * @param localOptions The options for the rule, excluding severity + * @throws {Error} Any rule validation errors. + */ +function validateRuleSchema( + rule: AnyRuleModule, + localOptions: unknown[], +): void { + if (!ruleValidators.has(rule)) { + const schema = getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error( + validateRule.errors + .map( + error => + `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`, + ) + .join(''), + ); + } + } +} + +/** + * Validates a rule's options against its schema. + * @param rule The rule that the config is being validated for + * @param ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @throws {Error} Upon any bad rule configuration. + */ +function validateRuleOptions( + rule: AnyRuleModule, + ruleId: string, + options: Linter.RuleEntry, + source: string | null = null, +): void { + try { + const severity = validateRuleSeverity(options); + + if (severity !== 0) { + validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${ + (err as Error).message + }`; + + if (typeof source === 'string') { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } +} + +/** + * Validates an environment object + * @param environment The environment config object to validate. + * @param source The name of the configuration source to report in any errors. + */ +function validateEnvironment( + environment: Linter.EnvironmentConfig | undefined, + source: string, +): void { + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = BuiltInEnvironments.get(id) ?? null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); +} + +/** + * Validates a rules config object + * @param rulesConfig The rules config object to validate. + * @param source The name of the configuration source to report in any errors. + * @param getAdditionalRule A map from strings to loaded rules + */ +function validateRules( + rulesConfig: Linter.RulesRecord | undefined, + source: string, + getAdditionalRule: GetAdditionalRule, +): void { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) ?? builtinRules.get(id) ?? null; + if (rule == null) { + return; + } + + validateRuleOptions(rule, id, rulesConfig[id]!, source); + }); +} + +/** + * Validates a `globals` section of a config file + * @param globalsConfig The `globals` section + * @param source The name of the configuration source to report in the event of an error. + */ +function validateGlobals( + globalsConfig: Linter.GlobalsConfig | undefined, + source: string | null = null, +): void { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig).forEach( + ([configuredGlobal, configuredValue]) => { + try { + ConfigOps.normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error( + `ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${ + (err as Error).message + }`, + ); + } + }, + ); +} + +/** + * Formats an array of schema validation errors. + */ +function formatErrors(errors: AjvErrorObject[]): string { + return errors + .map(error => { + if (error.keyword === 'additionalProperties') { + const params = error.params as AdditionalPropertiesParams; + const formattedPropertyPath = error.dataPath.length + ? `${error.dataPath.slice(1)}.${params.additionalProperty}` + : params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === 'type') { + const formattedField = error.dataPath.slice(1); + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const formattedExpectedType = Array.isArray(error.schema) + ? error.schema.join('/') + : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = + error.dataPath[0] === '.' ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify( + error.data, + )}`; + }) + .map(message => `\t- ${message}.\n`) + .join(''); +} + +/** + * Validates the top level properties of the config object. + * @param config The config object to validate. + * @param source The name of the configuration source to report in any errors. + * @throws {Error} For any config invalid per the schema. + */ +function validateConfigSchema( + config: TesterConfigWithDefaults, + source: string, +): void { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error( + `ESLint configuration in ${source} is invalid:\n${formatErrors( + validateSchema.errors!, + )}`, + ); + } + + // @ts-expect-error -- intentional deprecated check + if (hasOwnProperty(config, 'ecmaFeatures')) { + emitDeprecationWarning(source, 'ESLINT_LEGACY_ECMAFEATURES'); + } +} + +/** + * Validates an entire config object. + * @param config The config object to validate. + * @param source The name of the configuration source to report in any errors. + * @param getAdditionalRule A map from strings to loaded rules. + */ +export function validate( + config: TesterConfigWithDefaults, + source: string, + getAdditionalRule: GetAdditionalRule, +): void { + validateConfigSchema(config, source); + validateRules(config.rules, source, getAdditionalRule); + validateEnvironment(config.env, source); + validateGlobals(config.globals, source); + + for (const override of config.overrides ?? []) { + validateRules(override.rules, source, getAdditionalRule); + validateEnvironment(override.env, source); + validateGlobals(config.globals, source); + } +} diff --git a/packages/utils/src/eslint-utils/rule-tester/dependencyConstraints.ts b/packages/rule-tester/src/utils/dependencyConstraints.ts similarity index 60% rename from packages/utils/src/eslint-utils/rule-tester/dependencyConstraints.ts rename to packages/rule-tester/src/utils/dependencyConstraints.ts index 0bc1f5fc5ce..e651356587a 100644 --- a/packages/utils/src/eslint-utils/rule-tester/dependencyConstraints.ts +++ b/packages/rule-tester/src/utils/dependencyConstraints.ts @@ -1,21 +1,9 @@ import * as semver from 'semver'; -interface SemverVersionConstraint { - readonly range: string; - readonly options?: Parameters[2]; -} -type AtLeastVersionConstraint = - | `${number}` - | `${number}.${number}` - | `${number}.${number}.${number}` - | `${number}.${number}.${number}-${string}`; -type VersionConstraint = SemverVersionConstraint | AtLeastVersionConstraint; -interface DependencyConstraint { - /** - * Passing a string for the value is shorthand for a '>=' constraint - */ - readonly [packageName: string]: VersionConstraint; -} +import type { + DependencyConstraint, + SemverVersionConstraint, +} from '../types/DependencyConstraint'; const BASE_SATISFIES_OPTIONS: semver.RangeOptions = { includePrerelease: true, @@ -41,7 +29,7 @@ function satisfiesDependencyConstraint( ); } -function satisfiesAllDependencyConstraints( +export function satisfiesAllDependencyConstraints( dependencyConstraints: DependencyConstraint | undefined, ): boolean { if (dependencyConstraints == null) { @@ -58,6 +46,3 @@ function satisfiesAllDependencyConstraints( return true; } - -export { satisfiesAllDependencyConstraints }; -export type { DependencyConstraint }; diff --git a/packages/rule-tester/src/utils/deprecation-warnings.ts b/packages/rule-tester/src/utils/deprecation-warnings.ts new file mode 100644 index 00000000000..9f264a41296 --- /dev/null +++ b/packages/rule-tester/src/utils/deprecation-warnings.ts @@ -0,0 +1,40 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/deprecation-warnings.js + +import path from 'node:path'; + +// Definitions for deprecation warnings. +const deprecationWarningMessages = { + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect.", +} as const; + +const sourceFileErrorCache = new Set(); + +/** + * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted + * for each unique file path, but repeated invocations with the same file path have no effect. + * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. + * @param source The name of the configuration source to report the warning for. + * @param errorCode The warning message to show. + */ +export function emitDeprecationWarning( + source: string, + errorCode: keyof typeof deprecationWarningMessages, +): void { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + + sourceFileErrorCache.add(cacheKey); + + const rel = path.relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + 'DeprecationWarning', + errorCode, + ); +} diff --git a/packages/rule-tester/src/utils/freezeDeeply.ts b/packages/rule-tester/src/utils/freezeDeeply.ts new file mode 100644 index 00000000000..36c375063ae --- /dev/null +++ b/packages/rule-tester/src/utils/freezeDeeply.ts @@ -0,0 +1,17 @@ +/** + * Freezes a given value deeply. + */ +export function freezeDeeply(x: unknown): void { + if (typeof x === 'object' && x != null) { + if (Array.isArray(x)) { + x.forEach(freezeDeeply); + } else { + for (const key in x) { + if (key !== 'parent' && Object.prototype.hasOwnProperty.call(x, key)) { + freezeDeeply((x as Record)[key]); + } + } + } + Object.freeze(x); + } +} diff --git a/packages/rule-tester/src/utils/getRuleOptionsSchema.ts b/packages/rule-tester/src/utils/getRuleOptionsSchema.ts new file mode 100644 index 00000000000..51f94711f70 --- /dev/null +++ b/packages/rule-tester/src/utils/getRuleOptionsSchema.ts @@ -0,0 +1,35 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/shared/config-validator.js#LL50-L82C2 + +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; +import type { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint'; + +import { isReadonlyArray } from './isReadonlyArray'; + +/** + * Gets a complete options schema for a rule. + * @param rule A new-style rule object + * @returns JSON Schema for the rule's options. + */ +export function getRuleOptionsSchema(rule: AnyRuleModule): JSONSchema4 | null { + const schema = rule.meta?.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (isReadonlyArray(schema)) { + if (schema.length) { + return { + type: 'array', + items: schema as JSONSchema4[], + minItems: 0, + maxItems: schema.length, + }; + } + return { + type: 'array', + minItems: 0, + maxItems: 0, + }; + } + + // Given a full schema, leave it alone + return schema || null; +} diff --git a/packages/rule-tester/src/utils/hasOwnProperty.ts b/packages/rule-tester/src/utils/hasOwnProperty.ts new file mode 100644 index 00000000000..a8816f89fe8 --- /dev/null +++ b/packages/rule-tester/src/utils/hasOwnProperty.ts @@ -0,0 +1,8 @@ +// typed so that TS can remove optionality +export const hasOwnProperty = Function.call.bind(Object.hasOwnProperty) as < + TObj extends object, + TK extends keyof TObj, +>( + obj: TObj, + key: TK, +) => obj is TObj & { [key in TK]-?: TObj[key] }; diff --git a/packages/rule-tester/src/utils/interpolate.ts b/packages/rule-tester/src/utils/interpolate.ts new file mode 100644 index 00000000000..0b3266fefb9 --- /dev/null +++ b/packages/rule-tester/src/utils/interpolate.ts @@ -0,0 +1,27 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/lib/linter/interpolate.js + +import type { ReportDescriptorMessageData } from '@typescript-eslint/utils/ts-eslint'; + +export function interpolate( + text: string, + data: ReportDescriptorMessageData, +): string { + if (!data) { + return text; + } + + // Substitution content for any {{ }} markers. + return text.replace( + /\{\{([^{}]+?)\}\}/gu, + (fullMatch, termWithWhitespace: string) => { + const term = termWithWhitespace.trim(); + + if (term in data) { + return String(data[term]); + } + + // Preserve old behavior: If parameter name not provided, don't replace it. + return fullMatch; + }, + ); +} diff --git a/packages/rule-tester/src/utils/isReadonlyArray.ts b/packages/rule-tester/src/utils/isReadonlyArray.ts new file mode 100644 index 00000000000..b16a9f31f01 --- /dev/null +++ b/packages/rule-tester/src/utils/isReadonlyArray.ts @@ -0,0 +1,4 @@ +// working around https://github.com/microsoft/TypeScript/issues/17002 +export function isReadonlyArray(arg: unknown): arg is readonly unknown[] { + return Array.isArray(arg); +} diff --git a/packages/rule-tester/src/utils/validationHelpers.ts b/packages/rule-tester/src/utils/validationHelpers.ts new file mode 100644 index 00000000000..33fd0c234de --- /dev/null +++ b/packages/rule-tester/src/utils/validationHelpers.ts @@ -0,0 +1,182 @@ +import { simpleTraverse } from '@typescript-eslint/typescript-estree'; +import type { TSESTree } from '@typescript-eslint/utils'; +import type { Linter, SourceCode } from '@typescript-eslint/utils/ts-eslint'; + +/* + * List every parameters possible on a test case that are not related to eslint + * configuration + */ +export const RULE_TESTER_PARAMETERS = [ + 'code', + 'defaultFilenames', + 'dependencyConstraints', + 'errors', + 'filename', + 'name', + 'only', + 'options', + 'output', + 'skip', +] as const; + +/* + * All allowed property names in error objects. + */ +export const ERROR_OBJECT_PARAMETERS: ReadonlySet = new Set([ + 'column', + 'data', + 'endColumn', + 'endLine', + 'line', + 'message', + 'messageId', + 'suggestions', + 'type', +]); +export const FRIENDLY_ERROR_OBJECT_PARAMETER_LIST = `[${[ + ...ERROR_OBJECT_PARAMETERS, +] + .map(key => `'${key}'`) + .join(', ')}]`; + +/* + * All allowed property names in suggestion objects. + */ +export const SUGGESTION_OBJECT_PARAMETERS: ReadonlySet = new Set([ + 'data', + 'desc', + 'messageId', + 'output', +]); +export const FRIENDLY_SUGGESTION_OBJECT_PARAMETER_LIST = `[${[ + ...SUGGESTION_OBJECT_PARAMETERS, +] + .map(key => `'${key}'`) + .join(', ')}]`; + +/** + * Replace control characters by `\u00xx` form. + */ +export function sanitize(text: string): string { + if (typeof text !== 'string') { + return ''; + } + return text.replace( + // eslint-disable-next-line no-control-regex + /[\u0000-\u0009\u000b-\u001a]/gu, + c => `\\u${c.codePointAt(0)!.toString(16).padStart(4, '0')}`, + ); +} + +// this symbol is used internally by ESLint to unwrap the wrapped parser +// https://github.com/eslint/eslint/blob/129e252132c7c476d7de17f40b54a333ddb2e6bb/lib/linter/linter.js#L139-L146 +const parserSymbol = Symbol.for('eslint.RuleTester.parser'); +/** + * Wraps the given parser in order to intercept and modify return values from the `parse` and `parseForESLint` methods, for test purposes. + * In particular, to modify ast nodes, tokens and comments to throw on access to their `start` and `end` properties. + */ +export function wrapParser(parser: Linter.ParserModule): Linter.ParserModule { + /** + * Define `start`/`end` properties of all nodes of the given AST as throwing error. + */ + function defineStartEndAsErrorInTree( + ast: TSESTree.Program, + visitorKeys?: Readonly, + ): void { + /** + * Define `start`/`end` properties as throwing error. + */ + function defineStartEndAsError(objName: string, node: unknown): void { + Object.defineProperties(node, { + start: { + get() { + throw new Error( + `Use ${objName}.range[0] instead of ${objName}.start`, + ); + }, + configurable: true, + enumerable: false, + }, + end: { + get() { + throw new Error( + `Use ${objName}.range[1] instead of ${objName}.end`, + ); + }, + configurable: true, + enumerable: false, + }, + }); + } + + simpleTraverse(ast, { + visitorKeys: visitorKeys, + enter: node => defineStartEndAsError('node', node), + }); + ast.tokens?.forEach(token => defineStartEndAsError('token', token)); + ast.comments?.forEach(comment => defineStartEndAsError('token', comment)); + } + + if ('parseForESLint' in parser) { + return { + // @ts-expect-error -- see above + [parserSymbol]: parser, + parseForESLint(...args): Linter.ESLintParseResult { + const ret = parser.parseForESLint(...args); + + defineStartEndAsErrorInTree(ret.ast, ret.visitorKeys); + return ret; + }, + }; + } + + return { + // @ts-expect-error -- see above + [parserSymbol]: parser, + parse(...args): TSESTree.Program { + const ast = parser.parse(...args); + + defineStartEndAsErrorInTree(ast); + return ast; + }, + }; +} + +/** + * Function to replace `SourceCode.prototype.getComments`. + */ +export function getCommentsDeprecation(): never { + throw new Error( + '`SourceCode#getComments()` is deprecated and will be removed in a future major version. Use `getCommentsBefore()`, `getCommentsAfter()`, and `getCommentsInside()` instead.', + ); +} + +const EMIT_LEGACY_RULE_API_WARNING: Record = {}; +/** + * Emit a deprecation warning if function-style format is being used. + */ +export function emitLegacyRuleAPIWarning(ruleName: string): void { + if (!EMIT_LEGACY_RULE_API_WARNING[`warned-${ruleName}`]) { + EMIT_LEGACY_RULE_API_WARNING[`warned-${ruleName}`] = true; + process.emitWarning( + `"${ruleName}" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules`, + 'DeprecationWarning', + ); + } +} + +const EMIT_MISSING_SCHEMA_WARNING: Record = {}; +/** + * Emit a deprecation warning if rule has options but is missing the "meta.schema" property + */ +export function emitMissingSchemaWarning(ruleName: string): void { + if (!EMIT_MISSING_SCHEMA_WARNING[`warned-${ruleName}`]) { + EMIT_MISSING_SCHEMA_WARNING[`warned-${ruleName}`] = true; + process.emitWarning( + `"${ruleName}" rule has options but is missing the "meta.schema" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas`, + 'DeprecationWarning', + ); + } +} + +export const REQUIRED_SCENARIOS = ['valid', 'invalid'] as const; diff --git a/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts b/packages/rule-tester/tests/RuleTester.test.ts similarity index 53% rename from packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts rename to packages/rule-tester/tests/RuleTester.test.ts index 57ac48b38c1..25b6aa0888e 100644 --- a/packages/utils/tests/eslint-utils/rule-tester/RuleTester.test.ts +++ b/packages/rule-tester/tests/RuleTester.test.ts @@ -1,16 +1,17 @@ import * as parser from '@typescript-eslint/parser'; -import eslintPackageJson from 'eslint/package.json'; +import { AST_NODE_TYPES } from '@typescript-eslint/typescript-estree'; +import type { TSESTree } from '@typescript-eslint/utils'; +import type { RuleModule } from '@typescript-eslint/utils/ts-eslint'; -import * as dependencyConstraintsModule from '../../../src/eslint-utils/rule-tester/dependencyConstraints'; -import { RuleTester } from '../../../src/eslint-utils/rule-tester/RuleTester'; -import type { RuleModule } from '../../../src/ts-eslint'; -import { RuleTester as BaseRuleTester } from '../../../src/ts-eslint'; +import { RuleTester } from '../src/RuleTester'; +import type { RuleTesterTestFrameworkFunctionBase } from '../src/TestFramework'; +import * as dependencyConstraintsModule from '../src/utils/dependencyConstraints'; // we can't spy on the exports of an ES module - so we instead have to mock the entire module -jest.mock('../../../src/eslint-utils/rule-tester/dependencyConstraints', () => { +jest.mock('../src/utils/dependencyConstraints', () => { const dependencyConstraints = jest.requireActual< typeof dependencyConstraintsModule - >('../../../src/eslint-utils/rule-tester/dependencyConstraints'); + >('../src/utils/dependencyConstraints'); return { ...dependencyConstraints, @@ -45,41 +46,74 @@ jest.mock( }, ); -// mock the eslint package.json so that we can manipulate the version in the test -jest.mock('eslint/package.json', () => { - return { - // make the version a getter so we can spy on it and change the return value - get version(): string { - // fix the version so the test is stable on older ESLint versions - return '8.0.0'; - }, - }; -}); - jest.mock('@typescript-eslint/parser', () => { + const actualParser = jest.requireActual( + '@typescript-eslint/parser', + ); return { + ...actualParser, __esModule: true, clearCaches: jest.fn(), }; }); /* eslint-disable jest/prefer-spy-on -- - need to specifically assign to the properties or else it will use the - global value */ -RuleTester.afterAll = jest.fn(); -RuleTester.describe = jest.fn(); -RuleTester.it = jest.fn(); -RuleTester.itOnly = jest.fn(); + we need to specifically assign to the properties or else it will use the + global value and register actual tests! */ +const IMMEDIATE_CALLBACK: RuleTesterTestFrameworkFunctionBase = (_, cb) => cb(); +RuleTester.afterAll = + jest.fn(/* intentionally don't immediate callback here */); +RuleTester.describe = jest.fn(IMMEDIATE_CALLBACK); +RuleTester.describeSkip = jest.fn(IMMEDIATE_CALLBACK); +RuleTester.it = jest.fn(IMMEDIATE_CALLBACK); +RuleTester.itOnly = jest.fn(IMMEDIATE_CALLBACK); +RuleTester.itSkip = jest.fn(IMMEDIATE_CALLBACK); /* eslint-enable jest/prefer-spy-on */ const mockedAfterAll = jest.mocked(RuleTester.afterAll); const mockedDescribe = jest.mocked(RuleTester.describe); +const mockedDescribeSkip = jest.mocked(RuleTester.describeSkip); const mockedIt = jest.mocked(RuleTester.it); const _mockedItOnly = jest.mocked(RuleTester.itOnly); -const runSpy = jest.spyOn(BaseRuleTester.prototype, 'run'); +const _mockedItSkip = jest.mocked(RuleTester.itSkip); +const runRuleForItemSpy = jest.spyOn( + RuleTester.prototype, + // @ts-expect-error -- method is private + 'runRuleForItem', +) as jest.SpiedFunction; const mockedParserClearCaches = jest.mocked(parser.clearCaches); -const eslintVersionSpy = jest.spyOn(eslintPackageJson, 'version', 'get'); +const EMPTY_PROGRAM: TSESTree.Program = { + type: AST_NODE_TYPES.Program, + body: [], + comments: [], + loc: { end: { column: 0, line: 0 }, start: { column: 0, line: 0 } }, + sourceType: 'module', + tokens: [], + range: [0, 0], +}; +runRuleForItemSpy.mockImplementation((_1, _2, testCase) => { + return { + messages: + 'errors' in testCase + ? [ + { + column: 0, + line: 0, + message: 'error', + messageId: 'error', + nodeType: AST_NODE_TYPES.Program, + ruleId: 'my-rule', + severity: 2, + source: null, + }, + ] + : [], + output: testCase.code, + afterAST: EMPTY_PROGRAM, + beforeAST: EMPTY_PROGRAM, + }; +}); beforeEach(() => { jest.clearAllMocks(); @@ -91,7 +125,7 @@ const NOOP_RULE: RuleModule<'error', []> = { error: 'error', }, type: 'problem', - schema: {}, + schema: [], }, defaultOptions: [], create() { @@ -99,60 +133,58 @@ const NOOP_RULE: RuleModule<'error', []> = { }, }; -describe('RuleTester', () => { - it('automatically sets the filename for tests', () => { - const ruleTester = new RuleTester({ - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - tsconfigRootDir: '/some/path/that/totally/exists/', - }, - }); +function getTestConfigFromCall(): unknown[] { + return runRuleForItemSpy.mock.calls.map(c => c[2]); +} - ruleTester.run('my-rule', NOOP_RULE, { - invalid: [ - { - code: 'invalid tests should work as well', - errors: [], - }, - ], - valid: [ - 'string based valid test', - { - code: 'object based valid test', - }, - { - code: "explicit filename shouldn't be overwritten", - filename: '/set/in/the/test.ts', +describe('RuleTester', () => { + describe('filenames', () => { + it('automatically sets the filename for tests', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: '/some/path/that/totally/exists/', }, - { - code: 'jsx should have the correct filename', - parserOptions: { - ecmaFeatures: { - jsx: true, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + 'string based valid test', + { + code: 'object based valid test', + }, + { + code: "explicit filename shouldn't be overwritten", + filename: '/set/in/the/test.ts', + }, + { + code: 'jsx should have the correct filename', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, }, }, - }, - { - code: 'type-aware parser options should override the constructor config', - parserOptions: { - project: 'tsconfig.test-specific.json', - tsconfigRootDir: '/set/in/the/test/', + { + code: 'type-aware parser options should override the constructor config', + parserOptions: { + EXPERIMENTAL_useProjectService: false, + project: 'tsconfig.test-specific.json', + tsconfigRootDir: '/set/in/the/test/', + }, }, - }, - ], - }); - - expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` - { - "invalid": [ + ], + invalid: [ { - "code": "invalid tests should work as well", - "errors": [], - "filename": "/some/path/that/totally/exists/file.ts", + code: 'invalid tests should work as well', + errors: [{ messageId: 'error' }], }, ], - "valid": [ + }); + + expect(getTestConfigFromCall()).toMatchInlineSnapshot(` + [ { "code": "string based valid test", "filename": "/some/path/that/totally/exists/file.ts", @@ -167,7 +199,7 @@ describe('RuleTester', () => { }, { "code": "jsx should have the correct filename", - "filename": "/some/path/that/totally/exists/file.tsx", + "filename": "/some/path/that/totally/exists/react.tsx", "parserOptions": { "ecmaFeatures": { "jsx": true, @@ -178,13 +210,72 @@ describe('RuleTester', () => { "code": "type-aware parser options should override the constructor config", "filename": "/set/in/the/test/file.ts", "parserOptions": { + "EXPERIMENTAL_useProjectService": false, "project": "tsconfig.test-specific.json", "tsconfigRootDir": "/set/in/the/test/", }, }, + { + "code": "invalid tests should work as well", + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "/some/path/that/totally/exists/file.ts", + }, + ] + `); + }); + + it('allows the automated filenames to be overridden in the constructor', () => { + const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + project: 'tsconfig.json', + tsconfigRootDir: '/some/path/that/totally/exists/', + }, + defaultFilenames: { + ts: 'set-in-constructor.ts', + tsx: 'react-set-in-constructor.tsx', + }, + }); + + ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + { + code: 'normal', + }, + { + code: 'jsx', + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + }, ], - } - `); + invalid: [], + }); + + expect(getTestConfigFromCall()).toMatchInlineSnapshot(` + [ + { + "code": "normal", + "filename": "/some/path/that/totally/exists/set-in-constructor.ts", + }, + { + "code": "jsx", + "filename": "/some/path/that/totally/exists/react-set-in-constructor.tsx", + "parserOptions": { + "ecmaFeatures": { + "jsx": true, + }, + }, + }, + ] + `); + }); }); it('schedules the parser caches to be cleared afterAll', () => { @@ -228,7 +319,7 @@ describe('RuleTester', () => { invalid: [], }), ).toThrowErrorMatchingInlineSnapshot( - `"Do not set the parser at the test level unless you want to use a parser other than @typescript-eslint/parser"`, + `"Do not set the parser at the test level unless you want to use a parser other than "@typescript-eslint/parser""`, ); }); @@ -298,7 +389,7 @@ describe('RuleTester', () => { invalid: [ { code: 'const x = 3;', - errors: [], + errors: [{ messageId: 'error' }], // eslint-disable-next-line eslint-plugin/no-only-tests -- intentional only for test purposes only: true, }, @@ -315,85 +406,117 @@ describe('RuleTester', () => { }); ruleTester.run('my-rule', NOOP_RULE, { - invalid: [ + valid: [ { - code: 'failing - major', - errors: [], + code: 'passing - major', dependencyConstraints: { - 'totally-real-dependency': '999', + 'totally-real-dependency': '10', }, }, { - code: 'failing - major.minor', - errors: [], + code: 'passing - major.minor', dependencyConstraints: { - 'totally-real-dependency': '999.0', + 'totally-real-dependency': '10.0', }, }, { - code: 'failing - major.minor.patch', - errors: [], + code: 'passing - major.minor.patch', dependencyConstraints: { - 'totally-real-dependency': '999.0.0', + 'totally-real-dependency': '10.0.0', }, }, ], - valid: [ + invalid: [ { - code: 'passing - major', + code: 'failing - major', + errors: [{ messageId: 'error' }], dependencyConstraints: { - 'totally-real-dependency': '10', + 'totally-real-dependency': '999', }, }, { - code: 'passing - major.minor', + code: 'failing - major.minor', + errors: [{ messageId: 'error' }], dependencyConstraints: { - 'totally-real-dependency': '10.0', + 'totally-real-dependency': '999.0', }, }, { - code: 'passing - major.minor.patch', + code: 'failing - major.minor.patch', + errors: [{ messageId: 'error' }], dependencyConstraints: { - 'totally-real-dependency': '10.0.0', + 'totally-real-dependency': '999.0.0', }, }, ], }); - expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` - { - "invalid": [ - { - "code": "failing - major", - "errors": [], - "filename": "file.ts", + expect(getTestConfigFromCall()).toMatchInlineSnapshot(` + [ + { + "code": "passing - major", + "dependencyConstraints": { + "totally-real-dependency": "10", }, - { - "code": "failing - major.minor", - "errors": [], - "filename": "file.ts", + "filename": "file.ts", + "skip": false, + }, + { + "code": "passing - major.minor", + "dependencyConstraints": { + "totally-real-dependency": "10.0", }, - { - "code": "failing - major.minor.patch", - "errors": [], - "filename": "file.ts", + "filename": "file.ts", + "skip": false, + }, + { + "code": "passing - major.minor.patch", + "dependencyConstraints": { + "totally-real-dependency": "10.0.0", }, - ], - "valid": [ - { - "code": "passing - major", - "filename": "file.ts", + "filename": "file.ts", + "skip": false, + }, + { + "code": "failing - major", + "dependencyConstraints": { + "totally-real-dependency": "999", }, - { - "code": "passing - major.minor", - "filename": "file.ts", + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + { + "code": "failing - major.minor", + "dependencyConstraints": { + "totally-real-dependency": "999.0", }, - { - "code": "passing - major.minor.patch", - "filename": "file.ts", + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + { + "code": "failing - major.minor.patch", + "dependencyConstraints": { + "totally-real-dependency": "999.0.0", }, - ], - } + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + ] `); }); @@ -403,10 +526,28 @@ describe('RuleTester', () => { }); ruleTester.run('my-rule', NOOP_RULE, { + valid: [ + { + code: 'passing - major', + dependencyConstraints: { + 'totally-real-dependency': { + range: '^10', + }, + }, + }, + { + code: 'passing - major.minor', + dependencyConstraints: { + 'totally-real-dependency': { + range: '<999', + }, + }, + }, + ], invalid: [ { code: 'failing - major', - errors: [], + errors: [{ messageId: 'error' }], dependencyConstraints: { 'totally-real-dependency': { range: '^999', @@ -415,7 +556,7 @@ describe('RuleTester', () => { }, { code: 'failing - major.minor', - errors: [], + errors: [{ messageId: 'error' }], dependencyConstraints: { 'totally-real-dependency': { range: '>=999.0', @@ -425,7 +566,7 @@ describe('RuleTester', () => { { code: 'failing with options', - errors: [], + errors: [{ messageId: 'error' }], dependencyConstraints: { 'totally-real-dependency-prerelease': { range: '^10', @@ -436,56 +577,79 @@ describe('RuleTester', () => { }, }, ], - valid: [ + }); + + expect(getTestConfigFromCall()).toMatchInlineSnapshot(` + [ { - code: 'passing - major', - dependencyConstraints: { - 'totally-real-dependency': { - range: '^10', + "code": "passing - major", + "dependencyConstraints": { + "totally-real-dependency": { + "range": "^10", }, }, + "filename": "file.ts", + "skip": false, }, { - code: 'passing - major.minor', - dependencyConstraints: { - 'totally-real-dependency': { - range: '<999', + "code": "passing - major.minor", + "dependencyConstraints": { + "totally-real-dependency": { + "range": "<999", }, }, + "filename": "file.ts", + "skip": false, }, - ], - }); - - expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` - { - "invalid": [ - { - "code": "failing - major", - "errors": [], - "filename": "file.ts", - }, - { - "code": "failing - major.minor", - "errors": [], - "filename": "file.ts", - }, - { - "code": "failing with options", - "errors": [], - "filename": "file.ts", + { + "code": "failing - major", + "dependencyConstraints": { + "totally-real-dependency": { + "range": "^999", + }, }, - ], - "valid": [ - { - "code": "passing - major", - "filename": "file.ts", + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + { + "code": "failing - major.minor", + "dependencyConstraints": { + "totally-real-dependency": { + "range": ">=999.0", + }, }, - { - "code": "passing - major.minor", - "filename": "file.ts", + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + { + "code": "failing with options", + "dependencyConstraints": { + "totally-real-dependency-prerelease": { + "options": { + "includePrerelease": false, + }, + "range": "^10", + }, }, - ], - } + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + ] `); }); @@ -495,155 +659,103 @@ describe('RuleTester', () => { }); ruleTester.run('my-rule', NOOP_RULE, { - invalid: [ + valid: [ + 'string based is always run', { code: 'no constraints is always run', - errors: [], }, { code: 'empty object is always run', - errors: [], dependencyConstraints: {}, }, { - code: 'failing constraint', - errors: [], + code: 'passing constraint', dependencyConstraints: { - 'totally-real-dependency': '99999', + 'totally-real-dependency': '10', }, }, ], - valid: [ - 'string based is always run', + invalid: [ { code: 'no constraints is always run', + errors: [{ messageId: 'error' }], }, { code: 'empty object is always run', + errors: [{ messageId: 'error' }], dependencyConstraints: {}, }, { - code: 'passing constraint', + code: 'failing constraint', + errors: [{ messageId: 'error' }], dependencyConstraints: { - 'totally-real-dependency': '10', + 'totally-real-dependency': '99999', }, }, ], }); - expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` - { - "invalid": [ - { - "code": "no constraints is always run", - "errors": [], - "filename": "file.ts", - }, - { - "code": "empty object is always run", - "errors": [], - "filename": "file.ts", - }, - { - "code": "failing constraint", - "errors": [], - "filename": "file.ts", - }, - ], - "valid": [ - { - "code": "string based is always run", - "filename": "file.ts", - }, - { - "code": "no constraints is always run", - "filename": "file.ts", - }, - { - "code": "empty object is always run", - "filename": "file.ts", - }, - { - "code": "passing constraint", - "filename": "file.ts", - }, - ], - } - `); - }); - - it('uses filter instead of "only" for old ESLint versions', () => { - // need it twice because ESLint internally fetches this value once :( - eslintVersionSpy.mockReturnValueOnce('1.0.0'); - eslintVersionSpy.mockReturnValueOnce('1.0.0'); - - const ruleTester = new RuleTester({ - parser: '@typescript-eslint/parser', - }); - - ruleTester.run('my-rule', NOOP_RULE, { - invalid: [ + expect(getTestConfigFromCall()).toMatchInlineSnapshot(` + [ { - code: 'failing', - errors: [], - dependencyConstraints: { - 'totally-real-dependency': '999', - }, + "code": "string based is always run", + "filename": "file.ts", + "skip": false, }, { - code: 'passing', - errors: [], - dependencyConstraints: { - 'totally-real-dependency': '10', - }, + "code": "no constraints is always run", + "filename": "file.ts", + "skip": false, }, - ], - valid: [ - 'always passing string test', { - code: 'failing', - dependencyConstraints: { - 'totally-real-dependency': '999', - }, + "code": "empty object is always run", + "dependencyConstraints": {}, + "filename": "file.ts", + "skip": false, }, { - code: 'passing', - dependencyConstraints: { - 'totally-real-dependency': '10', + "code": "passing constraint", + "dependencyConstraints": { + "totally-real-dependency": "10", }, + "filename": "file.ts", + "skip": false, }, - ], - }); - - expect(runSpy.mock.lastCall?.[2]).toMatchInlineSnapshot(` - { - "invalid": [ - { - "code": "failing", - "errors": [], - "filename": "file.ts", - }, - { - "code": "passing", - "errors": [], - "filename": "file.ts", - }, - ], - "valid": [ - { - "code": "always passing string test", - "filename": "file.ts", - }, - { - "code": "failing", - "filename": "file.ts", - }, - { - "code": "passing", - "filename": "file.ts", + { + "code": "no constraints is always run", + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": false, + }, + { + "code": "empty object is always run", + "dependencyConstraints": {}, + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": false, + }, + { + "code": "failing constraint", + "dependencyConstraints": { + "totally-real-dependency": "99999", }, - ], - } + "errors": [ + { + "messageId": "error", + }, + ], + "filename": "file.ts", + "skip": true, + }, + ] `); }); @@ -657,30 +769,21 @@ describe('RuleTester', () => { }); ruleTester.run('my-rule', NOOP_RULE, { - invalid: [ + valid: [ { - code: 'failing - major', - errors: [], + code: 'passing - major', }, ], - valid: [ + invalid: [ { - code: 'passing - major', + code: 'failing - major', + errors: [{ messageId: 'error' }], }, ], }); // trigger the describe block - expect(mockedDescribe.mock.calls.length).toBeGreaterThanOrEqual(1); - mockedDescribe.mock.lastCall?.[1](); - expect(mockedDescribe.mock.calls).toMatchInlineSnapshot(` - [ - [ - "my-rule", - [Function], - ], - ] - `); + expect(mockedDescribeSkip.mock.calls).toHaveLength(1); expect(mockedIt.mock.lastCall).toMatchInlineSnapshot(` [ "All tests skipped due to unsatisfied constructor dependency constraints", @@ -698,38 +801,22 @@ describe('RuleTester', () => { }); ruleTester.run('my-rule', NOOP_RULE, { - invalid: [ + valid: [ { code: 'valid', - errors: [], }, ], - valid: [ + invalid: [ { - code: 'valid', + code: 'invalid', + errors: [{ messageId: 'error' }], }, ], }); // trigger the describe block - expect(mockedDescribe.mock.calls.length).toBeGreaterThanOrEqual(1); - mockedDescribe.mock.lastCall?.[1](); - expect(mockedDescribe.mock.calls).toMatchInlineSnapshot(` - [ - [ - "my-rule", - [Function], - ], - [ - "valid", - [Function], - ], - [ - "invalid", - [Function], - ], - ] - `); + expect(mockedDescribe.mock.calls).toHaveLength(3); + expect(mockedDescribeSkip.mock.calls).toHaveLength(0); // expect(mockedIt.mock.lastCall).toMatchInlineSnapshot(`undefined`); }); }); diff --git a/packages/rule-tester/tests/eslint-base/eslint-base.test.js b/packages/rule-tester/tests/eslint-base/eslint-base.test.js new file mode 100644 index 00000000000..03d5f1d8f8c --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/eslint-base.test.js @@ -0,0 +1,2882 @@ +/** + * This file intentionally does not match the standards in the rest of our codebase. + * It's intended to exactly match the test in ESLint core so we can ensure we + * have compatibility. + * It's tempting to switch this to be strictly typed in TS and to use jest - but + * it's too easy to introduce subtle changes into the test by doing that. It also + * makes it much harder to merge upstream changes into this test. + * + * The only edits we have made are to update the paths for our rep + * + * Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/lib/rule-tester/rule-tester.js + * + * @noformat + */ +/* eslint-disable */ + +"use strict"; + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ +const sinon = require("sinon"), + EventEmitter = require("events"), + { RuleTester } = require("../../dist/RuleTester"), + assert = require("chai").assert, + nodeAssert = require("assert"), + espree = require("espree"); + +const NODE_ASSERT_STRICT_EQUAL_OPERATOR = (() => { + try { + nodeAssert.strictEqual(1, 2); + } catch (err) { + return err.operator; + } + throw new Error("unexpected successful assertion"); +})(); + +/** + * Do nothing. + * @returns {void} + */ +function noop() { + + // do nothing. +} + +//------------------------------------------------------------------------------ +// Rewire Things +//------------------------------------------------------------------------------ + +/* + * So here's the situation. Because RuleTester uses it() and describe() from + * Mocha, any failures would show up in the output of this test file. That means + * when we tested that a failure is thrown, that would also count as a failure + * in the testing for RuleTester. In order to remove those results from the + * results of this file, we need to overwrite it() and describe() just in + * RuleTester to do nothing but run code. Effectively, it() and describe() + * just become regular functions inside of index.js, not at all related to Mocha. + * That allows the results of this file to be untainted and therefore accurate. + * + * To assert that the right arguments are passed to RuleTester.describe/it, an + * event emitter is used which emits the arguments. + */ + +const ruleTesterTestEmitter = new EventEmitter(); + +//------------------------------------------------------------------------------ +// Tests +//------------------------------------------------------------------------------ + +describe("RuleTester", () => { + + // Stub `describe()` and `it()` while this test suite. + before(() => { + RuleTester.describe = function(text, method) { + ruleTesterTestEmitter.emit("describe", text, method); + return method.call(this); + }; + RuleTester.it = function(text, method) { + ruleTesterTestEmitter.emit("it", text, method); + return method.call(this); + }; + }); + after(() => { + RuleTester.describe = null; + RuleTester.it = null; + }); + + let ruleTester; + + /** + * A helper function to verify Node.js core error messages. + * @param {string} actual The actual input + * @param {string} expected The expected input + * @returns {Function} Error callback to verify that the message is correct + * for the actual and expected input. + */ + function assertErrorMatches(actual, expected) { + const err = new nodeAssert.AssertionError({ + actual, + expected, + operator: NODE_ASSERT_STRICT_EQUAL_OPERATOR + }); + + return err.message; + } + + beforeEach(() => { + RuleTester.resetDefaultConfig(); + ruleTester = new RuleTester(); + }); + + describe("only", () => { + describe("`itOnly` accessor", () => { + describe("when `itOnly` is set", () => { + before(() => { + RuleTester.itOnly = sinon.spy(); + }); + after(() => { + RuleTester.itOnly = void 0; + }); + beforeEach(() => { + RuleTester.itOnly.resetHistory(); + ruleTester = new RuleTester(); + }); + + it("is called by exclusive tests", () => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [{ + code: "const notVar = 42;", + only: true + }], + invalid: [] + }); + + sinon.assert.calledWith(RuleTester.itOnly, "const notVar = 42;"); + }); + }); + + describe("when `it` is set and has an `only()` method", () => { + before(() => { + RuleTester.it.only = () => {}; + sinon.spy(RuleTester.it, "only"); + }); + after(() => { + RuleTester.it.only = void 0; + }); + beforeEach(() => { + RuleTester.it.only.resetHistory(); + ruleTester = new RuleTester(); + }); + + it("is called by tests with `only` set", () => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [{ + code: "const notVar = 42;", + only: true + }], + invalid: [] + }); + + sinon.assert.calledWith(RuleTester.it.only, "const notVar = 42;"); + }); + }); + + describe("when global `it` is a function that has an `only()` method", () => { + let originalGlobalItOnly; + + before(() => { + + /* + * We run tests with `--forbid-only`, so we have to override + * `it.only` to prevent the real one from being called. + */ + originalGlobalItOnly = it.only; + it.only = () => {}; + sinon.spy(it, "only"); + }); + after(() => { + it.only = originalGlobalItOnly; + }); + beforeEach(() => { + it.only.resetHistory(); + ruleTester = new RuleTester(); + }); + + it("is called by tests with `only` set", () => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [{ + code: "const notVar = 42;", + only: true + }], + invalid: [] + }); + + sinon.assert.calledWith(it.only, "const notVar = 42;"); + }); + }); + + describe("when `describe` and `it` are overridden without `itOnly`", () => { + let originalGlobalItOnly; + + before(() => { + + /* + * These tests override `describe` and `it` already, so we + * don't need to override them here. We do, however, need to + * remove `only` from the global `it` to prevent it from + * being used instead. + */ + originalGlobalItOnly = it.only; + it.only = void 0; + }); + after(() => { + it.only = originalGlobalItOnly; + }); + beforeEach(() => { + ruleTester = new RuleTester(); + }); + + it("throws an error recommending overriding `itOnly`", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [{ + code: "const notVar = 42;", + only: true + }], + invalid: [] + }); + }, "Set `RuleTester.itOnly` to use `only` with a custom test framework."); + }); + }); + + describe("when global `it` is a function that does not have an `only()` method", () => { + let originalGlobalIt; + let originalRuleTesterDescribe; + let originalRuleTesterIt; + + before(() => { + originalGlobalIt = global.it; + + // eslint-disable-next-line no-global-assign -- Temporarily override Mocha global + it = () => {}; + + /* + * These tests override `describe` and `it`, so we need to + * un-override them here so they won't interfere. + */ + originalRuleTesterDescribe = RuleTester.describe; + RuleTester.describe = void 0; + originalRuleTesterIt = RuleTester.it; + RuleTester.it = void 0; + }); + after(() => { + + // eslint-disable-next-line no-global-assign -- Restore Mocha global + it = originalGlobalIt; + RuleTester.describe = originalRuleTesterDescribe; + RuleTester.it = originalRuleTesterIt; + }); + beforeEach(() => { + ruleTester = new RuleTester(); + }); + + it("throws an error explaining that the current test framework does not support `only`", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [{ + code: "const notVar = 42;", + only: true + }], + invalid: [] + }); + }, "The current test framework does not support exclusive tests with `only`."); + }); + }); + }); + + describe("test cases", () => { + const ruleName = "no-var"; + const rule = require("./fixtures/no-var"); + + let originalRuleTesterIt; + let spyRuleTesterIt; + let originalRuleTesterItOnly; + let spyRuleTesterItOnly; + + before(() => { + originalRuleTesterIt = RuleTester.it; + spyRuleTesterIt = sinon.spy(); + RuleTester.it = spyRuleTesterIt; + originalRuleTesterItOnly = RuleTester.itOnly; + spyRuleTesterItOnly = sinon.spy(); + RuleTester.itOnly = spyRuleTesterItOnly; + }); + after(() => { + RuleTester.it = originalRuleTesterIt; + RuleTester.itOnly = originalRuleTesterItOnly; + }); + beforeEach(() => { + spyRuleTesterIt.resetHistory(); + spyRuleTesterItOnly.resetHistory(); + ruleTester = new RuleTester(); + }); + + it("isn't called for normal tests", () => { + ruleTester.run(ruleName, rule, { + valid: ["const notVar = 42;"], + invalid: [] + }); + sinon.assert.calledWith(spyRuleTesterIt, "const notVar = 42;"); + sinon.assert.notCalled(spyRuleTesterItOnly); + }); + + it("calls it or itOnly for every test case", () => { + + /* + * `RuleTester` doesn't implement test case exclusivity itself. + * Setting `only: true` just causes `RuleTester` to call + * whatever `only()` function is provided by the test framework + * instead of the regular `it()` function. + */ + + ruleTester.run(ruleName, rule, { + valid: [ + "const valid = 42;", + { + code: "const onlyValid = 42;", + only: true + } + ], + invalid: [ + { + code: "var invalid = 42;", + errors: [/^Bad var/u] + }, + { + code: "var onlyInvalid = 42;", + errors: [/^Bad var/u], + only: true + } + ] + }); + + sinon.assert.calledWith(spyRuleTesterIt, "const valid = 42;"); + sinon.assert.calledWith(spyRuleTesterItOnly, "const onlyValid = 42;"); + sinon.assert.calledWith(spyRuleTesterIt, "var invalid = 42;"); + sinon.assert.calledWith(spyRuleTesterItOnly, "var onlyInvalid = 42;"); + }); + }); + + describe("static helper wrapper", () => { + it("adds `only` to string test cases", () => { + const test = RuleTester.only("const valid = 42;"); + + assert.deepStrictEqual(test, { + code: "const valid = 42;", + only: true + }); + }); + + it("adds `only` to object test cases", () => { + const test = RuleTester.only({ code: "const valid = 42;" }); + + assert.deepStrictEqual(test, { + code: "const valid = 42;", + only: true + }); + }); + }); + }); + + it("should not throw an error when everything passes", () => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } + ] + }); + }); + + it("should throw an error when valid code is invalid", () => { + + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "eval(foo)" + ], + invalid: [ + { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } + ] + }); + }, /Should have no errors but had 1/u); + }); + + it("should throw an error when valid code is invalid", () => { + + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + { code: "eval(foo)" } + ], + invalid: [ + { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } + ] + }); + }, /Should have no errors but had 1/u); + }); + + it("should throw an error if invalid code is valid", () => { + + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "Eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } + ] + }); + }, /Should have 1 error but had 0/u); + }); + + it("should throw an error when the error message is wrong", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + + // Only the invalid test matters here + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", errors: [{ message: "Bad error message." }] } + ] + }); + }, assertErrorMatches("Bad var.", "Bad error message.")); + }); + + it("should throw an error when the error message regex does not match", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { code: "var foo = bar;", errors: [{ message: /Bad error message/u }] } + ] + }); + }, /Expected 'Bad var.' to match \/Bad error message\//u); + }); + + it("should throw an error when the error is not a supported type", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + + // Only the invalid test matters here + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", errors: [42] } + ] + }); + }, /Error should be a string, object, or RegExp/u); + }); + + it("should throw an error when any of the errors is not a supported type", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + + // Only the invalid test matters here + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar; var baz = quux", errors: [{ type: "VariableDeclaration" }, null] } + ] + }); + }, /Error should be a string, object, or RegExp/u); + }); + + it("should throw an error when the error is a string and it does not match error message", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + + // Only the invalid test matters here + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", errors: ["Bad error message."] } + ] + }); + }, assertErrorMatches("Bad var.", "Bad error message.")); + }); + + it("should throw an error when the error is a string and it does not match error message", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + + valid: [ + ], + invalid: [ + { code: "var foo = bar;", errors: [/Bad error message/u] } + ] + }); + }, /Expected 'Bad var.' to match \/Bad error message\//u); + }); + + it("should not throw an error when the error is a string and it matches error message", () => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + + // Only the invalid test matters here + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", output: " foo = bar;", errors: ["Bad var."] } + ] + }); + }); + + it("should not throw an error when the error is a regex and it matches error message", () => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { code: "var foo = bar;", output: " foo = bar;", errors: [/^Bad var/u] } + ] + }); + }); + + it("should throw an error when the error is an object with an unknown property name", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", errors: [{ Message: "Bad var." }] } + ] + }); + }, /Invalid error property name 'Message'/u); + }); + + it("should throw an error when any of the errors is an object with an unknown property name", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { + code: "var foo = bar; var baz = quux", + errors: [ + { message: "Bad var.", type: "VariableDeclaration" }, + { message: "Bad var.", typo: "VariableDeclaration" } + ] + } + ] + }); + }, /Invalid error property name 'typo'/u); + }); + + it("should not throw an error when the error is a regex in an object and it matches error message", () => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { code: "var foo = bar;", output: " foo = bar;", errors: [{ message: /^Bad var/u }] } + ] + }); + }); + + it("should throw an error when the expected output doesn't match", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration" }] } + ] + }); + }, /Output is incorrect/u); + }); + + it("should use strict equality to compare output", () => { + const replaceProgramWith5Rule = { + meta: { + fixable: "code" + }, + + create: context => ({ + Program(node) { + context.report({ node, message: "bad", fix: fixer => fixer.replaceText(node, "5") }); + } + }) + }; + + // Should not throw. + ruleTester.run("foo", replaceProgramWith5Rule, { + valid: [], + invalid: [ + { code: "var foo = bar;", output: "5", errors: 1 } + ] + }); + + assert.throws(() => { + ruleTester.run("foo", replaceProgramWith5Rule, { + valid: [], + invalid: [ + { code: "var foo = bar;", output: 5, errors: 1 } + ] + }); + }, /Output is incorrect/u); + }); + + it("should throw an error when the expected output doesn't match and errors is just a number", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", output: "foo = bar", errors: 1 } + ] + }); + }, /Output is incorrect/u); + }); + + it("should not throw an error when the expected output is null and no errors produce output", () => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "eval(x)", errors: 1, output: null }, + { code: "eval(x); eval(y);", errors: 2, output: null } + ] + }); + }); + + it("should throw an error when the expected output is null and problems produce output", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", output: null, errors: 1 } + ] + }); + }, /Expected no autofixes to be suggested/u); + + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { + code: "var foo = bar; var qux = boop;", + output: null, + errors: 2 + } + ] + }); + }, /Expected no autofixes to be suggested/u); + }); + + it("should throw an error when the expected output is null and only some problems produce output", () => { + assert.throws(() => { + ruleTester.run("fixes-one-problem", require("./fixtures/fixes-one-problem"), { + valid: [], + invalid: [ + { code: "foo", output: null, errors: 2 } + ] + }); + }, /Expected no autofixes to be suggested/u); + }); + + it("should throw an error when the expected output isn't specified and problems produce output", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", errors: 1 } + ] + }); + }, "The rule fixed the code. Please add 'output' property."); + }); + + it("should throw an error if invalid code specifies wrong type", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression2" }] } + ] + }); + }, /Error type should be CallExpression2, found CallExpression/u); + }); + + it("should throw an error if invalid code specifies wrong line", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression", line: 5 }] } + ] + }); + }, /Error line should be 5/u); + }); + + it("should not skip line assertion if line is a falsy value", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "\neval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression", line: 0 }] } + ] + }); + }, /Error line should be 0/u); + }); + + it("should throw an error if invalid code specifies wrong column", () => { + const wrongColumn = 10, + expectedErrorMessage = "Error column should be 1"; + + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: ["Eval(foo)"], + invalid: [{ + code: "eval(foo)", + errors: [{ + message: "eval sucks.", + column: wrongColumn + }] + }] + }); + }, expectedErrorMessage); + }); + + it("should throw error for empty error array", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [] + }] + }); + }, /Invalid cases must have at least one error/u); + }); + + it("should throw error for errors : 0", () => { + assert.throws(() => { + ruleTester.run( + "suggestions-messageIds", + require("./fixtures/suggestions") + .withMessageIds, + { + valid: [], + invalid: [ + { + code: "var foo;", + errors: 0 + } + ] + } + ); + }, /Invalid cases must have 'error' value greater than 0/u); + }); + + it("should not skip column assertion if column is a falsy value", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: ["Eval(foo)"], + invalid: [{ + code: "var foo; eval(foo)", + errors: [{ message: "eval sucks.", column: 0 }] + }] + }); + }, /Error column should be 0/u); + }); + + it("should throw an error if invalid code specifies wrong endLine", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration", endLine: 10 }] } + ] + }); + }, "Error endLine should be 10"); + }); + + it("should throw an error if invalid code specifies wrong endColumn", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [ + "bar = baz;" + ], + invalid: [ + { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration", endColumn: 10 }] } + ] + }); + }, "Error endColumn should be 10"); + }); + + it("should throw an error if invalid code has the wrong number of errors", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { + code: "eval(foo)", + errors: [ + { message: "eval sucks.", type: "CallExpression" }, + { message: "eval sucks.", type: "CallExpression" } + ] + } + ] + }); + }, /Should have 2 errors but had 1/u); + }); + + it("should throw an error if invalid code does not have errors", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "eval(foo)" } + ] + }); + }, /Did not specify errors for an invalid test of no-eval/u); + }); + + it("should throw an error if invalid code has the wrong explicit number of errors", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "Eval(foo)" + ], + invalid: [ + { code: "eval(foo)", errors: 2 } + ] + }); + }, /Should have 2 errors but had 1/u); + }); + + it("should throw an error if there's a parsing error in a valid test", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "1eval('foo')" + ], + invalid: [ + { code: "eval('foo')", errors: [{}] } + ] + }); + }, /fatal parsing error/iu); + }); + + it("should throw an error if there's a parsing error in an invalid test", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "noeval('foo')" + ], + invalid: [ + { code: "1eval('foo')", errors: [{}] } + ] + }); + }, /fatal parsing error/iu); + }); + + it("should throw an error if there's a parsing error in an invalid test and errors is just a number", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + "noeval('foo')" + ], + invalid: [ + { code: "1eval('foo')", errors: 1 } + ] + }); + }, /fatal parsing error/iu); + }); + + // https://github.com/eslint/eslint/issues/4779 + it("should throw an error if there's a parsing error and output doesn't match", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [], + invalid: [ + { code: "obvious parser error", output: "string that doesnt match", errors: [{}] } + ] + }); + }, /fatal parsing error/iu); + }); + + it("should not throw an error if invalid code has at least an expected empty error object", () => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: ["Eval(foo)"], + invalid: [{ + code: "eval(foo)", + errors: [{}] + }] + }); + }); + + it("should pass-through the globals config of valid tests to the to rule", () => { + ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { + valid: [ + "var test = 'foo'", + { + code: "var test2 = 'bar'", + globals: { test: true } + } + ], + invalid: [{ code: "bar", errors: 1 }] + }); + }); + + it("should pass-through the globals config of invalid tests to the to rule", () => { + ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { + valid: ["var test = 'foo'"], + invalid: [ + { + code: "var test = 'foo'; var foo = 'bar'", + errors: 1 + }, + { + code: "var test = 'foo'", + globals: { foo: true }, + errors: [{ message: "Global variable foo should not be used." }] + } + ] + }); + }); + + it("should pass-through the settings config to rules", () => { + ruleTester.run("no-test-settings", require("./fixtures/no-test-settings"), { + valid: [ + { + code: "var test = 'bar'", settings: { test: 1 } + } + ], + invalid: [ + { + code: "var test = 'bar'", settings: { "no-test": 22 }, errors: 1 + } + ] + }); + }); + + it("should pass-through the filename to the rule", () => { + (function() { + ruleTester.run("", require("./fixtures/no-test-filename"), { + valid: [ + { + code: "var foo = 'bar'", + filename: "somefile.js" + } + ], + invalid: [ + { + code: "var foo = 'bar'", + errors: [ + { message: "Filename test was not defined." } + ] + } + ] + }); + }()); + }); + + it("should pass-through the options to the rule", () => { + ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { + valid: [ + { + code: "var foo = 'bar'", + options: [false] + } + ], + invalid: [ + { + code: "var foo = 'bar'", + options: [true], + errors: [{ message: "Invalid args" }] + } + ] + }); + }); + + it("should throw an error if the options are an object", () => { + assert.throws(() => { + ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { + valid: [ + { + code: "foo", + options: { ok: true } + } + ], + invalid: [] + }); + }, /options must be an array/u); + }); + + it("should throw an error if the options are a number", () => { + assert.throws(() => { + ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { + valid: [ + { + code: "foo", + options: 0 + } + ], + invalid: [] + }); + }, /options must be an array/u); + }); + + it("should pass-through the parser to the rule", () => { + const spy = sinon.spy(ruleTester.linter, "verify"); + + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + { + code: "Eval(foo)" + } + ], + invalid: [ + { + code: "eval(foo)", + parser: require.resolve("esprima"), + errors: [{ line: 1 }] + } + ] + }); + assert.strictEqual(spy.args[1][1].parser, require.resolve("esprima")); + }); + + // skipping because it's not something our parser cares about + it.skip("should pass normalized ecmaVersion to the rule", () => { + const reportEcmaVersionRule = { + meta: { + messages: { + ecmaVersionMessage: "context.parserOptions.ecmaVersion is {{type}} {{ecmaVersion}}." + } + }, + create: context => ({ + Program(node) { + const { ecmaVersion } = context.parserOptions; + + context.report({ + node, + messageId: "ecmaVersionMessage", + data: { type: typeof ecmaVersion, ecmaVersion } + }); + } + }) + }; + + const notEspree = require.resolve("./fixtures/empty-program-parser"); + + ruleTester.run("report-ecma-version", reportEcmaVersionRule, { + valid: [], + invalid: [ + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }] + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + parserOptions: {} + }, + { + code: "
", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + parserOptions: { ecmaFeatures: { jsx: true } } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + parser: require.resolve("espree") + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], + parserOptions: { ecmaVersion: 6 } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], + parserOptions: { ecmaVersion: 2015 } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + env: { browser: true } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + env: { es6: false } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], + env: { es6: true } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "8" } }], + env: { es6: false, es2017: true } + }, + { + code: "let x", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], + env: { es6: "truthy" } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "8" } }], + env: { es2017: true } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "11" } }], + env: { es2020: true } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "12" } }], + env: { es2021: true } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], + parserOptions: { ecmaVersion: "latest" } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], + parser: require.resolve("espree"), + parserOptions: { ecmaVersion: "latest" } + }, + { + code: "
", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], + parserOptions: { ecmaVersion: "latest", ecmaFeatures: { jsx: true } } + }, + { + code: "import 'foo'", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], + parserOptions: { ecmaVersion: "latest", sourceType: "module" } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], + parserOptions: { ecmaVersion: "latest" }, + env: { es6: true } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], + parserOptions: { ecmaVersion: "latest" }, + env: { es2020: true } + }, + + // Non-Espree parsers normalize ecmaVersion if it's not "latest" + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + parser: notEspree + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], + parser: notEspree, + parserOptions: {} + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "5" } }], + parser: notEspree, + parserOptions: { ecmaVersion: 5 } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], + parser: notEspree, + parserOptions: { ecmaVersion: 6 } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: 6 } }], + parser: notEspree, + parserOptions: { ecmaVersion: 2015 } + }, + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "string", ecmaVersion: "latest" } }], + parser: notEspree, + parserOptions: { ecmaVersion: "latest" } + } + ] + }); + + [{ parserOptions: { ecmaVersion: 6 } }, { env: { es6: true } }].forEach(options => { + new RuleTester(options).run("report-ecma-version", reportEcmaVersionRule, { + valid: [], + invalid: [ + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }] + }, + { + code: "", + parserOptions: {}, + errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }] + } + ] + }); + }); + + new RuleTester({ parser: notEspree }).run("report-ecma-version", reportEcmaVersionRule, { + valid: [], + invalid: [ + { + code: "", + errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }] + }, + { + code: "", + parserOptions: { ecmaVersion: "latest" }, + errors: [{ messageId: "ecmaVersionMessage", data: { type: "string", ecmaVersion: "latest" } }] + } + ] + }); + }); + + it("should pass-through services from parseForESLint to the rule", () => { + const enhancedParserPath = require.resolve("./fixtures/enhanced-parser"); + const disallowHiRule = { + create: context => ({ + Literal(node) { + const disallowed = context.parserServices.test.getMessage(); // returns "Hi!" + + if (node.value === disallowed) { + context.report({ node, message: `Don't use '${disallowed}'` }); + } + } + }) + }; + + ruleTester.run("no-hi", disallowHiRule, { + valid: [ + { + code: "'Hello!'", + parser: enhancedParserPath + } + ], + invalid: [ + { + code: "'Hi!'", + parser: enhancedParserPath, + errors: [{ message: "Don't use 'Hi!'" }] + } + ] + }); + }); + + it("should prevent invalid options schemas", () => { + assert.throws(() => { + ruleTester.run("no-invalid-schema", require("./fixtures/no-invalid-schema"), { + valid: [ + "var answer = 6 * 7;", + { code: "var answer = 6 * 7;", options: [] } + ], + invalid: [ + { code: "var answer = 6 * 7;", options: ["bar"], errors: [{ message: "Expected nothing." }] } + ] + }); + }, "Schema for rule no-invalid-schema is invalid:,\titems: should be object\n\titems[0].enum: should NOT have fewer than 1 items\n\titems: should match some schema in anyOf"); + + }); + + it("should prevent schema violations in options", () => { + assert.throws(() => { + ruleTester.run("no-schema-violation", require("./fixtures/no-schema-violation"), { + valid: [ + "var answer = 6 * 7;", + { code: "var answer = 6 * 7;", options: ["foo"] } + ], + invalid: [ + { code: "var answer = 6 * 7;", options: ["bar"], errors: [{ message: "Expected foo." }] } + ] + }); + }, /Value "bar" should be equal to one of the allowed values./u); + + }); + + it("should disallow invalid defaults in rules", () => { + const ruleWithInvalidDefaults = { + meta: { + schema: [ + { + oneOf: [ + { enum: ["foo"] }, + { + type: "object", + properties: { + foo: { + enum: ["foo", "bar"], + default: "foo" + } + }, + additionalProperties: false + } + ] + } + ] + }, + create: () => ({}) + }; + + assert.throws(() => { + ruleTester.run("invalid-defaults", ruleWithInvalidDefaults, { + valid: [ + { + code: "foo", + options: [{}] + } + ], + invalid: [] + }); + }, /Schema for rule invalid-defaults is invalid: default is ignored for: data1\.foo/u); + }); + + it("throw an error when an unknown config option is included", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + { code: "Eval(foo)", foo: "bar" } + ], + invalid: [] + }); + }, /ESLint configuration in rule-tester is invalid./u); + }); + + it("throw an error when an invalid config value is included", () => { + assert.throws(() => { + ruleTester.run("no-eval", require("./fixtures/no-eval"), { + valid: [ + { code: "Eval(foo)", env: ["es6"] } + ], + invalid: [] + }); + }, /Property "env" is the wrong type./u); + }); + + it("should pass-through the tester config to the rule", () => { + ruleTester = new RuleTester({ + globals: { test: true } + }); + + ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { + valid: [ + "var test = 'foo'", + "var test2 = test" + ], + invalid: [{ code: "bar", errors: 1, globals: { foo: true } }] + }); + }); + + it("should correctly set the globals configuration", () => { + const config = { globals: { test: true } }; + + RuleTester.setDefaultConfig(config); + assert( + RuleTester.getDefaultConfig().globals.test, + "The default config object is incorrect" + ); + }); + + it("should correctly reset the global configuration", () => { + const config = { globals: { test: true } }; + + RuleTester.setDefaultConfig(config); + RuleTester.resetDefaultConfig(); + assert.deepStrictEqual( + RuleTester.getDefaultConfig(), + { parser: require.resolve('@typescript-eslint/parser'), rules: {} }, + "The default configuration has not reset correctly" + ); + }); + + it("should enforce the global configuration to be an object", () => { + + /** + * Set the default config for the rules tester + * @param {Object} config configuration object + * @returns {Function} Function to be executed + * @private + */ + function setConfig(config) { + return function() { + RuleTester.setDefaultConfig(config); + }; + } + assert.throw(setConfig()); + assert.throw(setConfig(1)); + assert.throw(setConfig(3.14)); + assert.throw(setConfig("foo")); + assert.throw(setConfig(null)); + assert.throw(setConfig(true)); + }); + + it("should pass-through the globals config to the tester then to the to rule", () => { + const config = { globals: { test: true } }; + + RuleTester.setDefaultConfig(config); + ruleTester = new RuleTester(); + + ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { + valid: [ + "var test = 'foo'", + "var test2 = test" + ], + invalid: [{ code: "bar", errors: 1, globals: { foo: true } }] + }); + }); + + it("should throw an error if AST was modified", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast"), { + valid: [ + "var foo = 0;" + ], + invalid: [] + }); + }, "Rule should not modify AST."); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast"), { + valid: [], + invalid: [ + { code: "var bar = 0;", errors: ["error"] } + ] + }); + }, "Rule should not modify AST."); + }); + + it("should throw an error if AST was modified (at Program)", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-first"), { + valid: [ + "var foo = 0;" + ], + invalid: [] + }); + }, "Rule should not modify AST."); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-first"), { + valid: [], + invalid: [ + { code: "var bar = 0;", errors: ["error"] } + ] + }); + }, "Rule should not modify AST."); + }); + + it("should throw an error if AST was modified (at Program:exit)", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { + valid: [ + "var foo = 0;" + ], + invalid: [] + }); + }, "Rule should not modify AST."); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { + valid: [], + invalid: [ + { code: "var bar = 0;", errors: ["error"] } + ] + }); + }, "Rule should not modify AST."); + }); + + it("should throw an error if rule uses start and end properties on nodes, tokens or comments", () => { + const usesStartEndRule = { + create(context) { + + const sourceCode = context.getSourceCode(); + + return { + CallExpression(node) { + noop(node.arguments[1].start); + }, + "BinaryExpression[operator='+']"(node) { + noop(node.end); + }, + "UnaryExpression[operator='-']"(node) { + noop(sourceCode.getFirstToken(node).start); + }, + ConditionalExpression(node) { + noop(sourceCode.getFirstToken(node).end); + }, + BlockStatement(node) { + noop(sourceCode.getCommentsInside(node)[0].start); + }, + ObjectExpression(node) { + noop(sourceCode.getCommentsInside(node)[0].end); + }, + Decorator(node) { + noop(node.start); + } + }; + } + }; + + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: ["foo(a, b)"], + invalid: [] + }); + }, "Use node.range[0] instead of node.start"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [], + invalid: [{ code: "var a = b * (c + d) / e;", errors: 1 }] + }); + }, "Use node.range[1] instead of node.end"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [], + invalid: [{ code: "var a = -b * c;", errors: 1 }] + }); + }, "Use token.range[0] instead of token.start"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: ["var a = b ? c : d;"], + invalid: [] + }); + }, "Use token.range[1] instead of token.end"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: ["function f() { /* comment */ }"], + invalid: [] + }); + }, "Use token.range[0] instead of token.start"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [], + invalid: [{ code: "var x = //\n {\n //comment\n //\n}", errors: 1 }] + }); + }, "Use token.range[1] instead of token.end"); + + const enhancedParserPath = require.resolve("./fixtures/enhanced-parser"); + + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [{ code: "foo(a, b)", parser: enhancedParserPath }], + invalid: [] + }); + }, "Use node.range[0] instead of node.start"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [], + invalid: [{ code: "var a = b * (c + d) / e;", parser: enhancedParserPath, errors: 1 }] + }); + }, "Use node.range[1] instead of node.end"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [], + invalid: [{ code: "var a = -b * c;", parser: enhancedParserPath, errors: 1 }] + }); + }, "Use token.range[0] instead of token.start"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [{ code: "var a = b ? c : d;", parser: enhancedParserPath }], + invalid: [] + }); + }, "Use token.range[1] instead of token.end"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [{ code: "function f() { /* comment */ }", parser: enhancedParserPath }], + invalid: [] + }); + }, "Use token.range[0] instead of token.start"); + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [], + invalid: [{ code: "var x = //\n {\n //comment\n //\n}", parser: enhancedParserPath, errors: 1 }] + }); + }, "Use token.range[1] instead of token.end"); + + assert.throws(() => { + ruleTester.run("uses-start-end", usesStartEndRule, { + valid: [{ code: "@foo class A {}", parser: require.resolve("./fixtures/enhanced-parser2") }], + invalid: [] + }); + }, "Use node.range[0] instead of node.start"); + }); + + it("should throw an error if no test scenarios given", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last")); + }, "Test Scenarios for rule foo : Could not find test scenario object"); + }); + + it("should throw an error if no acceptable test scenario object is given", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), []); + }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios\nCould not find any invalid test scenarios"); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), ""); + }, "Test Scenarios for rule foo : Could not find test scenario object"); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), 2); + }, "Test Scenarios for rule foo : Could not find test scenario object"); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), {}); + }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios\nCould not find any invalid test scenarios"); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { + valid: [] + }); + }, "Test Scenarios for rule foo is invalid:\nCould not find any invalid test scenarios"); + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { + invalid: [] + }); + }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios"); + }); + + // Nominal message/messageId use cases + it("should assert match if message provided in both test and result.", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { + valid: [], + invalid: [{ code: "foo", errors: [{ message: "something" }] }] + }); + }, /Avoid using variables named/u); + + ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { + valid: [], + invalid: [{ code: "foo", errors: [{ message: "Avoid using variables named 'foo'." }] }] + }); + }); + + it("should assert match between messageId if provided in both test and result.", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { + valid: [], + invalid: [{ code: "foo", errors: [{ messageId: "unused" }] }] + }); + }, "messageId 'avoidFoo' does not match expected messageId 'unused'."); + + ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { + valid: [], + invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] + }); + }); + it("should assert match between resulting message output if messageId and data provided in both test and result", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { + valid: [], + invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "notFoo" } }] }] + }); + }, "Hydrated message \"Avoid using variables named 'notFoo'.\" does not match \"Avoid using variables named 'foo'.\""); + }); + + // messageId/message misconfiguration cases + it("should throw if user tests for both message and messageId", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { + valid: [], + invalid: [{ code: "foo", errors: [{ message: "something", messageId: "avoidFoo" }] }] + }); + }, "Error should not specify both 'message' and a 'messageId'."); + }); + it("should throw if user tests for messageId but the rule doesn't use the messageId meta syntax.", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { + valid: [], + invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] + }); + }, "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'"); + }); + it("should throw if user tests for messageId not listed in the rule's meta syntax.", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { + valid: [], + invalid: [{ code: "foo", errors: [{ messageId: "useFoo" }] }] + }); + }, /Invalid messageId 'useFoo'/u); + }); + it("should throw if data provided without messageId.", () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { + valid: [], + invalid: [{ code: "foo", errors: [{ data: "something" }] }] + }); + }, "Error must specify 'messageId' if 'data' is used."); + }); + + describe("suggestions", () => { + it("should pass with valid suggestions (tested using desc)", () => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [ + "var boo;" + ], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + output: "var bar;" + }] + }] + }] + }); + }); + + it("should pass with suggestions on multiple lines", () => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [ + { + code: "function foo() {\n var foo = 1;\n}", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + output: "function bar() {\n var foo = 1;\n}" + }] + }, { + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + output: "function foo() {\n var bar = 1;\n}" + }] + }] + } + ] + }); + }); + + it("should pass with valid suggestions (tested using messageIds)", () => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + output: "var bar;" + }, { + messageId: "renameFoo", + output: "var baz;" + }] + }] + }] + }); + }); + + it("should pass with valid suggestions (one tested using messageIds, the other using desc)", () => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + output: "var bar;" + }, { + desc: "Rename identifier 'foo' to 'baz'", + output: "var baz;" + }] + }] + }] + }); + }); + + it("should pass with valid suggestions (tested using both desc and messageIds for the same suggestion)", () => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + messageId: "renameFoo", + output: "var bar;" + }, { + desc: "Rename identifier 'foo' to 'baz'", + messageId: "renameFoo", + output: "var baz;" + }] + }] + }] + }); + }); + + it("should pass with valid suggestions (tested using only desc on a rule that utilizes meta.messages)", () => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + output: "var bar;" + }, { + desc: "Rename identifier 'foo' to 'baz'", + output: "var baz;" + }] + }] + }] + }); + }); + + it("should pass with valid suggestions (tested using messageIds and data)", () => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + data: { newName: "bar" }, + output: "var bar;" + }, { + messageId: "renameFoo", + data: { newName: "baz" }, + output: "var baz;" + }] + }] + }] + }); + }); + + + it("should pass when tested using empty suggestion test objects if the array length is correct", () => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{}, {}] + }] + }] + }); + }); + + it("should support explicitly expecting no suggestions", () => { + [void 0, null, false, []].forEach(suggestions => { + ruleTester.run("suggestions-basic", require("./fixtures/no-eval"), { + valid: [], + invalid: [{ + code: "eval('var foo');", + errors: [{ + suggestions + }] + }] + }); + }); + }); + + it("should fail when expecting no suggestions and there are suggestions", () => { + [void 0, null, false, []].forEach(suggestions => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions + }] + }] + }); + }, "Error should have no suggestions on error with message: \"Avoid using identifiers named 'foo'.\""); + }); + }); + + it("should fail when testing for suggestions that don't exist", () => { + assert.throws(() => { + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "this-does-not-exist" + }] + }] + }] + }); + }, "Error should have an array of suggestions. Instead received \"undefined\" on error with message: \"Bad var.\""); + }); + + it("should fail when there are a different number of suggestions", () => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + output: "var bar;" + }, { + desc: "Rename identifier 'foo' to 'baz'", + output: "var baz;" + }] + }] + }] + }); + }, "Error should have 2 suggestions. Instead found 1 suggestions"); + }); + + it("should throw if the suggestion description doesn't match", () => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "not right", + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 0 : desc should be \"not right\" but got \"Rename identifier 'foo' to 'bar'\" instead."); + }); + + it("should throw if the suggestion description doesn't match (although messageIds match)", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + messageId: "renameFoo", + output: "var bar;" + }, { + desc: "Rename id 'foo' to 'baz'", + messageId: "renameFoo", + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 1 : desc should be \"Rename id 'foo' to 'baz'\" but got \"Rename identifier 'foo' to 'baz'\" instead."); + }); + + it("should throw if the suggestion messageId doesn't match", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "unused", + output: "var bar;" + }, { + messageId: "renameFoo", + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 0 : messageId should be 'unused' but got 'renameFoo' instead."); + }); + + it("should throw if the suggestion messageId doesn't match (although descriptions match)", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + messageId: "renameFoo", + output: "var bar;" + }, { + desc: "Rename identifier 'foo' to 'baz'", + messageId: "avoidFoo", + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 1 : messageId should be 'avoidFoo' but got 'renameFoo' instead."); + }); + + it("should throw if test specifies messageId for a rule that doesn't have meta.messages", () => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + output: "var bar;" + }] + }] + }] + }); + }, "Error Suggestion at index 0 : Test can not use 'messageId' if rule under test doesn't define 'meta.messages'."); + }); + + it("should throw if test specifies messageId that doesn't exist in the rule's meta.messages", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + output: "var bar;" + }, { + messageId: "removeFoo", + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 1 : Test has invalid messageId 'removeFoo', the rule under test allows only one of ['avoidFoo', 'unused', 'renameFoo']."); + }); + + it("should throw if hydrated desc doesn't match (wrong data value)", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + data: { newName: "car" }, + output: "var bar;" + }, { + messageId: "renameFoo", + data: { newName: "baz" }, + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 0 : Hydrated test desc \"Rename identifier 'foo' to 'car'\" does not match received desc \"Rename identifier 'foo' to 'bar'\"."); + }); + + it("should throw if hydrated desc doesn't match (wrong data key)", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + data: { newName: "bar" }, + output: "var bar;" + }, { + messageId: "renameFoo", + data: { name: "baz" }, + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 1 : Hydrated test desc \"Rename identifier 'foo' to '{{ newName }}'\" does not match received desc \"Rename identifier 'foo' to 'baz'\"."); + }); + + it("should throw if test specifies both desc and data", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + messageId: "renameFoo", + data: { newName: "bar" }, + output: "var bar;" + }, { + messageId: "renameFoo", + data: { newName: "baz" }, + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 0 : Test should not specify both 'desc' and 'data'."); + }); + + it("should throw if test uses data but doesn't specify messageId", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + data: { newName: "bar" }, + output: "var bar;" + }, { + data: { newName: "baz" }, + output: "var baz;" + }] + }] + }] + }); + }, "Error Suggestion at index 1 : Test must specify 'messageId' if 'data' is used."); + }); + + it("should throw if the resulting suggestion output doesn't match", () => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + desc: "Rename identifier 'foo' to 'bar'", + output: "var baz;" + }] + }] + }] + }); + }, "Expected the applied suggestion fix to match the test suggestion output"); + }); + + it("should fail when specified suggestion isn't an object", () => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [null] + }] + }] + }); + }, "Test suggestion in 'suggestions' array must be an object."); + + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [ + { + messageId: "renameFoo", + output: "var bar;" + }, + "Rename identifier 'foo' to 'baz'" + ] + }] + }] + }); + }, "Test suggestion in 'suggestions' array must be an object."); + }); + + it("should fail when the suggestion is an object with an unknown property name", () => { + assert.throws(() => { + ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { + valid: [ + "var boo;" + ], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + message: "Rename identifier 'foo' to 'bar'" + }] + }] + }] + }); + }, /Invalid suggestion property name 'message'/u); + }); + + it("should fail when any of the suggestions is an object with an unknown property name", () => { + assert.throws(() => { + ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { + valid: [], + invalid: [{ + code: "var foo;", + errors: [{ + suggestions: [{ + messageId: "renameFoo", + output: "var bar;" + }, { + messageId: "renameFoo", + outpt: "var baz;" + }] + }] + }] + }); + }, /Invalid suggestion property name 'outpt'/u); + }); + + it("should throw an error if a rule that doesn't have `meta.hasSuggestions` enabled produces suggestions", () => { + assert.throws(() => { + ruleTester.run("suggestions-missing-hasSuggestions-property", require("./fixtures/suggestions").withoutHasSuggestionsProperty, { + valid: [], + invalid: [ + { code: "var foo = bar;", output: "5", errors: 1 } + ] + }); + }, "Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); + }); + }); + + describe("deprecations", () => { + let processStub; + const ruleWithNoSchema = { + meta: { + type: "suggestion" + }, + create(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + }; + const ruleWithNoMeta = { + create(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + }; + + beforeEach(() => { + processStub = sinon.stub(process, "emitWarning"); + }); + + afterEach(() => { + processStub.restore(); + }); + + it("should log a deprecation warning when using the legacy function-style API for rule", () => { + + /** + * Legacy-format rule (a function instead of an object with `create` method). + * @param {RuleContext} context The ESLint rule context object. + * @returns {Object} Listeners. + */ + function functionStyleRule(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + + ruleTester.run("function-style-rule", functionStyleRule, { + valid: [], + invalid: [ + { code: "var foo = bar;", errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); + assert.deepStrictEqual( + processStub.getCall(0).args, + [ + "\"function-style-rule\" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules", + "DeprecationWarning" + ] + ); + }); + + it("should log a deprecation warning when meta is not defined for the rule", () => { + ruleTester.run("rule-with-no-meta-1", ruleWithNoMeta, { + valid: [], + invalid: [ + { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); + assert.deepStrictEqual( + processStub.getCall(0).args, + [ + "\"rule-with-no-meta-1\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", + "DeprecationWarning" + ] + ); + }); + + it("should log a deprecation warning when schema is not defined for the rule", () => { + ruleTester.run("rule-with-no-schema-1", ruleWithNoSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); + assert.deepStrictEqual( + processStub.getCall(0).args, + [ + "\"rule-with-no-schema-1\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", + "DeprecationWarning" + ] + ); + }); + + it("should log a deprecation warning when schema is `undefined`", () => { + const ruleWithUndefinedSchema = { + meta: { + type: "problem", + // eslint-disable-next-line no-undefined -- intentionally added for test case + schema: undefined + }, + create(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + }; + + ruleTester.run("rule-with-undefined-schema", ruleWithUndefinedSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); + assert.deepStrictEqual( + processStub.getCall(0).args, + [ + "\"rule-with-undefined-schema\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", + "DeprecationWarning" + ] + ); + }); + + it("should log a deprecation warning when schema is `null`", () => { + const ruleWithNullSchema = { + meta: { + type: "problem", + schema: null + }, + create(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + }; + + ruleTester.run("rule-with-null-schema", ruleWithNullSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); + assert.deepStrictEqual( + processStub.getCall(0).args, + [ + "\"rule-with-null-schema\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", + "DeprecationWarning" + ] + ); + }); + + it("should not log a deprecation warning when schema is an empty array", () => { + const ruleWithEmptySchema = { + meta: { + type: "suggestion", + schema: [] + }, + create(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + }; + + ruleTester.run("rule-with-no-options", ruleWithEmptySchema, { + valid: [], + invalid: [{ code: "var foo = bar;", errors: 1 }] + }); + + assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); + }); + + it("When the rule is an object-style rule, the legacy rule API warning is not emitted", () => { + ruleTester.run("rule-with-no-schema-2", ruleWithNoSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); + }); + + it("When the rule has meta.schema and there are test cases with options, the missing schema warning is not emitted", () => { + const ruleWithSchema = { + meta: { + type: "suggestion", + schema: [{ + type: "boolean" + }] + }, + create(context) { + return { + Program(node) { + context.report({ node, message: "bad" }); + } + }; + } + }; + + ruleTester.run("rule-with-schema", ruleWithSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", options: [true], errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); + }); + + it("When the rule does not have meta, but there are no test cases with options, the missing schema warning is not emitted", () => { + ruleTester.run("rule-with-no-meta-2", ruleWithNoMeta, { + valid: [], + invalid: [ + { code: "var foo = bar;", errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); + }); + + it("When the rule has meta without meta.schema, but there are no test cases with options, the missing schema warning is not emitted", () => { + ruleTester.run("rule-with-no-schema-3", ruleWithNoSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); + }); + it("When the rule has meta without meta.schema, and some test cases have options property but it's an empty array, the missing schema warning is not emitted", () => { + ruleTester.run("rule-with-no-schema-4", ruleWithNoSchema, { + valid: [], + invalid: [ + { code: "var foo = bar;", options: [], errors: 1 } + ] + }); + + assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); + }); + }); + + /** + * Asserts that a particular value will be emitted from an EventEmitter. + * @param {EventEmitter} emitter The emitter that should emit a value + * @param {string} emitType The type of emission to listen for + * @param {any} expectedValue The value that should be emitted + * @returns {Promise} A Promise that fulfills if the value is emitted, and rejects if something else is emitted. + * The Promise will be indefinitely pending if no value is emitted. + */ + function assertEmitted(emitter, emitType, expectedValue) { + return new Promise((resolve, reject) => { + emitter.once(emitType, emittedValue => { + if (emittedValue === expectedValue) { + resolve(); + } else { + reject(new Error(`Expected ${expectedValue} to be emitted but ${emittedValue} was emitted instead.`)); + } + }); + }); + } + + describe("naming test cases", () => { + + it("should use the first argument as the name of the test suite", () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "describe", "this-is-a-rule-name"); + + ruleTester.run("this-is-a-rule-name", require("./fixtures/no-var"), { + valid: [], + invalid: [] + }); + + return assertion; + }); + + it("should use the test code as the name of the tests for valid code (string form)", () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", "valid(code);"); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [ + "valid(code);" + ], + invalid: [] + }); + + return assertion; + }); + + it("should use the test code as the name of the tests for valid code (object form)", () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", "valid(code);"); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [ + { + code: "valid(code);" + } + ], + invalid: [] + }); + + return assertion; + }); + + it("should use the test code as the name of the tests for invalid code", () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", "var x = invalid(code);"); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { + code: "var x = invalid(code);", + output: " x = invalid(code);", + errors: 1 + } + ] + }); + + return assertion; + }); + + // https://github.com/eslint/eslint/issues/8142 + it("should use the empty string as the name of the test if the test case is an empty string", () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", ""); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [ + { + code: "" + } + ], + invalid: [] + }); + + return assertion; + }); + + it('should use the "name" property if set to a non-empty string', () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", "my test"); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { + name: "my test", + code: "var x = invalid(code);", + output: " x = invalid(code);", + errors: 1 + } + ] + }); + + return assertion; + }); + + it('should use the "name" property if set to a non-empty string for valid cases too', () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", "my test"); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [ + { + name: "my test", + code: "valid(code);" + } + ], + invalid: [] + }); + + return assertion; + }); + + + it('should use the test code as the name if the "name" property is set to an empty string', () => { + const assertion = assertEmitted(ruleTesterTestEmitter, "it", "var x = invalid(code);"); + + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { + name: "", + code: "var x = invalid(code);", + output: " x = invalid(code);", + errors: 1 + } + ] + }); + + return assertion; + }); + + it('should throw if "name" property is not a string', () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [{ code: "foo", name: 123 }], + invalid: [{ code: "foo" }] + + }); + }, /Optional test case property 'name' must be a string/u); + + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: ["foo"], + invalid: [{ code: "foo", name: 123 }] + }); + }, /Optional test case property 'name' must be a string/u); + }); + + it('should throw if "code" property is not a string', () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [{ code: 123 }], + invalid: [{ code: "foo" }] + + }); + }, /Test case must specify a string value for 'code'/u); + + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [123], + invalid: [{ code: "foo" }] + + }); + }, /Test case must specify a string value for 'code'/u); + + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: ["foo"], + invalid: [{ code: 123 }] + }); + }, /Test case must specify a string value for 'code'/u); + }); + + it('should throw if "code" property is missing', () => { + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: [{ }], + invalid: [{ code: "foo" }] + + }); + }, /Test case must specify a string value for 'code'/u); + + assert.throws(() => { + ruleTester.run("foo", require("./fixtures/no-var"), { + valid: ["foo"], + invalid: [{ }] + }); + }, /Test case must specify a string value for 'code'/u); + }); + }); + + // https://github.com/eslint/eslint/issues/11615 + it("should fail the case if autofix made a syntax error.", () => { + assert.throw(() => { + ruleTester.run( + "foo", + { + meta: { + fixable: "code" + }, + create(context) { + return { + Identifier(node) { + context.report({ + node, + message: "make a syntax error", + fix(fixer) { + return fixer.replaceText(node, "one two"); + } + }); + } + }; + } + }, + { + valid: ["one()"], + invalid: [] + } + ); + }, /A fatal parsing error occurred in autofix.\nError: .+\nAutofix output:\n.+/u); + }); + + describe("sanitize test cases", () => { + let originalRuleTesterIt; + let spyRuleTesterIt; + + before(() => { + originalRuleTesterIt = RuleTester.it; + spyRuleTesterIt = sinon.spy(); + RuleTester.it = spyRuleTesterIt; + }); + after(() => { + RuleTester.it = originalRuleTesterIt; + }); + beforeEach(() => { + spyRuleTesterIt.resetHistory(); + ruleTester = new RuleTester(); + }); + it("should present newline when using back-tick as new line", () => { + const code = ` + var foo = bar;`; + + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { + code, + errors: [/^Bad var/u] + } + ] + }); + sinon.assert.calledWith(spyRuleTesterIt, code); + }); + it("should present \\u0000 as a string", () => { + const code = "\u0000"; + + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { + code, + errors: [/^Bad var/u] + } + ] + }); + sinon.assert.calledWith(spyRuleTesterIt, "\\u0000"); + }); + it("should present the pipe character correctly", () => { + const code = "var foo = bar || baz;"; + + ruleTester.run("no-var", require("./fixtures/no-var"), { + valid: [], + invalid: [ + { + code, + errors: [/^Bad var/u] + } + ] + }); + sinon.assert.calledWith(spyRuleTesterIt, code); + }); + + }); + + describe("SourceCode#getComments()", () => { + const useGetCommentsRule = { + create: context => ({ + Program(node) { + const sourceCode = context.getSourceCode(); + + sourceCode.getComments(node); + } + }) + }; + + it("should throw if called from a valid test case", () => { + assert.throws(() => { + ruleTester.run("use-get-comments", useGetCommentsRule, { + valid: [""], + invalid: [] + }); + }, /`SourceCode#getComments\(\)` is deprecated/u); + }); + + it("should throw if called from an invalid test case", () => { + assert.throws(() => { + ruleTester.run("use-get-comments", useGetCommentsRule, { + valid: [], + invalid: [{ + code: "", + errors: [{}] + }] + }); + }, /`SourceCode#getComments\(\)` is deprecated/u); + }); + }); + + describe("Subclassing", () => { + + it("should allow subclasses to set the describe/it/itOnly statics and should correctly use those values", () => { + const assertionDescribe = assertEmitted(ruleTesterTestEmitter, "custom describe", "this-is-a-rule-name"); + const assertionIt = assertEmitted(ruleTesterTestEmitter, "custom it", "valid(code);"); + const assertionItOnly = assertEmitted(ruleTesterTestEmitter, "custom itOnly", "validOnly(code);"); + + /** + * Subclass for testing + */ + class RuleTesterSubclass extends RuleTester { } + RuleTesterSubclass.describe = function(text, method) { + ruleTesterTestEmitter.emit("custom describe", text, method); + return method.call(this); + }; + RuleTesterSubclass.it = function(text, method) { + ruleTesterTestEmitter.emit("custom it", text, method); + return method.call(this); + }; + RuleTesterSubclass.itOnly = function(text, method) { + ruleTesterTestEmitter.emit("custom itOnly", text, method); + return method.call(this); + }; + + const ruleTesterSubclass = new RuleTesterSubclass(); + + ruleTesterSubclass.run("this-is-a-rule-name", require("./fixtures/no-var"), { + valid: [ + "valid(code);", + { + code: "validOnly(code);", + only: true + } + ], + invalid: [] + }); + + return Promise.all([ + assertionDescribe, + assertionIt, + assertionItOnly + ]); + }); + + }); + +}); diff --git a/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js b/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js new file mode 100644 index 00000000000..06a87c90dcd --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js @@ -0,0 +1,29 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/empty-program-parser.js + +"use strict"; + +exports.parse = function (text, parserOptions) { + return { + "type": "Program", + "start": 0, + "end": 0, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 0 + } + }, + "range": [ + 0, + 0 + ], + "body": [], + "sourceType": "script", + "comments": [], + "tokens": [] + }; +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js new file mode 100644 index 00000000000..9aef71554d3 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js @@ -0,0 +1,20 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/enhanced-parser.js + +var espree = require("espree"); + +exports.parseForESLint = function(code, options) { + return { + ast: espree.parse(code, options), + services: { + test: { + getMessage() { + return "Hi!"; + } + } + } + }; +}; + +exports.parse = function() { + throw new Error("Use parseForESLint() instead."); +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js new file mode 100644 index 00000000000..bd91282a38c --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js @@ -0,0 +1,25 @@ +// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/enhanced-parser2.js + +"use strict"; + +const assert = require("assert"); +const vk = require("eslint-visitor-keys"); +const KEYS = vk.unionWith({ + ClassDeclaration: ["experimentalDecorators"], + ClassExpression: ["experimentalDecorators"] +}) + +exports.parseForESLint = (code, options) => { + assert(code === "@foo class A {}"); + assert(options.eslintVisitorKeys === true); + assert(options.eslintScopeManager === true); + + return { + ast: { type: "Program", start: 0, end: 15, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 15 } }, comments: [], tokens: [{ type: "Punctuator", value: "@", start: 0, end: 1, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }, range: [0, 1] }, { type: "Identifier", value: "foo", start: 1, end: 4, loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 4 } }, range: [1, 4] }, { type: "Keyword", value: "class", start: 5, end: 10, loc: { start: { line: 1, column: 5 }, end: { line: 1, column: 10 } }, range: [5, 10] }, { type: "Identifier", value: "A", start: 11, end: 12, loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } }, range: [11, 12] }, { type: "Punctuator", value: "{", start: 13, end: 14, loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } }, range: [13, 14] }, { type: "Punctuator", value: "}", start: 14, end: 15, loc: { start: { line: 1, column: 14 }, end: { line: 1, column: 15 } }, range: [14, 15] }], range: [5, 15], sourceType: "module", body: [{ type: "ClassDeclaration", start: 5, end: 15, loc: { start: { line: 1, column: 5 }, end: { line: 1, column: 15 } }, experimentalDecorators: [{ type: "Decorator", start: 0, end: 4, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 4 } }, expression: { type: "Identifier", start: 1, end: 4, loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 4 }, identifierName: "foo" }, name: "foo", range: [1, 4], _babelType: "Identifier" }, range: [0, 4], _babelType: "Decorator" }], id: { type: "Identifier", start: 11, end: 12, loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 }, identifierName: "A" }, name: "A", range: [11, 12], _babelType: "Identifier" }, superClass: null, body: { type: "ClassBody", start: 13, end: 15, loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 15 } }, body: [], range: [13, 15], _babelType: "ClassBody" }, range: [5, 15], _babelType: "ClassDeclaration" }] }, + visitorKeys: KEYS + }; +}; + +exports.parse = function () { + throw new Error("Use parseForESLint() instead."); +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js b/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js new file mode 100644 index 00000000000..adde04196c9 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js @@ -0,0 +1,25 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/fixes-one-problem.js + +"use strict"; + +module.exports = { + meta: { + fixable: "code" + }, + create(context) { + return { + Program(node) { + context.report({ + node, + message: "No programs allowed." + }); + + context.report({ + node, + message: "Seriously, no programs allowed.", + fix: fixer => fixer.remove(node) + }); + } + } + } +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/messageId.js b/packages/rule-tester/tests/eslint-base/fixtures/messageId.js new file mode 100644 index 00000000000..8f2bb2a246f --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/messageId.js @@ -0,0 +1,39 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/messageId.js + +"use strict"; + +module.exports.withMetaWithData = { + meta: { + messages: { + avoidFoo: "Avoid using variables named '{{ name }}'.", + unused: "An unused key" + } + }, + create(context) { + return { + Identifier(node) { + if (node.name === "foo") { + context.report({ + node, + messageId: "avoidFoo", + data: { + name: "foo" + } + }); + } + } + }; + } +}; + +module.exports.withMessageOnly = { + create(context) { + return { + Identifier(node) { + if (node.name === "foo") { + context.report({ node, message: "Avoid using variables named 'foo'."}); + } + } + }; + } +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js new file mode 100644 index 00000000000..53ddcd28847 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js @@ -0,0 +1,37 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast-at-first.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [] + }, + create(context) { + return { + "Program": function(node) { + node.body.push({ + "type": "Identifier", + "name": "modified", + "range": [0, 8], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }); + }, + + "Identifier": function(node) { + if (node.name === "bar") { + context.report({message: "error", node: node}); + } + } + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js new file mode 100644 index 00000000000..9fda56d0260 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js @@ -0,0 +1,37 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast-at-last.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [] + }, + create(context) { + return { + "Program:exit": function(node) { + node.body.push({ + "type": "Identifier", + "name": "modified", + "range": [0, 8], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + } + }); + }, + + "Identifier": function(node) { + if (node.name === "bar") { + context.report({message: "error", node: node}); + } + } + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js new file mode 100644 index 00000000000..3b8a879920a --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js @@ -0,0 +1,21 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [] + }, + create(context) { + return { + "Identifier": function(node) { + node.name += "!"; + + if (node.name === "bar!") { + context.report({message: "error", node: node}); + } + } + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js b/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js new file mode 100644 index 00000000000..a7cba23f612 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js @@ -0,0 +1,19 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-eval.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [], + }, + create(context) { + return { + CallExpression: function (node) { + if (node.callee.name === "eval") { + context.report(node, "eval sucks."); + } + }, + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js new file mode 100644 index 00000000000..7f9a1683aa0 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js @@ -0,0 +1,23 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-invalid-args.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [{ + type: "boolean" + }] + }, + create(context) { + var config = context.options[0]; + + return { + "Program": function(node) { + if (config === true) { + context.report(node, "Invalid args"); + } + } + }; + } +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js new file mode 100644 index 00000000000..fd691f11a96 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js @@ -0,0 +1,21 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-invalid-schema.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [{ + "enum": [] + }] + }, + create(context) { + return { + "Program": function(node) { + if (config) { + context.report(node, "Expected nothing."); + } + } + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js b/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js new file mode 100644 index 00000000000..1e12913c228 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js @@ -0,0 +1,22 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-schema-violation.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [{ + "enum": ["foo"] + }] + }, + create(context) { + const config = context.options[0]; + return { + "Program": function(node) { + if (config && config !== "foo") { + context.report(node, "Expected foo."); + } + } + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename b/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename new file mode 100644 index 00000000000..795bd0ac7af --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename @@ -0,0 +1,19 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-test-filename + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [] + }, + create(context) { + return { + "Program": function(node) { + if (context.getFilename() === '') { + context.report(node, "Filename test was not defined."); + } + } + }; + } +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js b/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js new file mode 100644 index 00000000000..94834189376 --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js @@ -0,0 +1,26 @@ +// Forked from https://github.com/eslint/eslint/tree/1665c029acb92bf8812267f1647ad1a7054cbcb4/tests/fixtures/testers/rule-tester/no-test-global.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [], + }, + create(context) { + return { + "Program": function(node) { + var globals = context.getScope().variables.map(function (variable) { + return variable.name; + }); + + if (globals.indexOf("test") === -1) { + context.report(node, "Global variable test was not defined."); + } + if (globals.indexOf("foo") !== -1) { + context.report(node, "Global variable foo should not be used."); + } + } + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js b/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js new file mode 100644 index 00000000000..291b81b105f --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js @@ -0,0 +1,22 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-test-settings.js + +"use strict"; + +module.exports = { + meta: { + type: "problem", + schema: [], + }, + create(context) { + return { + Program: function (node) { + if (!context.settings || !context.settings.test) { + context.report( + node, + "Global settings test was not defined." + ); + } + }, + }; + }, +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-var.js b/packages/rule-tester/tests/eslint-base/fixtures/no-var.js new file mode 100644 index 00000000000..26f0382536d --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/no-var.js @@ -0,0 +1,28 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-var.js + +"use strict"; + +module.exports = { + meta: { + fixable: "code", + schema: [] + }, + create(context) { + var sourceCode = context.getSourceCode(); + + return { + "VariableDeclaration": function(node) { + if (node.kind === "var") { + context.report({ + node: node, + loc: sourceCode.getFirstToken(node).loc, + message: "Bad var.", + fix: function(fixer) { + return fixer.remove(sourceCode.getFirstToken(node)); + } + }) + } + } + }; + } +}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js b/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js new file mode 100644 index 00000000000..4638ac2cacb --- /dev/null +++ b/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js @@ -0,0 +1,76 @@ +// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/suggestions.js + +"use strict"; + +module.exports.basic = { + meta: { hasSuggestions: true }, + create(context) { + return { + Identifier(node) { + if (node.name === "foo") { + context.report({ + node, + message: "Avoid using identifiers named 'foo'.", + suggest: [{ + desc: "Rename identifier 'foo' to 'bar'", + fix: fixer => fixer.replaceText(node, 'bar') + }] + }); + } + } + }; + } +}; + +module.exports.withMessageIds = { + meta: { + messages: { + avoidFoo: "Avoid using identifiers named '{{ name }}'.", + unused: "An unused key", + renameFoo: "Rename identifier 'foo' to '{{ newName }}'" + }, + hasSuggestions: true + }, + create(context) { + return { + Identifier(node) { + if (node.name === "foo") { + context.report({ + node, + messageId: "avoidFoo", + data: { + name: "foo" + }, + suggest: [{ + messageId: "renameFoo", + data: { + newName: "bar" + }, + fix: fixer => fixer.replaceText(node, "bar") + }, { + messageId: "renameFoo", + data: { + newName: "baz" + }, + fix: fixer => fixer.replaceText(node, "baz") + }] + }); + } + } + }; + } +}; + +module.exports.withoutHasSuggestionsProperty = { + create(context) { + return { + Identifier(node) { + context.report({ + node, + message: "some message", + suggest: [{ desc: "some suggestion", fix: fixer => fixer.replaceText(node, 'bar') }] + }); + } + }; + } +}; diff --git a/packages/rule-tester/tsconfig.build.json b/packages/rule-tester/tsconfig.build.json new file mode 100644 index 00000000000..782f14402ae --- /dev/null +++ b/packages/rule-tester/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "composite": true, + "outDir": "./dist", + "rootDir": "./src", + "resolveJsonModule": true + }, + "include": ["src", "typings"], + "references": [{ "path": "../utils/tsconfig.build.json" }] +} diff --git a/packages/rule-tester/tsconfig.json b/packages/rule-tester/tsconfig.json new file mode 100644 index 00000000000..9cea515ba6b --- /dev/null +++ b/packages/rule-tester/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.build.json", + "compilerOptions": { + "composite": false, + "rootDir": "." + }, + "include": ["src", "typings", "tests", "tools"] +} diff --git a/packages/rule-tester/typings/eslint.d.ts b/packages/rule-tester/typings/eslint.d.ts new file mode 100644 index 00000000000..6341a84533a --- /dev/null +++ b/packages/rule-tester/typings/eslint.d.ts @@ -0,0 +1,24 @@ +declare module 'eslint/use-at-your-own-risk' { + import type { AnyRuleModule } from '@typescript-eslint/utils/ts-eslint'; + + export const builtinRules: ReadonlyMap; +} + +declare module '@eslint/eslintrc' { + import type { Linter } from '@typescript-eslint/utils/ts-eslint'; + + export const Legacy: { + ConfigOps: { + normalizeConfigGlobal: ( + configuredValue: boolean | string | null, + ) => Linter.GlobalVariableOptionBase; + // ... + }; + environments: Map; + // ... + }; +} + +declare module 'eslint' { + export { SourceCode } from '@typescript-eslint/utils/ts-eslint'; +} diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 8365331097a..de9551f8005 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,208 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* fix illegal decorator check ([#6723](https://github.com/typescript-eslint/typescript-eslint/issues/6723)) ([c456f8c](https://github.com/typescript-eslint/typescript-eslint/commit/c456f8cdef5a931c631bfbcfc84d8a25caaf019f)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* create TSTypeQuery node when TSImportType has isTypeOf ([#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076)) ([2b69b65](https://github.com/typescript-eslint/typescript-eslint/commit/2b69b659d87b58468e413801d31086ae0eeafff4)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration ([#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863)) ([844875c](https://github.com/typescript-eslint/typescript-eslint/commit/844875cbe933195ff25ba218f82ede3ebde9a0a0)) +* **scope-manager:** ignore ECMA version ([#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889)) ([f2330f7](https://github.com/typescript-eslint/typescript-eslint/commit/f2330f79739eb93e3c290ccc6e810a01e097eda0)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) +* **typescript-estree:** remove optionality from AST boolean properties ([#6274](https://github.com/typescript-eslint/typescript-eslint/issues/6274)) ([df131e2](https://github.com/typescript-eslint/typescript-eslint/commit/df131e258c93e5714c88c0373cfeb2e1e75afc75)) + + +### BREAKING CHANGES + +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/scope-manager diff --git a/packages/scope-manager/README.md b/packages/scope-manager/README.md index 0258932e390..b730e9d83a9 100644 --- a/packages/scope-manager/README.md +++ b/packages/scope-manager/README.md @@ -3,6 +3,8 @@ [![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/scope-manager.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/scope-manager) [![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/scope-manager.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/scope-manager) -👉 See **https://typescript-eslint.io/architecture/scope-manager** for documentation on this package. +👉 See **https://typescript-eslint.io/packages/scope-manager** for documentation on this package. > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 6f0267563f5..81497bf1562 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,21 +1,24 @@ { "name": "@typescript-eslint/scope-manager", - "version": "5.56.0", + "version": "6.0.0", "description": "TypeScript scope analyser for ESLint", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -25,25 +28,28 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "nx build", "clean": "nx clean", "clean-fixtures": "nx clean-fixtures", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:lib": "nx generate-lib", + "generate-lib": "nx generate-lib", "lint": "nx lint", "test": "nx test --code-coverage", "typecheck": "nx typecheck" }, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0" + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/typescript-estree": "6.0.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", @@ -57,9 +63,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } } diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json index 9694ae86163..70170c34455 100644 --- a/packages/scope-manager/project.json +++ b/packages/scope-manager/project.json @@ -6,14 +6,14 @@ "targets": { "build": { "executor": "nx:run-commands", - "outputs": ["{projectRoot}/dist", "{projectRoot}/_ts3.4"], + "outputs": ["{projectRoot}/dist", "{projectRoot}/_ts4.3"], "options": { "parallel": false, "cwd": "packages/scope-manager", "commands": [ - "rimraf _ts3.4", + "rimraf _ts4.3", "tsc -b tsconfig.build.json", - "downlevel-dts dist _ts3.4/dist" + "downlevel-dts dist _ts4.3/dist --to=4.3" ] } }, @@ -36,7 +36,7 @@ "commands": [ "tsc -b tsconfig.build.json --clean", "rimraf dist", - "rimraf _ts3.4", + "rimraf _ts4.3", "rimraf coverage" ] } @@ -50,14 +50,15 @@ } }, "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/scope-manager/**/*.ts"] + "lintFilePatterns": ["packages/scope-manager/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } }, "test": { - "executor": "@nrwl/jest:jest", + "executor": "@nx/jest:jest", "outputs": ["{projectRoot}/coverage"], "options": { "jestConfig": "packages/scope-manager/jest.config.js", diff --git a/packages/scope-manager/src/ScopeManager.ts b/packages/scope-manager/src/ScopeManager.ts index 7f4b2a5f705..e6d3ee333c3 100644 --- a/packages/scope-manager/src/ScopeManager.ts +++ b/packages/scope-manager/src/ScopeManager.ts @@ -14,6 +14,7 @@ import { GlobalScope, MappedTypeScope, ModuleScope, + ScopeType, SwitchScope, TSEnumScope, TSModuleScope, @@ -28,9 +29,11 @@ interface ScopeManagerOptions { globalReturn?: boolean; sourceType?: 'module' | 'script'; impliedStrict?: boolean; - ecmaVersion?: number; } +/** + * @see https://eslint.org/docs/latest/developer-guide/scope-manager-interface#scopemanager-interface + */ class ScopeManager { public currentScope: Scope | null; public readonly declaredVariables: WeakMap; @@ -77,12 +80,13 @@ class ScopeManager { public isImpliedStrict(): boolean { return this.#options.impliedStrict === true; } + public isStrictModeSupported(): boolean { - return this.#options.ecmaVersion != null && this.#options.ecmaVersion >= 5; + return true; } public isES6(): boolean { - return this.#options.ecmaVersion != null && this.#options.ecmaVersion >= 6; + return true; } /** @@ -106,7 +110,10 @@ class ScopeManager { */ public acquire(node: TSESTree.Node, inner = false): Scope | null { function predicate(testScope: Scope): boolean { - if (testScope.type === 'function' && testScope.functionExpressionScope) { + if ( + testScope.type === ScopeType.function && + testScope.functionExpressionScope + ) { return false; } return true; diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index 8e8e0d83406..2ab613325c9 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -1,7 +1,6 @@ -import type { EcmaVersion, Lib, TSESTree } from '@typescript-eslint/types'; +import type { Lib, TSESTree } from '@typescript-eslint/types'; import { visitorKeys } from '@typescript-eslint/visitor-keys'; -import { lib as TSLibraries } from './lib'; import type { ReferencerOptions } from './referencer'; import { Referencer } from './referencer'; import { ScopeManager } from './ScopeManager'; @@ -16,13 +15,6 @@ interface AnalyzeOptions { */ childVisitorKeys?: ReferencerOptions['childVisitorKeys']; - /** - * Which ECMAScript version is considered. - * Defaults to `2018`. - * `'latest'` is converted to 1e8 at parser. - */ - ecmaVersion?: EcmaVersion | 1e8; - /** * Whether the whole script is executed under node.js environment. * When enabled, the scope manager adds a function scope immediately following the global scope. @@ -31,7 +23,7 @@ interface AnalyzeOptions { globalReturn?: boolean; /** - * Implied strict mode (if ecmaVersion >= 5). + * Implied strict mode. * Defaults to `false`. */ impliedStrict?: boolean; @@ -54,7 +46,7 @@ interface AnalyzeOptions { /** * The lib used by the project. * This automatically defines a type variable for any types provided by the configured TS libs. - * Defaults to the lib for the provided `ecmaVersion`. + * Defaults to ['esnext']. * * https://www.typescriptlang.org/tsconfig#lib */ @@ -63,7 +55,7 @@ interface AnalyzeOptions { /** * The source type of the script. */ - sourceType?: 'script' | 'module'; + sourceType?: 'module' | 'script'; /** * Emit design-type metadata for decorated declarations in source. @@ -74,7 +66,6 @@ interface AnalyzeOptions { const DEFAULT_OPTIONS: Required = { childVisitorKeys: visitorKeys, - ecmaVersion: 2018, globalReturn: false, impliedStrict: false, jsxPragma: 'React', @@ -84,21 +75,6 @@ const DEFAULT_OPTIONS: Required = { emitDecoratorMetadata: false, }; -/** - * Convert ecmaVersion to lib. - * `'latest'` is converted to 1e8 at parser. - */ -function mapEcmaVersion(version: EcmaVersion | 1e8 | undefined): Lib { - if (version == null || version === 3 || version === 5) { - return 'es5'; - } - - const year = version > 2000 ? version : 2015 + (version - 6); - const lib = `es${year}`; - - return lib in TSLibraries ? (lib as Lib) : year > 2020 ? 'esnext' : 'es5'; -} - /** * Takes an AST and returns the analyzed scopes. */ @@ -106,12 +82,9 @@ function analyze( tree: TSESTree.Node, providedOptions?: AnalyzeOptions, ): ScopeManager { - const ecmaVersion = - providedOptions?.ecmaVersion ?? DEFAULT_OPTIONS.ecmaVersion; const options: Required = { childVisitorKeys: providedOptions?.childVisitorKeys ?? DEFAULT_OPTIONS.childVisitorKeys, - ecmaVersion, globalReturn: providedOptions?.globalReturn ?? DEFAULT_OPTIONS.globalReturn, impliedStrict: providedOptions?.impliedStrict ?? DEFAULT_OPTIONS.impliedStrict, @@ -122,7 +95,7 @@ function analyze( jsxFragmentName: providedOptions?.jsxFragmentName ?? DEFAULT_OPTIONS.jsxFragmentName, sourceType: providedOptions?.sourceType ?? DEFAULT_OPTIONS.sourceType, - lib: providedOptions?.lib ?? [mapEcmaVersion(ecmaVersion)], + lib: providedOptions?.lib ?? ['esnext'], emitDecoratorMetadata: providedOptions?.emitDecoratorMetadata ?? DEFAULT_OPTIONS.emitDecoratorMetadata, diff --git a/packages/scope-manager/src/definition/ImportBindingDefinition.ts b/packages/scope-manager/src/definition/ImportBindingDefinition.ts index 2003158b84e..9ac45579fc4 100644 --- a/packages/scope-manager/src/definition/ImportBindingDefinition.ts +++ b/packages/scope-manager/src/definition/ImportBindingDefinition.ts @@ -5,9 +5,9 @@ import { DefinitionType } from './DefinitionType'; class ImportBindingDefinition extends DefinitionBase< DefinitionType.ImportBinding, - | TSESTree.ImportSpecifier | TSESTree.ImportDefaultSpecifier | TSESTree.ImportNamespaceSpecifier + | TSESTree.ImportSpecifier | TSESTree.TSImportEqualsDeclaration, TSESTree.ImportDeclaration | TSESTree.TSImportEqualsDeclaration, TSESTree.Identifier diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index 662b70813c8..6123ab15e79 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -57,7 +57,7 @@ class ClassVisitor extends Visitor { .defineIdentifier(node.id, new ClassNameDefinition(node.id, node)); } - node.decorators?.forEach(d => this.#referencer.visit(d)); + node.decorators.forEach(d => this.#referencer.visit(d)); this.#referencer.scopeManager.nestClassScope(node); @@ -74,7 +74,7 @@ class ClassVisitor extends Visitor { // visit the type param declarations this.visitType(node.typeParameters); // then the usages - this.visitType(node.superTypeParameters); + this.visitType(node.superTypeArguments); node.implements?.forEach(imp => this.visitType(imp)); this.visit(node.body); @@ -96,19 +96,25 @@ class ClassVisitor extends Visitor { * foo: Type; * } */ - this.visitMetadataType(node.typeAnnotation, !!node.decorators); + this.visitMetadataType(node.typeAnnotation, !!node.decorators.length); } protected visitFunctionParameterTypeAnnotation( node: TSESTree.Parameter, withDecorators: boolean, ): void { - if ('typeAnnotation' in node) { - this.visitMetadataType(node.typeAnnotation, withDecorators); - } else if (node.type === AST_NODE_TYPES.AssignmentPattern) { - this.visitMetadataType(node.left.typeAnnotation, withDecorators); - } else if (node.type === AST_NODE_TYPES.TSParameterProperty) { - this.visitFunctionParameterTypeAnnotation(node.parameter, withDecorators); + switch (node.type) { + case AST_NODE_TYPES.AssignmentPattern: + this.visitMetadataType(node.left.typeAnnotation, withDecorators); + break; + case AST_NODE_TYPES.TSParameterProperty: + this.visitFunctionParameterTypeAnnotation( + node.parameter, + withDecorators, + ); + break; + default: + this.visitMetadataType(node.typeAnnotation, withDecorators); } } @@ -134,7 +140,7 @@ class ClassVisitor extends Visitor { * foo(): Type {} * } */ - let withMethodDecorators = !!methodNode.decorators; + let withMethodDecorators = !!methodNode.decorators.length; /** * class A { * foo( @@ -151,7 +157,7 @@ class ClassVisitor extends Visitor { withMethodDecorators = withMethodDecorators || (methodNode.kind !== 'set' && - node.params.some(param => param.decorators)); + node.params.some(param => param.decorators.length)); if (!withMethodDecorators && methodNode.kind === 'set') { const keyName = getLiteralMethodKeyName(methodNode); @@ -171,7 +177,7 @@ class ClassVisitor extends Visitor { // Node must both be static or not node.static === methodNode.static && getLiteralMethodKeyName(node) === keyName, - )?.decorators + )?.decorators.length ) { withMethodDecorators = true; } @@ -213,7 +219,7 @@ class ClassVisitor extends Visitor { { processRightHandNodes: true }, ); this.visitFunctionParameterTypeAnnotation(param, withMethodDecorators); - param.decorators?.forEach(d => this.visit(d)); + param.decorators.forEach(d => this.visit(d)); } this.visitMetadataType(node.returnType, withMethodDecorators); @@ -238,8 +244,8 @@ class ClassVisitor extends Visitor { | TSESTree.AccessorProperty | TSESTree.PropertyDefinition | TSESTree.TSAbstractAccessorProperty - | TSESTree.TSAbstractPropertyDefinition - | TSESTree.TSAbstractMethodDefinition, + | TSESTree.TSAbstractMethodDefinition + | TSESTree.TSAbstractPropertyDefinition, ): void { if (node.computed) { this.#referencer.visit(node.key); @@ -265,9 +271,7 @@ class ClassVisitor extends Visitor { } } - if ('decorators' in node) { - node.decorators?.forEach(d => this.#referencer.visit(d)); - } + node.decorators.forEach(d => this.#referencer.visit(d)); } protected visitMethod(node: TSESTree.MethodDefinition): void { @@ -281,9 +285,7 @@ class ClassVisitor extends Visitor { this.#referencer.visit(node.value); } - if ('decorators' in node) { - node.decorators?.forEach(d => this.#referencer.visit(d)); - } + node.decorators.forEach(d => this.#referencer.visit(d)); } protected visitType(node: TSESTree.Node | null | undefined): void { @@ -325,8 +327,8 @@ class ClassVisitor extends Visitor { this.#referencer.currentScope().referenceDualValueType(entityName); } - if (node.typeAnnotation.typeParameters) { - this.visitType(node.typeAnnotation.typeParameters); + if (node.typeAnnotation.typeArguments) { + this.visitType(node.typeAnnotation.typeArguments); } // everything is handled now @@ -415,7 +417,7 @@ class ClassVisitor extends Visitor { */ function getLiteralMethodKeyName( node: TSESTree.MethodDefinition, -): string | number | null { +): number | string | null { if (node.computed && node.key.type === AST_NODE_TYPES.Literal) { if ( typeof node.key.value === 'string' || diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index 53de28469e8..6e1140e1895 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -7,7 +7,7 @@ import { VisitorBase } from './VisitorBase'; type PatternVisitorCallback = ( pattern: TSESTree.Identifier, info: { - assignments: (TSESTree.AssignmentPattern | TSESTree.AssignmentExpression)[]; + assignments: (TSESTree.AssignmentExpression | TSESTree.AssignmentPattern)[]; rest: boolean; topLevel: boolean; }, @@ -18,12 +18,12 @@ class PatternVisitor extends VisitorBase { public static isPattern( node: TSESTree.Node, ): node is + | TSESTree.ArrayPattern + | TSESTree.AssignmentPattern | TSESTree.Identifier | TSESTree.ObjectPattern - | TSESTree.ArrayPattern - | TSESTree.SpreadElement | TSESTree.RestElement - | TSESTree.AssignmentPattern { + | TSESTree.SpreadElement { const nodeType = node.type; return ( @@ -39,8 +39,8 @@ class PatternVisitor extends VisitorBase { readonly #rootPattern: TSESTree.Node; readonly #callback: PatternVisitorCallback; readonly #assignments: ( - | TSESTree.AssignmentPattern | TSESTree.AssignmentExpression + | TSESTree.AssignmentPattern )[] = []; public readonly rightHandNodes: TSESTree.Node[] = []; readonly #restElements: TSESTree.RestElement[] = []; diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 7a14de51df1..38e4a0d2ada 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -211,12 +211,16 @@ class Referencer extends Visitor { protected visitFunctionParameterTypeAnnotation( node: TSESTree.Parameter, ): void { - if ('typeAnnotation' in node) { - this.visitType(node.typeAnnotation); - } else if (node.type === AST_NODE_TYPES.AssignmentPattern) { - this.visitType(node.left.typeAnnotation); - } else if (node.type === AST_NODE_TYPES.TSParameterProperty) { - this.visitFunctionParameterTypeAnnotation(node.parameter); + switch (node.type) { + case AST_NODE_TYPES.AssignmentPattern: + this.visitType(node.left.typeAnnotation); + break; + case AST_NODE_TYPES.TSParameterProperty: + this.visitFunctionParameterTypeAnnotation(node.parameter); + break; + default: + this.visitType(node.typeAnnotation); + break; } } protected visitFunction( @@ -265,7 +269,7 @@ class Referencer extends Visitor { { processRightHandNodes: true }, ); this.visitFunctionParameterTypeAnnotation(param); - param.decorators?.forEach(d => this.visit(d)); + param.decorators.forEach(d => this.visit(d)); } this.visitType(node.returnType); @@ -303,8 +307,8 @@ class Referencer extends Visitor { protected visitTypeAssertion( node: | TSESTree.TSAsExpression - | TSESTree.TSTypeAssertion - | TSESTree.TSSatisfiesExpression, + | TSESTree.TSSatisfiesExpression + | TSESTree.TSTypeAssertion, ): void { this.visit(node.expression); this.visitType(node.typeAnnotation); @@ -374,9 +378,7 @@ class Referencer extends Visitor { } protected BlockStatement(node: TSESTree.BlockStatement): void { - if (this.scopeManager.isES6()) { - this.scopeManager.nestBlockScope(node); - } + this.scopeManager.nestBlockScope(node); this.visitChildren(node); @@ -388,8 +390,8 @@ class Referencer extends Visitor { } protected CallExpression(node: TSESTree.CallExpression): void { - this.visitChildren(node, ['typeParameters']); - this.visitType(node.typeParameters); + this.visitChildren(node, ['typeArguments']); + this.visitType(node.typeArguments); } protected CatchClause(node: TSESTree.CatchClause): void { @@ -490,7 +492,7 @@ class Referencer extends Visitor { protected ImportDeclaration(node: TSESTree.ImportDeclaration): void { assert( - this.scopeManager.isES6() && this.scopeManager.isModule(), + this.scopeManager.isModule(), 'ImportDeclaration should appear when the mode is ES6 and in the module context.', ); @@ -542,7 +544,7 @@ class Referencer extends Visitor { } else { this.visit(node.name); } - this.visitType(node.typeParameters); + this.visitType(node.typeArguments); for (const attr of node.attributes) { this.visit(attr); } @@ -564,8 +566,8 @@ class Referencer extends Visitor { } protected NewExpression(node: TSESTree.NewExpression): void { - this.visitChildren(node, ['typeParameters']); - this.visitType(node.typeParameters); + this.visitChildren(node, ['typeArguments']); + this.visitType(node.typeArguments); } protected PrivateIdentifier(): void { @@ -582,14 +584,11 @@ class Referencer extends Visitor { this.scopeManager.nestFunctionScope(node, false); } - if (this.scopeManager.isES6() && this.scopeManager.isModule()) { + if (this.scopeManager.isModule()) { this.scopeManager.nestModuleScope(node); } - if ( - this.scopeManager.isStrictModeSupported() && - this.scopeManager.isImpliedStrict() - ) { + if (this.scopeManager.isImpliedStrict()) { this.currentScope().isStrict = true; } @@ -604,9 +603,7 @@ class Referencer extends Visitor { protected SwitchStatement(node: TSESTree.SwitchStatement): void { this.visit(node.discriminant); - if (this.scopeManager.isES6()) { - this.scopeManager.nestSwitchScope(node); - } + this.scopeManager.nestSwitchScope(node); for (const switchCase of node.cases) { this.visit(switchCase); @@ -620,7 +617,7 @@ class Referencer extends Visitor { ): void { this.visit(node.tag); this.visit(node.quasi); - this.visitType(node.typeParameters); + this.visitType(node.typeArguments); } protected TSAsExpression(node: TSESTree.TSAsExpression): void { @@ -702,8 +699,8 @@ class Referencer extends Visitor { protected TSInstantiationExpression( node: TSESTree.TSInstantiationExpression, ): void { - this.visitChildren(node, ['typeParameters']); - this.visitType(node.typeParameters); + this.visitChildren(node, ['typeArguments']); + this.visitType(node.typeArguments); } protected TSInterfaceDeclaration( @@ -786,13 +783,8 @@ class Referencer extends Visitor { { processRightHandNodes: true }, ); - if (decl.init) { - this.visit(decl.init); - } - - if ('typeAnnotation' in decl.id) { - this.visitType(decl.id.typeAnnotation); - } + this.visit(decl.init); + this.visitType(decl.id.typeAnnotation); } } diff --git a/packages/scope-manager/src/referencer/TypeVisitor.ts b/packages/scope-manager/src/referencer/TypeVisitor.ts index 70d4f86d55a..9daa2e64093 100644 --- a/packages/scope-manager/src/referencer/TypeVisitor.ts +++ b/packages/scope-manager/src/referencer/TypeVisitor.ts @@ -120,7 +120,7 @@ class TypeVisitor extends Visitor { protected TSImportType(node: TSESTree.TSImportType): void { // the TS parser allows any type to be the parameter, but it's a syntax error - so we can ignore it - this.visit(node.typeParameters); + this.visit(node.typeArguments); // the qualifier is just part of a standard EntityName, so it should not be visited } @@ -187,7 +187,6 @@ class TypeVisitor extends Visitor { } node.extends?.forEach(this.visit, this); - node.implements?.forEach(this.visit, this); this.visit(node.body); if (node.typeParameters) { @@ -260,7 +259,10 @@ class TypeVisitor extends Visitor { // a type query `typeof foo` is a special case that references a _non-type_ variable, protected TSTypeQuery(node: TSESTree.TSTypeQuery): void { - let entityName: TSESTree.Identifier | TSESTree.ThisExpression; + let entityName: + | TSESTree.Identifier + | TSESTree.ThisExpression + | TSESTree.TSImportType; if (node.exprName.type === AST_NODE_TYPES.TSQualifiedName) { let iter = node.exprName; while (iter.left.type === AST_NODE_TYPES.TSQualifiedName) { @@ -269,12 +271,16 @@ class TypeVisitor extends Visitor { entityName = iter.left; } else { entityName = node.exprName; + + if (node.exprName.type === AST_NODE_TYPES.TSImportType) { + this.visit(node.exprName); + } } if (entityName.type === AST_NODE_TYPES.Identifier) { this.#referencer.currentScope().referenceValue(entityName); } - this.visit(node.typeParameters); + this.visit(node.typeArguments); } protected TSTypeAnnotation(node: TSESTree.TSTypeAnnotation): void { diff --git a/packages/scope-manager/src/referencer/Visitor.ts b/packages/scope-manager/src/referencer/Visitor.ts index a6b07b18efa..bbcf348734d 100644 --- a/packages/scope-manager/src/referencer/Visitor.ts +++ b/packages/scope-manager/src/referencer/Visitor.ts @@ -12,7 +12,7 @@ interface VisitPatternOptions extends PatternVisitorOptions { } class Visitor extends VisitorBase { readonly #options: VisitorOptions; - constructor(optionsOrVisitor: VisitorOptions | Visitor) { + constructor(optionsOrVisitor: Visitor | VisitorOptions) { super( optionsOrVisitor instanceof Visitor ? optionsOrVisitor.#options diff --git a/packages/scope-manager/src/referencer/VisitorBase.ts b/packages/scope-manager/src/referencer/VisitorBase.ts index 5a7a8bbebe0..e21bfc030a7 100644 --- a/packages/scope-manager/src/referencer/VisitorBase.ts +++ b/packages/scope-manager/src/referencer/VisitorBase.ts @@ -35,11 +35,11 @@ abstract class VisitorBase { node: T | null | undefined, excludeArr: (keyof T)[] = [], ): void { - if (node == null || node.type == null) { + if (node?.type == null) { return; } - const exclude = new Set(excludeArr.concat(['parent'])) as Set; + const exclude = new Set([...excludeArr, 'parent'] as string[]); const children = this.#childVisitorKeys[node.type] ?? Object.keys(node); for (const key of children) { if (exclude.has(key)) { @@ -67,7 +67,7 @@ abstract class VisitorBase { * Dispatching node. */ visit(node: TSESTree.Node | null | undefined): void { - if (node == null || node.type == null) { + if (node?.type == null) { return; } diff --git a/packages/scope-manager/src/scope/FunctionScope.ts b/packages/scope-manager/src/scope/FunctionScope.ts index c2a48fc45c3..8e8b405cd6a 100644 --- a/packages/scope-manager/src/scope/FunctionScope.ts +++ b/packages/scope-manager/src/scope/FunctionScope.ts @@ -13,9 +13,9 @@ class FunctionScope extends ScopeBase< | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression + | TSESTree.Program | TSESTree.TSDeclareFunction - | TSESTree.TSEmptyBodyFunctionExpression - | TSESTree.Program, + | TSESTree.TSEmptyBodyFunctionExpression, Scope > { constructor( diff --git a/packages/scope-manager/src/scope/Scope.ts b/packages/scope-manager/src/scope/Scope.ts index 708869313a6..87999d4b74b 100644 --- a/packages/scope-manager/src/scope/Scope.ts +++ b/packages/scope-manager/src/scope/Scope.ts @@ -20,8 +20,8 @@ import type { WithScope } from './WithScope'; type Scope = | BlockScope | CatchScope - | ClassScope | ClassFieldInitializerScope + | ClassScope | ClassStaticBlockScope | ConditionalTypeScope | ForScope diff --git a/packages/scope-manager/src/scope/ScopeBase.ts b/packages/scope-manager/src/scope/ScopeBase.ts index ae26d129cb5..81c712dff38 100644 --- a/packages/scope-manager/src/scope/ScopeBase.ts +++ b/packages/scope-manager/src/scope/ScopeBase.ts @@ -124,7 +124,7 @@ function registerScope(scopeManager: ScopeManager, scope: Scope): void { const generator = createIdGenerator(); -type VariableScope = GlobalScope | FunctionScope | ModuleScope | TSModuleScope; +type VariableScope = FunctionScope | GlobalScope | ModuleScope | TSModuleScope; const VARIABLE_SCOPE_TYPES = new Set([ ScopeType.classFieldInitializer, ScopeType.classStaticBlock, @@ -232,7 +232,7 @@ abstract class ScopeBase< block: TBlock, isMethodDefinition: boolean, ) { - const upperScopeAsScopeBase = upperScope as Scope; + const upperScopeAsScopeBase = upperScope!; this.type = type; this.#dynamic = @@ -386,7 +386,7 @@ abstract class ScopeBase< } protected delegateToUpperScope(ref: Reference): void { - const upper = this.upper as Scope as AnyScope; + const upper = this.upper! as AnyScope; if (upper?.leftToResolve) { upper.leftToResolve.push(ref); } @@ -413,7 +413,7 @@ abstract class ScopeBase< } protected defineVariable( - nameOrVariable: string | Variable, + nameOrVariable: Variable | string, set: Map, variables: Variable[], node: TSESTree.Identifier | null, diff --git a/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts b/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts index 14cfeceb368..20e73e1f485 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/dot-notation -- ['implicit'] is private */ import { expectToBeForScope, expectToBeFunctionScope, diff --git a/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts b/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts index 23e02b9af0c..5a19f01debf 100644 --- a/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts +++ b/packages/scope-manager/tests/eslint-scope/get-declared-variables.test.ts @@ -12,23 +12,24 @@ describe('ScopeManager.prototype.getDeclaredVariables', () => { expectedNamesList: string[][], ): void { const scopeManager = analyze(ast, { - ecmaVersion: 6, sourceType: 'module', }); simpleTraverse(ast, { - [type](node) { - const expected = expectedNamesList.shift()!; - const actual = scopeManager.getDeclaredVariables(node); - - expect(actual).toHaveLength(expected.length); - if (actual.length > 0) { - const end = actual.length - 1; - - for (let i = 0; i <= end; i++) { - expect(actual[i].name).toBe(expected[i]); + visitors: { + [type](node) { + const expected = expectedNamesList.shift()!; + const actual = scopeManager.getDeclaredVariables(node); + + expect(actual).toHaveLength(expected.length); + if (actual.length > 0) { + const end = actual.length - 1; + + for (let i = 0; i <= end; i++) { + expect(actual[i].name).toBe(expected[i]); + } } - } + }, }, }); diff --git a/packages/scope-manager/tests/eslint-scope/implicit-global-reference.test.ts b/packages/scope-manager/tests/eslint-scope/implicit-global-reference.test.ts index 743d19873ec..22f27ed5d66 100644 --- a/packages/scope-manager/tests/eslint-scope/implicit-global-reference.test.ts +++ b/packages/scope-manager/tests/eslint-scope/implicit-global-reference.test.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/dot-notation -- ['implicit'] is private */ import { DefinitionType } from '../../src/definition'; import { expectToBeGlobalScope, diff --git a/packages/scope-manager/tests/eslint-scope/implied-strict.test.ts b/packages/scope-manager/tests/eslint-scope/implied-strict.test.ts index 34151be8c3d..893da6048c2 100644 --- a/packages/scope-manager/tests/eslint-scope/implied-strict.test.ts +++ b/packages/scope-manager/tests/eslint-scope/implied-strict.test.ts @@ -8,7 +8,7 @@ import { } from '../util'; describe('impliedStrict option', () => { - it('ensures all user scopes are strict if ecmaVersion >= 5', () => { + it('ensures all user scopes are strict', () => { const { scopeManager } = parseAndAnalyze( ` function foo() { @@ -18,7 +18,6 @@ describe('impliedStrict option', () => { } `, { - ecmaVersion: 5, impliedStrict: true, }, ); @@ -42,38 +41,12 @@ describe('impliedStrict option', () => { expect(scope.isStrict).toBeTruthy(); }); - it('ensures impliedStrict option is only effective when ecmaVersion option >= 5', () => { - const { scopeManager } = parseAndAnalyze( - ` - function foo() {} - `, - { - ecmaVersion: 3, - impliedStrict: true, - }, - ); - - expect(scopeManager.scopes).toHaveLength(2); - - let scope = scopeManager.scopes[0]; - - expectToBeGlobalScope(scope); - expect(scope.block.type).toBe(AST_NODE_TYPES.Program); - expect(scope.isStrict).toBeFalsy(); - - scope = scopeManager.scopes[1]; - expectToBeFunctionScope(scope); - expect(scope.block.type).toBe(AST_NODE_TYPES.FunctionDeclaration); - expect(scope.isStrict).toBeFalsy(); - }); - it('omits a nodejs global scope when ensuring all user scopes are strict', () => { const { scopeManager } = parseAndAnalyze( ` function foo() {} `, { - ecmaVersion: 5, globalReturn: true, impliedStrict: true, }, @@ -100,7 +73,6 @@ describe('impliedStrict option', () => { it('omits a module global scope when ensuring all user scopes are strict', () => { const { scopeManager } = parseAndAnalyze('function foo() {}', { - ecmaVersion: 6, impliedStrict: true, sourceType: 'module', }); diff --git a/packages/scope-manager/tests/eslint-scope/map-ecma-version.test.ts b/packages/scope-manager/tests/eslint-scope/map-ecma-version.test.ts deleted file mode 100644 index becca474ff3..00000000000 --- a/packages/scope-manager/tests/eslint-scope/map-ecma-version.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import type { EcmaVersion, Lib, TSESTree } from '@typescript-eslint/types'; - -import { analyze } from '../../src/analyze'; -import { Referencer } from '../../src/referencer'; - -jest.mock('../../src/referencer'); -jest.mock('../../src/ScopeManager'); - -describe('ecma version mapping', () => { - it("should map to 'esnext' when unsuported and new", () => { - expectMapping(2042, 'esnext'); - expectMapping(42, 'esnext'); - }); - - it("should map to 'es5' when unsuported and old", () => { - expectMapping(2002, 'es5'); - expectMapping(2, 'es5'); - }); - - it("should map to 'es{year}' when supported and >= 6", () => { - expectMapping(2015, 'es2015'); - expectMapping(6, 'es2015'); - expectMapping(2020, 'es2020'); - expectMapping(11, 'es2020'); - }); - - it("should map to 'es5' when 5 or 3", () => { - expectMapping(5, 'es5'); - expectMapping(3, 'es5'); - }); - - it("should map to 'es2018' when undefined", () => { - expectMapping(undefined, 'es2018'); - }); - - it("should map to 'esnext' when 'latest'", () => { - // `'latest'` is converted to 1e8 at parser. - expectMapping(1e8, 'esnext'); - }); -}); - -const fakeNode = {} as unknown as TSESTree.Node; - -function expectMapping(ecmaVersion: number | undefined, lib: Lib): void { - (Referencer as jest.Mock).mockClear(); - analyze(fakeNode, { ecmaVersion: ecmaVersion as EcmaVersion }); - expect(Referencer).toHaveBeenCalledWith( - expect.objectContaining({ lib: [lib] }), - expect.any(Object), - ); -} diff --git a/packages/scope-manager/tests/eslint-scope/references.test.ts b/packages/scope-manager/tests/eslint-scope/references.test.ts index 15ed88c9a1e..0b49cab0f7f 100644 --- a/packages/scope-manager/tests/eslint-scope/references.test.ts +++ b/packages/scope-manager/tests/eslint-scope/references.test.ts @@ -582,7 +582,7 @@ describe('References:', () => { declare class C { @deco - foo(): TypeC; + foo(): TypeC {}; } `, { diff --git a/packages/scope-manager/tests/fixtures.test.ts b/packages/scope-manager/tests/fixtures.test.ts index fa86c1544c7..9593a9a45a6 100644 --- a/packages/scope-manager/tests/fixtures.test.ts +++ b/packages/scope-manager/tests/fixtures.test.ts @@ -1,5 +1,5 @@ import fs from 'fs'; -import glob from 'glob'; +import glob = require('glob'); import makeDir from 'make-dir'; import path from 'path'; @@ -37,12 +37,11 @@ const fixtures = glob const FOUR_SLASH = /^\/\/\/\/[ ]+@(\w+)[ ]*=[ ]*(.+)$/; const QUOTED_STRING = /^["'](.+?)['"]$/; -type ALLOWED_VALUE = ['number' | 'boolean' | 'string', Set?]; +type ALLOWED_VALUE = ['boolean' | 'number' | 'string', Set?]; const ALLOWED_OPTIONS: Map = new Map< keyof AnalyzeOptions, ALLOWED_VALUE >([ - ['ecmaVersion', ['number']], ['globalReturn', ['boolean']], ['impliedStrict', ['boolean']], ['jsxPragma', ['string']], @@ -52,7 +51,7 @@ const ALLOWED_OPTIONS: Map = new Map< ]); function nestDescribe( - fixture: typeof fixtures[number], + fixture: (typeof fixtures)[number], segments = fixture.segments, ): void { if (segments.length > 0) { diff --git a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot index f46cd16af2e..94ab6357ed7 100644 --- a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot @@ -57,7 +57,7 @@ ScopeManager { identifier: Identifier<"T">, isRead: true, isTypeReference: true, - isValueReference: false, + isValueReference: true, isWrite: false, resolved: Variable$5, }, diff --git a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot index 226235e8379..52ad7d4c8a4 100644 --- a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot @@ -65,7 +65,7 @@ ScopeManager { identifier: Identifier<"T">, isRead: true, isTypeReference: true, - isValueReference: false, + isValueReference: true, isWrite: false, resolved: Variable$5, }, diff --git a/packages/scope-manager/tests/fixtures/decorators/accessor.ts b/packages/scope-manager/tests/fixtures/decorators/accessor.ts index 764ea5e3340..abe0263ac3f 100644 --- a/packages/scope-manager/tests/fixtures/decorators/accessor.ts +++ b/packages/scope-manager/tests/fixtures/decorators/accessor.ts @@ -5,5 +5,5 @@ class Foo { return 1; } @decorator - set foo() {} + set bar(value) {} } diff --git a/packages/scope-manager/tests/fixtures/decorators/accessor.ts.shot b/packages/scope-manager/tests/fixtures/decorators/accessor.ts.shot index 7cdbee72d9f..9d315fef25c 100644 --- a/packages/scope-manager/tests/fixtures/decorators/accessor.ts.shot +++ b/packages/scope-manager/tests/fixtures/decorators/accessor.ts.shot @@ -78,10 +78,22 @@ ScopeManager { isValueVariable: true, isTypeVariable: true, }, + Variable$8 { + defs: [ + ParameterDefinition$4 { + name: Identifier<"value">, + node: FunctionExpression$3, + }, + ], + name: "value", + references: [], + isValueVariable: true, + isTypeVariable: false, + }, ], scopes: [ GlobalScope$1 { - block: Program$3, + block: Program$4, isStrict: false, references: [], set: Map { @@ -127,7 +139,7 @@ ScopeManager { ], }, FunctionScope$4 { - block: FunctionExpression$4, + block: FunctionExpression$5, isStrict: true, references: [], set: Map { @@ -140,16 +152,18 @@ ScopeManager { ], }, FunctionScope$5 { - block: FunctionExpression$5, + block: FunctionExpression$3, isStrict: true, references: [], set: Map { "arguments" => Variable$7, + "value" => Variable$8, }, type: "function", upper: ClassScope$3, variables: [ Variable$7, + Variable$8, ], }, ], diff --git a/packages/scope-manager/tests/fixtures/decorators/parameter.ts b/packages/scope-manager/tests/fixtures/decorators/parameter.ts index 2b9b32b2bb2..a518ad975a0 100644 --- a/packages/scope-manager/tests/fixtures/decorators/parameter.ts +++ b/packages/scope-manager/tests/fixtures/decorators/parameter.ts @@ -1,7 +1,4 @@ function decorator() {} -function foo( - @decorator a, - @decorator [b], - @decorator { c }, - @decorator d = 1, -) {} +class A { + foo(@decorator a, @decorator [b], @decorator { c }, @decorator d = 1) {} +} diff --git a/packages/scope-manager/tests/fixtures/decorators/parameter.ts.shot b/packages/scope-manager/tests/fixtures/decorators/parameter.ts.shot index 07744f723ab..491ddab990e 100644 --- a/packages/scope-manager/tests/fixtures/decorators/parameter.ts.shot +++ b/packages/scope-manager/tests/fixtures/decorators/parameter.ts.shot @@ -58,28 +58,40 @@ ScopeManager { }, Variable$4 { defs: [ - FunctionNameDefinition$2 { - name: Identifier<"foo">, - node: FunctionDeclaration$2, + ClassNameDefinition$2 { + name: Identifier<"A">, + node: ClassDeclaration$2, }, ], - name: "foo", + name: "A", references: [], isValueVariable: true, - isTypeVariable: false, + isTypeVariable: true, }, Variable$5 { + defs: [ + ClassNameDefinition$3 { + name: Identifier<"A">, + node: ClassDeclaration$2, + }, + ], + name: "A", + references: [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$6 { defs: [], name: "arguments", references: [], isValueVariable: true, isTypeVariable: true, }, - Variable$6 { + Variable$7 { defs: [ - ParameterDefinition$3 { + ParameterDefinition$4 { name: Identifier<"a">, - node: FunctionDeclaration$2, + node: FunctionExpression$3, }, ], name: "a", @@ -87,11 +99,11 @@ ScopeManager { isValueVariable: true, isTypeVariable: false, }, - Variable$7 { + Variable$8 { defs: [ - ParameterDefinition$4 { + ParameterDefinition$5 { name: Identifier<"b">, - node: FunctionDeclaration$2, + node: FunctionExpression$3, }, ], name: "b", @@ -99,11 +111,11 @@ ScopeManager { isValueVariable: true, isTypeVariable: false, }, - Variable$8 { + Variable$9 { defs: [ - ParameterDefinition$5 { + ParameterDefinition$6 { name: Identifier<"c">, - node: FunctionDeclaration$2, + node: FunctionExpression$3, }, ], name: "c", @@ -111,11 +123,11 @@ ScopeManager { isValueVariable: true, isTypeVariable: false, }, - Variable$9 { + Variable$10 { defs: [ - ParameterDefinition$6 { + ParameterDefinition$7 { name: Identifier<"d">, - node: FunctionDeclaration$2, + node: FunctionExpression$3, }, ], name: "d", @@ -127,8 +139,8 @@ ScopeManager { isTypeReference: false, isValueReference: true, isWrite: true, - resolved: Variable$9, - writeExpr: Literal$3, + resolved: Variable$10, + writeExpr: Literal$4, }, ], isValueVariable: true, @@ -137,13 +149,13 @@ ScopeManager { ], scopes: [ GlobalScope$1 { - block: Program$4, + block: Program$5, isStrict: false, references: [], set: Map { "const" => ImplicitGlobalConstTypeVariable, "decorator" => Variable$2, - "foo" => Variable$4, + "A" => Variable$4, }, type: "global", upper: null, @@ -166,9 +178,22 @@ ScopeManager { Variable$3, ], }, - FunctionScope$3 { - block: FunctionDeclaration$2, - isStrict: false, + ClassScope$3 { + block: ClassDeclaration$2, + isStrict: true, + references: [], + set: Map { + "A" => Variable$5, + }, + type: "class", + upper: GlobalScope$1, + variables: [ + Variable$5, + ], + }, + FunctionScope$4 { + block: FunctionExpression$3, + isStrict: true, references: [ Reference$1, Reference$2, @@ -177,20 +202,20 @@ ScopeManager { Reference$5, ], set: Map { - "arguments" => Variable$5, - "a" => Variable$6, - "b" => Variable$7, - "c" => Variable$8, - "d" => Variable$9, + "arguments" => Variable$6, + "a" => Variable$7, + "b" => Variable$8, + "c" => Variable$9, + "d" => Variable$10, }, type: "function", - upper: GlobalScope$1, + upper: ClassScope$3, variables: [ - Variable$5, Variable$6, Variable$7, Variable$8, Variable$9, + Variable$10, ], }, ], diff --git a/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx new file mode 100644 index 00000000000..b42f48eaefd --- /dev/null +++ b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx @@ -0,0 +1,13 @@ +import * as React from "react"; + +// Both of these are equivalent: +const x = ; +const y = ; + +interface FooProps { + "a:b": string; +} + +function Foo(props: FooProps) { + return
{props["a:b"]}
; +} diff --git a/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot new file mode 100644 index 00000000000..045b34b7964 --- /dev/null +++ b/packages/scope-manager/tests/fixtures/jsx/namespaced-attribute.tsx.shot @@ -0,0 +1,203 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx namespaced-attribute 1`] = ` +ScopeManager { + variables: [ + ImplicitGlobalConstTypeVariable, + Variable$2 { + defs: [ + ImportBindingDefinition$1 { + name: Identifier<"React">, + node: ImportNamespaceSpecifier$1, + }, + ], + name: "React", + references: [ + Reference$2 { + identifier: Identifier<"React">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$2, + }, + ], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$3 { + defs: [ + VariableDefinition$2 { + name: Identifier<"x">, + node: VariableDeclarator$2, + }, + ], + name: "x", + references: [ + Reference$1 { + identifier: Identifier<"x">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$3, + writeExpr: JSXElement$3, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$4 { + defs: [ + VariableDefinition$3 { + name: Identifier<"y">, + node: VariableDeclarator$4, + }, + ], + name: "y", + references: [ + Reference$4 { + identifier: Identifier<"y">, + init: true, + isRead: false, + isTypeReference: false, + isValueReference: true, + isWrite: true, + resolved: Variable$4, + writeExpr: JSXElement$5, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$5 { + defs: [ + TypeDefinition$4 { + name: Identifier<"FooProps">, + node: TSInterfaceDeclaration$6, + }, + ], + name: "FooProps", + references: [ + Reference$6 { + identifier: Identifier<"FooProps">, + isRead: true, + isTypeReference: true, + isValueReference: false, + isWrite: false, + resolved: Variable$5, + }, + ], + isValueVariable: false, + isTypeVariable: true, + }, + Variable$6 { + defs: [ + FunctionNameDefinition$5 { + name: Identifier<"Foo">, + node: FunctionDeclaration$7, + }, + ], + name: "Foo", + references: [ + Reference$3 { + identifier: JSXIdentifier$8, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$6, + }, + Reference$5 { + identifier: JSXIdentifier$9, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$6, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + Variable$7 { + defs: [], + name: "arguments", + references: [], + isValueVariable: true, + isTypeVariable: true, + }, + Variable$8 { + defs: [ + ParameterDefinition$6 { + name: Identifier<"props">, + node: FunctionDeclaration$7, + }, + ], + name: "props", + references: [ + Reference$7 { + identifier: Identifier<"props">, + isRead: true, + isTypeReference: false, + isValueReference: true, + isWrite: false, + resolved: Variable$8, + }, + ], + isValueVariable: true, + isTypeVariable: false, + }, + ], + scopes: [ + GlobalScope$1 { + block: Program$10, + isStrict: false, + references: [ + Reference$1, + Reference$2, + Reference$3, + Reference$4, + Reference$5, + ], + set: Map { + "const" => ImplicitGlobalConstTypeVariable, + "React" => Variable$2, + "x" => Variable$3, + "y" => Variable$4, + "FooProps" => Variable$5, + "Foo" => Variable$6, + }, + type: "global", + upper: null, + variables: [ + ImplicitGlobalConstTypeVariable, + Variable$2, + Variable$3, + Variable$4, + Variable$5, + Variable$6, + ], + }, + FunctionScope$2 { + block: FunctionDeclaration$7, + isStrict: false, + references: [ + Reference$6, + Reference$7, + ], + set: Map { + "arguments" => Variable$7, + "props" => Variable$8, + }, + type: "function", + upper: GlobalScope$1, + variables: [ + Variable$7, + Variable$8, + ], + }, + ], +} +`; diff --git a/packages/scope-manager/tests/util/getSpecificNode.ts b/packages/scope-manager/tests/util/getSpecificNode.ts index a6d35615612..e9d23cf90c9 100644 --- a/packages/scope-manager/tests/util/getSpecificNode.ts +++ b/packages/scope-manager/tests/util/getSpecificNode.ts @@ -32,13 +32,15 @@ function getSpecificNode( simpleTraverse( ast, { - [selector](n) { - const res = cb ? cb(n) : n; - if (res) { - // the callback shouldn't match multiple nodes or else tests may behave weirdly - expect(node).toBeFalsy(); - node = typeof res === 'boolean' ? n : res; - } + visitors: { + [selector](n) { + const res = cb ? cb(n) : n; + if (res) { + // the callback shouldn't match multiple nodes or else tests may behave weirdly + expect(node).toBeFalsy(); + node = typeof res === 'boolean' ? n : res; + } + }, }, }, true, diff --git a/packages/scope-manager/tests/util/parse.ts b/packages/scope-manager/tests/util/parse.ts index 70983bfdd90..1ba739d66ed 100644 --- a/packages/scope-manager/tests/util/parse.ts +++ b/packages/scope-manager/tests/util/parse.ts @@ -42,8 +42,8 @@ function parseAndAnalyze( function parseAndAnalyze( code: string, sourceTypeOrAnalyzeOption: - | SourceType - | AnalyzeOptions = DEFAULT_ANALYZE_OPTIONS, + | AnalyzeOptions + | SourceType = DEFAULT_ANALYZE_OPTIONS, parserOptions: tseslint.TSESTreeOptions = DEFAULT_PARSER_OPTIONS, ): ParseAndAnalyze { const ast = parse(code, { ...parserOptions }); diff --git a/packages/scope-manager/tools/generate-lib.ts b/packages/scope-manager/tools/generate-lib.ts index ffd630136f0..13cc9eaec09 100644 --- a/packages/scope-manager/tools/generate-lib.ts +++ b/packages/scope-manager/tools/generate-lib.ts @@ -3,7 +3,7 @@ import { AST_TOKEN_TYPES } from '@typescript-eslint/types'; import * as fs from 'fs'; import * as path from 'path'; import { format, resolveConfig } from 'prettier'; -import rimraf from 'rimraf'; +import { rimraf } from 'rimraf'; import * as ts from 'typescript'; import type { ScopeManager, Variable } from '../src'; diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index d32682ab421..e620c394f8d 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -3,6 +3,218 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* bumped ts-api-utils to 0.0.39 ([#6497](https://github.com/typescript-eslint/typescript-eslint/issues/6497)) ([217c710](https://github.com/typescript-eslint/typescript-eslint/commit/217c710d99445994b9c8db7b9bee9b9cc63bc4cb)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* replace tsutils with ts-api-tools ([#6428](https://github.com/typescript-eslint/typescript-eslint/issues/6428)) ([79327b4](https://github.com/typescript-eslint/typescript-eslint/commit/79327b4999999cde3003901b40527af002c4906a)) +* **type-utils:** checking of type aliases' type names by `typeMatchesSpecifier` ([#6820](https://github.com/typescript-eslint/typescript-eslint/issues/6820)) ([7ca2c90](https://github.com/typescript-eslint/typescript-eslint/commit/7ca2c900eb07ade771bed43a8eb4a5a97fdfa3b3)) +* **type-utils:** file variant of TypeOrValueSpecifier uses canonical filenames instead of lowercasing ([#6781](https://github.com/typescript-eslint/typescript-eslint/issues/6781)) ([5095d05](https://github.com/typescript-eslint/typescript-eslint/commit/5095d05ac97320e7e50decef58279b01f2bfbd18)) +* **type-utils:** fixed TypeOrValueSpecifier not accounting for scoped DT packages ([#6780](https://github.com/typescript-eslint/typescript-eslint/issues/6780)) ([3350940](https://github.com/typescript-eslint/typescript-eslint/commit/335094064c441573638fda589d10f3b925058d5e)) +* **type-utils:** treat intrinsic types as if they are from lib and never match error types ([#6869](https://github.com/typescript-eslint/typescript-eslint/issues/6869)) ([ecb57de](https://github.com/typescript-eslint/typescript-eslint/commit/ecb57de5eb50511bed163f6e1b27e31b8577344e)) +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* bump ts-api-utils to v0.0.21 ([#6459](https://github.com/typescript-eslint/typescript-eslint/issues/6459)) ([3915661](https://github.com/typescript-eslint/typescript-eslint/commit/391566172dbc6013be79952fc68a588bf653fa8d)) +* bump ts-api-utils to v0.0.22 ([#6472](https://github.com/typescript-eslint/typescript-eslint/issues/6472)) ([b88cd23](https://github.com/typescript-eslint/typescript-eslint/commit/b88cd2332921efcca7ec5f4176f19779346d963b)) +* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-readonly-parameter-types] added an optional type allowlist ([#4436](https://github.com/typescript-eslint/typescript-eslint/issues/4436)) ([c9427b7](https://github.com/typescript-eslint/typescript-eslint/commit/c9427b78b69f1a6a2453ef2df2be5bf96b7b00bc)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* improve rule schemas, add test to validate schemas, add tooling to generate schema types ([#6899](https://github.com/typescript-eslint/typescript-eslint/issues/6899)) ([acc1a43](https://github.com/typescript-eslint/typescript-eslint/commit/acc1a43e02a403ff74a54c28c2c495f00d0be038)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) + + +### BREAKING CHANGES + +* drop support for ESLint v6 +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/type-utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/type-utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/type-utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + + +### Features + +* **eslint-plugin:** [no-unsafe-enum-comparison] add rule ([#6107](https://github.com/typescript-eslint/typescript-eslint/issues/6107)) ([915f9c2](https://github.com/typescript-eslint/typescript-eslint/commit/915f9c2dc8934eef491a672786ec9f016f3658ba)) + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + + +### Bug Fixes + +* **eslint-plugin:** correct crashes with getTypeArguments for ts < 3.7 ([#6767](https://github.com/typescript-eslint/typescript-eslint/issues/6767)) ([59eab58](https://github.com/typescript-eslint/typescript-eslint/commit/59eab587890a915387444d00c4a9387aed602718)) + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/type-utils diff --git a/packages/type-utils/README.md b/packages/type-utils/README.md index 2f842e803cc..acc4c89cd07 100644 --- a/packages/type-utils/README.md +++ b/packages/type-utils/README.md @@ -2,11 +2,13 @@ > Type utilities for working with TypeScript within ESLint rules. +[![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) +[![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) + The utilities in this package are separated from `@typescript-eslint/utils` so that that package does not require a dependency on `typescript`. -## ✋ Internal Package +👉 See **https://typescript-eslint.io/packages/type-utils** for documentation on this package. -This is an _internal package_ to the [typescript-eslint monorepo](https://github.com/typescript-eslint/typescript-eslint). -You likely don't want to use it directly. +> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. -👉 See **https://typescript-eslint.io** for docs on typescript-eslint. + diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index fed9562b7c7..19ce60e8f20 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,22 +1,25 @@ { "name": "@typescript-eslint/type-utils", - "version": "5.56.0", + "version": "6.0.0", "description": "Type utilities for working with TypeScript + ESLint together", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", - "_ts3.4", + "_ts4.3", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,30 +29,34 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", + "postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "5.56.0", - "@typescript-eslint/utils": "5.56.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/utils": "6.0.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" }, "devDependencies": { - "@typescript-eslint/parser": "5.56.0", + "@typescript-eslint/parser": "6.0.0", + "ajv": "^8.12.0", "typescript": "*" }, "peerDependencies": { - "eslint": "*" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -61,9 +68,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } } diff --git a/packages/type-utils/project.json b/packages/type-utils/project.json index 77fdd9b5fce..ab89a994953 100644 --- a/packages/type-utils/project.json +++ b/packages/type-utils/project.json @@ -5,10 +5,11 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/type-utils/**/*.ts"] + "lintFilePatterns": ["packages/type-utils/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/type-utils/src/TypeOrValueSpecifier.ts b/packages/type-utils/src/TypeOrValueSpecifier.ts new file mode 100644 index 00000000000..12c7679349d --- /dev/null +++ b/packages/type-utils/src/TypeOrValueSpecifier.ts @@ -0,0 +1,212 @@ +import { getCanonicalFileName } from '@typescript-eslint/typescript-estree'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; +import path from 'path'; +import * as tsutils from 'ts-api-utils'; +import type * as ts from 'typescript'; + +interface FileSpecifier { + from: 'file'; + name: string[] | string; + path?: string; +} + +interface LibSpecifier { + from: 'lib'; + name: string[] | string; +} + +interface PackageSpecifier { + from: 'package'; + name: string[] | string; + package: string; +} + +export type TypeOrValueSpecifier = + | FileSpecifier + | LibSpecifier + | PackageSpecifier + | string; + +export const typeOrValueSpecifierSchema: JSONSchema4 = { + oneOf: [ + { + type: 'string', + }, + { + type: 'object', + additionalProperties: false, + properties: { + from: { + type: 'string', + enum: ['file'], + }, + name: { + oneOf: [ + { + type: 'string', + }, + { + type: 'array', + minItems: 1, + uniqueItems: true, + items: { + type: 'string', + }, + }, + ], + }, + path: { + type: 'string', + }, + }, + required: ['from', 'name'], + }, + { + type: 'object', + additionalProperties: false, + properties: { + from: { + type: 'string', + enum: ['lib'], + }, + name: { + oneOf: [ + { + type: 'string', + }, + { + type: 'array', + minItems: 1, + uniqueItems: true, + items: { + type: 'string', + }, + }, + ], + }, + }, + required: ['from', 'name'], + }, + { + type: 'object', + additionalProperties: false, + properties: { + from: { + type: 'string', + enum: ['package'], + }, + name: { + oneOf: [ + { + type: 'string', + }, + { + type: 'array', + minItems: 1, + uniqueItems: true, + items: { + type: 'string', + }, + }, + ], + }, + package: { + type: 'string', + }, + }, + required: ['from', 'name', 'package'], + }, + ], +}; + +function specifierNameMatches(type: ts.Type, name: string[] | string): boolean { + if (typeof name === 'string') { + name = [name]; + } + if (name.some(item => item === type.intrinsicName)) { + return true; + } + const symbol = type.aliasSymbol ?? type.getSymbol(); + if (symbol === undefined) { + return false; + } + return name.some(item => (item as ts.__String) === symbol.escapedName); +} + +function typeDeclaredInFile( + relativePath: string | undefined, + declarationFiles: ts.SourceFile[], + program: ts.Program, +): boolean { + if (relativePath === undefined) { + const cwd = getCanonicalFileName(program.getCurrentDirectory()); + return declarationFiles.some(declaration => + getCanonicalFileName(declaration.fileName).startsWith(cwd), + ); + } + const absolutePath = getCanonicalFileName( + path.join(program.getCurrentDirectory(), relativePath), + ); + return declarationFiles.some( + declaration => getCanonicalFileName(declaration.fileName) === absolutePath, + ); +} + +function typeDeclaredInPackage( + packageName: string, + declarationFiles: ts.SourceFile[], +): boolean { + // Handle scoped packages - if the name starts with @, remove it and replace / with __ + const typesPackageName = + '@types/' + packageName.replace(/^@([^/]+)\//, '$1__'); + const matcher = new RegExp( + `node_modules/(?:${packageName}|${typesPackageName})/`, + ); + return declarationFiles.some(declaration => + matcher.test(declaration.fileName), + ); +} + +function typeDeclaredInLib( + declarationFiles: ts.SourceFile[], + program: ts.Program, +): boolean { + // Assertion: The type is not an error type. + + // Intrinsic type (i.e. string, number, boolean, etc) - Treat it as if it's from lib. + if (declarationFiles.length === 0) { + return true; + } + return declarationFiles.some(declaration => + program.isSourceFileDefaultLibrary(declaration), + ); +} + +export function typeMatchesSpecifier( + type: ts.Type, + specifier: TypeOrValueSpecifier, + program: ts.Program, +): boolean { + if (tsutils.isIntrinsicErrorType(type)) { + return false; + } + if (typeof specifier === 'string') { + return specifierNameMatches(type, specifier); + } + if (!specifierNameMatches(type, specifier.name)) { + return false; + } + const declarationFiles = + type + .getSymbol() + ?.getDeclarations() + ?.map(declaration => declaration.getSourceFile()) ?? []; + switch (specifier.from) { + case 'file': + return typeDeclaredInFile(specifier.path, declarationFiles, program); + case 'lib': + return typeDeclaredInLib(declarationFiles, program); + case 'package': + return typeDeclaredInPackage(specifier.package, declarationFiles); + } +} diff --git a/packages/type-utils/src/containsAllTypesByName.ts b/packages/type-utils/src/containsAllTypesByName.ts index 455938f4264..c8a70d75c42 100644 --- a/packages/type-utils/src/containsAllTypesByName.ts +++ b/packages/type-utils/src/containsAllTypesByName.ts @@ -1,4 +1,4 @@ -import { isTypeReference, isUnionOrIntersectionType } from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import { isTypeFlagSet } from './typeFlagUtils'; @@ -20,7 +20,7 @@ export function containsAllTypesByName( return !allowAny; } - if (isTypeReference(type)) { + if (tsutils.isTypeReference(type)) { type = type.target; } @@ -32,7 +32,7 @@ export function containsAllTypesByName( const predicate = (t: ts.Type): boolean => containsAllTypesByName(t, allowAny, allowedNames, matchAnyInstead); - if (isUnionOrIntersectionType(type)) { + if (tsutils.isUnionOrIntersectionType(type)) { return matchAnyInstead ? type.types.some(predicate) : type.types.every(predicate); diff --git a/packages/type-utils/src/getConstrainedTypeAtLocation.ts b/packages/type-utils/src/getConstrainedTypeAtLocation.ts index 50317b00e56..cbd332f98da 100644 --- a/packages/type-utils/src/getConstrainedTypeAtLocation.ts +++ b/packages/type-utils/src/getConstrainedTypeAtLocation.ts @@ -1,14 +1,20 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/typescript-estree'; import type * as ts from 'typescript'; /** * Resolves the given node's type. Will resolve to the type's generic constraint, if it has one. */ export function getConstrainedTypeAtLocation( - checker: ts.TypeChecker, - node: ts.Node, + services: ParserServicesWithTypeInformation, + node: TSESTree.Node, ): ts.Type { - const nodeType = checker.getTypeAtLocation(node); - const constrained = checker.getBaseConstraintOfType(nodeType); + const nodeType = services.getTypeAtLocation(node); + const constrained = services.program + .getTypeChecker() + .getBaseConstraintOfType(nodeType); return constrained ?? nodeType; } diff --git a/packages/type-utils/src/getContextualType.ts b/packages/type-utils/src/getContextualType.ts index 07515628265..e201874b03a 100644 --- a/packages/type-utils/src/getContextualType.ts +++ b/packages/type-utils/src/getContextualType.ts @@ -1,14 +1,3 @@ -import { - isBinaryExpression, - isCallExpression, - isIdentifier, - isJsxExpression, - isNewExpression, - isParameterDeclaration, - isPropertyAssignment, - isPropertyDeclaration, - isVariableDeclaration, -} from 'tsutils'; import * as ts from 'typescript'; /** @@ -25,23 +14,23 @@ export function getContextualType( return; } - if (isCallExpression(parent) || isNewExpression(parent)) { + if (ts.isCallExpression(parent) || ts.isNewExpression(parent)) { if (node === parent.expression) { // is the callee, so has no contextual type return; } } else if ( - isVariableDeclaration(parent) || - isPropertyDeclaration(parent) || - isParameterDeclaration(parent) + ts.isVariableDeclaration(parent) || + ts.isPropertyDeclaration(parent) || + ts.isParameter(parent) ) { return parent.type ? checker.getTypeFromTypeNode(parent.type) : undefined; - } else if (isJsxExpression(parent)) { + } else if (ts.isJsxExpression(parent)) { return checker.getContextualType(parent); - } else if (isPropertyAssignment(parent) && isIdentifier(node)) { + } else if (ts.isPropertyAssignment(parent) && ts.isIdentifier(node)) { return checker.getContextualType(node); } else if ( - isBinaryExpression(parent) && + ts.isBinaryExpression(parent) && parent.operatorToken.kind === ts.SyntaxKind.EqualsToken && parent.right === node ) { diff --git a/packages/type-utils/src/getDeclaration.ts b/packages/type-utils/src/getDeclaration.ts index d0c6c998d33..9e8d8b77024 100644 --- a/packages/type-utils/src/getDeclaration.ts +++ b/packages/type-utils/src/getDeclaration.ts @@ -1,13 +1,17 @@ +import type { + ParserServicesWithTypeInformation, + TSESTree, +} from '@typescript-eslint/typescript-estree'; import type * as ts from 'typescript'; /** * Gets the declaration for the given variable */ export function getDeclaration( - checker: ts.TypeChecker, - node: ts.Expression, + services: ParserServicesWithTypeInformation, + node: TSESTree.Node, ): ts.Declaration | null { - const symbol = checker.getSymbolAtLocation(node); + const symbol = services.getSymbolAtLocation(node); if (!symbol) { return null; } diff --git a/packages/type-utils/src/index.ts b/packages/type-utils/src/index.ts index dde032e1770..9fc499aa8f3 100644 --- a/packages/type-utils/src/index.ts +++ b/packages/type-utils/src/index.ts @@ -11,6 +11,7 @@ export * from './isUnsafeAssignment'; export * from './predicates'; export * from './propertyTypes'; export * from './requiresQuoting'; +export * from './TypeOrValueSpecifier'; export * from './typeFlagUtils'; export { getDecorators, diff --git a/packages/type-utils/src/isTypeReadonly.ts b/packages/type-utils/src/isTypeReadonly.ts index 7ba2b300089..8cfee5272b1 100644 --- a/packages/type-utils/src/isTypeReadonly.ts +++ b/packages/type-utils/src/isTypeReadonly.ts @@ -1,16 +1,15 @@ import { ESLintUtils } from '@typescript-eslint/utils'; -import { - isConditionalType, - isIntersectionType, - isObjectType, - isPropertyReadonlyInType, - isSymbolFlagSet, - isUnionType, - unionTypeParts, -} from 'tsutils'; +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; +import { getTypeArguments } from './getTypeArguments'; import { getTypeOfPropertyOfType } from './propertyTypes'; +import type { TypeOrValueSpecifier } from './TypeOrValueSpecifier'; +import { + typeMatchesSpecifier, + typeOrValueSpecifierSchema, +} from './TypeOrValueSpecifier'; const enum Readonlyness { /** the type cannot be handled by the function */ @@ -23,6 +22,7 @@ const enum Readonlyness { export interface ReadonlynessOptions { readonly treatMethodsAsReadonly?: boolean; + readonly allow?: TypeOrValueSpecifier[]; } export const readonlynessOptionsSchema = { @@ -32,11 +32,16 @@ export const readonlynessOptionsSchema = { treatMethodsAsReadonly: { type: 'boolean', }, + allow: { + type: 'array', + items: typeOrValueSpecifierSchema, + }, }, -}; +} satisfies JSONSchema4; export const readonlynessOptionsDefaults: ReadonlynessOptions = { treatMethodsAsReadonly: false, + allow: [], }; function hasSymbol(node: ts.Node): node is ts.Node & { symbol: ts.Symbol } { @@ -44,17 +49,16 @@ function hasSymbol(node: ts.Node): node is ts.Node & { symbol: ts.Symbol } { } function isTypeReadonlyArrayOrTuple( - checker: ts.TypeChecker, + program: ts.Program, type: ts.Type, options: ReadonlynessOptions, seenTypes: Set, ): Readonlyness { + const checker = program.getTypeChecker(); function checkTypeArguments(arrayType: ts.TypeReference): Readonlyness { const typeArguments = // getTypeArguments was only added in TS3.7 - checker.getTypeArguments - ? checker.getTypeArguments(arrayType) - : arrayType.typeArguments ?? []; + getTypeArguments(arrayType, checker); // this shouldn't happen in reality as: // - tuples require at least 1 type argument @@ -67,7 +71,7 @@ function isTypeReadonlyArrayOrTuple( if ( typeArguments.some( typeArg => - isTypeReadonlyRecurser(checker, typeArg, options, seenTypes) === + isTypeReadonlyRecurser(program, typeArg, options, seenTypes) === Readonlyness.Mutable, ) ) { @@ -82,6 +86,7 @@ function isTypeReadonlyArrayOrTuple( ESLintUtils.NullThrowsReasons.MissingToken('symbol', 'array type'), ); const escapedName = symbol.getEscapedName(); + // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison if (escapedName === 'Array') { return Readonlyness.Mutable; } @@ -101,11 +106,12 @@ function isTypeReadonlyArrayOrTuple( } function isTypeReadonlyObject( - checker: ts.TypeChecker, + program: ts.Program, type: ts.Type, options: ReadonlynessOptions, seenTypes: Set, ): Readonlyness { + const checker = program.getTypeChecker(); function checkIndexSignature(kind: ts.IndexKind): Readonlyness { const indexInfo = checker.getIndexInfoOfType(type, kind); if (indexInfo) { @@ -118,7 +124,7 @@ function isTypeReadonlyObject( } return isTypeReadonlyRecurser( - checker, + program, indexInfo.type, options, seenTypes, @@ -136,7 +142,7 @@ function isTypeReadonlyObject( if ( property.valueDeclaration !== undefined && hasSymbol(property.valueDeclaration) && - isSymbolFlagSet( + tsutils.isSymbolFlagSet( property.valueDeclaration.symbol, ts.SymbolFlags.Method, ) @@ -152,13 +158,19 @@ function isTypeReadonlyObject( if ( lastDeclaration !== undefined && hasSymbol(lastDeclaration) && - isSymbolFlagSet(lastDeclaration.symbol, ts.SymbolFlags.Method) + tsutils.isSymbolFlagSet(lastDeclaration.symbol, ts.SymbolFlags.Method) ) { continue; } } - if (isPropertyReadonlyInType(type, property.getEscapedName(), checker)) { + if ( + tsutils.isPropertyReadonlyInType( + type, + property.getEscapedName(), + checker, + ) + ) { continue; } @@ -192,7 +204,7 @@ function isTypeReadonlyObject( } if ( - isTypeReadonlyRecurser(checker, propertyType, options, seenTypes) === + isTypeReadonlyRecurser(program, propertyType, options, seenTypes) === Readonlyness.Mutable ) { return Readonlyness.Mutable; @@ -215,26 +227,37 @@ function isTypeReadonlyObject( // a helper function to ensure the seenTypes map is always passed down, except by the external caller function isTypeReadonlyRecurser( - checker: ts.TypeChecker, + program: ts.Program, type: ts.Type, options: ReadonlynessOptions, seenTypes: Set, -): Readonlyness.Readonly | Readonlyness.Mutable { +): Readonlyness.Mutable | Readonlyness.Readonly { + const checker = program.getTypeChecker(); seenTypes.add(type); - if (isUnionType(type)) { + if ( + options.allow?.some(specifier => + typeMatchesSpecifier(type, specifier, program), + ) + ) { + return Readonlyness.Readonly; + } + + if (tsutils.isUnionType(type)) { // all types in the union must be readonly - const result = unionTypeParts(type).every( - t => - seenTypes.has(t) || - isTypeReadonlyRecurser(checker, t, options, seenTypes) === - Readonlyness.Readonly, - ); + const result = tsutils + .unionTypeParts(type) + .every( + t => + seenTypes.has(t) || + isTypeReadonlyRecurser(program, t, options, seenTypes) === + Readonlyness.Readonly, + ); const readonlyness = result ? Readonlyness.Readonly : Readonlyness.Mutable; return readonlyness; } - if (isIntersectionType(type)) { + if (tsutils.isIntersectionType(type)) { // Special case for handling arrays/tuples (as readonly arrays/tuples always have mutable methods). if ( type.types.some(t => checker.isArrayType(t) || checker.isTupleType(t)) @@ -242,7 +265,7 @@ function isTypeReadonlyRecurser( const allReadonlyParts = type.types.every( t => seenTypes.has(t) || - isTypeReadonlyRecurser(checker, t, options, seenTypes) === + isTypeReadonlyRecurser(program, t, options, seenTypes) === Readonlyness.Readonly, ); return allReadonlyParts ? Readonlyness.Readonly : Readonlyness.Mutable; @@ -250,7 +273,7 @@ function isTypeReadonlyRecurser( // Normal case. const isReadonlyObject = isTypeReadonlyObject( - checker, + program, type, options, seenTypes, @@ -260,13 +283,13 @@ function isTypeReadonlyRecurser( } } - if (isConditionalType(type)) { + if (tsutils.isConditionalType(type)) { const result = [type.root.node.trueType, type.root.node.falseType] .map(checker.getTypeFromTypeNode) .every( t => seenTypes.has(t) || - isTypeReadonlyRecurser(checker, t, options, seenTypes) === + isTypeReadonlyRecurser(program, t, options, seenTypes) === Readonlyness.Readonly, ); @@ -276,7 +299,7 @@ function isTypeReadonlyRecurser( // all non-object, non-intersection types are readonly. // this should only be primitive types - if (!isObjectType(type)) { + if (!tsutils.isObjectType(type)) { return Readonlyness.Readonly; } @@ -289,7 +312,7 @@ function isTypeReadonlyRecurser( } const isReadonlyArray = isTypeReadonlyArrayOrTuple( - checker, + program, type, options, seenTypes, @@ -299,7 +322,7 @@ function isTypeReadonlyRecurser( } const isReadonlyObject = isTypeReadonlyObject( - checker, + program, type, options, seenTypes, @@ -317,12 +340,12 @@ function isTypeReadonlyRecurser( * Checks if the given type is readonly */ function isTypeReadonly( - checker: ts.TypeChecker, + program: ts.Program, type: ts.Type, options: ReadonlynessOptions = readonlynessOptionsDefaults, ): boolean { return ( - isTypeReadonlyRecurser(checker, type, options, new Set()) === + isTypeReadonlyRecurser(program, type, options, new Set()) === Readonlyness.Readonly ); } diff --git a/packages/type-utils/src/isUnsafeAssignment.ts b/packages/type-utils/src/isUnsafeAssignment.ts index f74220249ad..606fadfdd32 100644 --- a/packages/type-utils/src/isUnsafeAssignment.ts +++ b/packages/type-utils/src/isUnsafeAssignment.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/utils'; import { AST_NODE_TYPES } from '@typescript-eslint/utils'; -import { isTypeReference } from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import type * as ts from 'typescript'; import { isTypeAnyType, isTypeUnknownType } from './predicates'; @@ -32,7 +32,7 @@ export function isUnsafeAssignment( } } - if (isTypeReference(type) && isTypeReference(receiver)) { + if (tsutils.isTypeReference(type) && tsutils.isTypeReference(receiver)) { // TODO - figure out how to handle cases like this, // where the types are assignable, but not the same type /* @@ -57,7 +57,7 @@ export function isUnsafeAssignment( senderNode.callee.type === AST_NODE_TYPES.Identifier && senderNode.callee.name === 'Map' && senderNode.arguments.length === 0 && - senderNode.typeParameters == null + senderNode.typeArguments == null ) { // special case to handle `new Map()` // unfortunately Map's default empty constructor is typed to return `Map` :( diff --git a/packages/type-utils/src/predicates.ts b/packages/type-utils/src/predicates.ts index 72f59e4fc9d..f194bc9d92e 100644 --- a/packages/type-utils/src/predicates.ts +++ b/packages/type-utils/src/predicates.ts @@ -1,5 +1,5 @@ import debug from 'debug'; -import { unionTypeParts } from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import { getTypeArguments } from './getTypeArguments'; @@ -39,7 +39,7 @@ export function isTypeArrayTypeOrUnionOfArrayTypes( type: ts.Type, checker: ts.TypeChecker, ): boolean { - for (const t of unionTypeParts(type)) { + for (const t of tsutils.unionTypeParts(type)) { if (!checker.isArrayType(t)) { return false; } diff --git a/packages/type-utils/src/typeFlagUtils.ts b/packages/type-utils/src/typeFlagUtils.ts index aa71d702b19..dde3ca3c596 100644 --- a/packages/type-utils/src/typeFlagUtils.ts +++ b/packages/type-utils/src/typeFlagUtils.ts @@ -1,21 +1,28 @@ -import { unionTypeParts } from 'tsutils'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; +const ANY_OR_UNKNOWN = ts.TypeFlags.Any | ts.TypeFlags.Unknown; + /** - * Gets all of the type flags in a type, iterating through unions automatically + * Gets all of the type flags in a type, iterating through unions automatically. */ export function getTypeFlags(type: ts.Type): ts.TypeFlags { // @ts-expect-error Since typescript 5.0, this is invalid, but uses 0 as the default value of TypeFlags. let flags: ts.TypeFlags = 0; - for (const t of unionTypeParts(type)) { + for (const t of tsutils.unionTypeParts(type)) { flags |= t.flags; } return flags; } /** - * Checks if the given type is (or accepts) the given flags - * @param isReceiver true if the type is a receiving type (i.e. the type of a called function's parameter) + * @param flagsToCheck The composition of one or more `ts.TypeFlags`. + * @param isReceiver Whether the type is a receiving type (e.g. the type of a + * called function's parameter). + * @remarks + * Note that if the type is a union, this function will decompose it into the + * parts and get the flags of every union constituent. If this is not desired, + * use the `isTypeFlag` function from tsutils. */ export function isTypeFlagSet( type: ts.Type, @@ -24,7 +31,7 @@ export function isTypeFlagSet( ): boolean { const flags = getTypeFlags(type); - if (isReceiver && flags & (ts.TypeFlags.Any | ts.TypeFlags.Unknown)) { + if (isReceiver && flags & ANY_OR_UNKNOWN) { return true; } diff --git a/packages/type-utils/tests/TypeOrValueSpecifier.test.ts b/packages/type-utils/tests/TypeOrValueSpecifier.test.ts new file mode 100644 index 00000000000..a91358b4b17 --- /dev/null +++ b/packages/type-utils/tests/TypeOrValueSpecifier.test.ts @@ -0,0 +1,427 @@ +import { parseForESLint } from '@typescript-eslint/parser'; +import type { TSESTree } from '@typescript-eslint/utils'; +import Ajv from 'ajv'; +import path from 'path'; + +import type { TypeOrValueSpecifier } from '../src/TypeOrValueSpecifier'; +import { + typeMatchesSpecifier, + typeOrValueSpecifierSchema, +} from '../src/TypeOrValueSpecifier'; + +describe('TypeOrValueSpecifier', () => { + describe('Schema', () => { + const ajv = new Ajv(); + const validate = ajv.compile(typeOrValueSpecifierSchema); + + function runTestPositive(data: unknown): void { + expect(validate(data)).toBe(true); + } + + function runTestNegative(data: unknown): void { + expect(validate(data)).toBe(false); + } + + it.each([['MyType'], ['myValue'], ['any'], ['void'], ['never']])( + 'matches a simple string specifier %s', + runTestPositive, + ); + + it.each([ + [42], + [false], + [null], + [undefined], + [['MyType']], + [(): void => {}], + ])("doesn't match any non-string basic type: %s", runTestNegative); + + it.each([ + [{ from: 'file', name: 'MyType' }], + [{ from: 'file', name: ['MyType', 'myValue'] }], + [{ from: 'file', name: 'MyType', path: './filename.js' }], + [{ from: 'file', name: ['MyType', 'myValue'], path: './filename.js' }], + ])('matches a file specifier: %s', runTestPositive); + + it.each([ + [{ from: 'file', name: 42 }], + [{ from: 'file', name: ['MyType', 42] }], + [{ from: 'file', name: ['MyType', 'MyType'] }], + [{ from: 'file', name: [] }], + [{ from: 'file', path: './filename.js' }], + [{ from: 'file', name: 'MyType', path: 42 }], + [{ from: 'file', name: ['MyType', 'MyType'], path: './filename.js' }], + [{ from: 'file', name: [], path: './filename.js' }], + [ + { + from: 'file', + name: ['MyType', 'myValue'], + path: ['./filename.js', './another-file.js'], + }, + ], + [{ from: 'file', name: 'MyType', unrelatedProperty: '' }], + ])("doesn't match a malformed file specifier: %s", runTestNegative); + + it.each([ + [{ from: 'lib', name: 'MyType' }], + [{ from: 'lib', name: ['MyType', 'myValue'] }], + ])('matches a lib specifier: %s', runTestPositive); + + it.each([ + [{ from: 'lib', name: 42 }], + [{ from: 'lib', name: ['MyType', 42] }], + [{ from: 'lib', name: ['MyType', 'MyType'] }], + [{ from: 'lib', name: [] }], + [{ from: 'lib' }], + [{ from: 'lib', name: 'MyType', unrelatedProperty: '' }], + ])("doesn't match a malformed lib specifier: %s", runTestNegative); + + it.each([ + [{ from: 'package', name: 'MyType', package: 'jquery' }], + [ + { + from: 'package', + name: ['MyType', 'myValue'], + package: 'jquery', + }, + ], + ])('matches a package specifier: %s', runTestPositive); + + it.each([ + [{ from: 'package', name: 42, package: 'jquery' }], + [{ from: 'package', name: ['MyType', 42], package: 'jquery' }], + [ + { + from: 'package', + name: ['MyType', 'MyType'], + package: 'jquery', + }, + ], + [{ from: 'package', name: [], package: 'jquery' }], + [{ from: 'package', name: 'MyType' }], + [{ from: 'package', package: 'jquery' }], + [{ from: 'package', name: 'MyType', package: 42 }], + [{ from: [], name: 'MyType' }], + [{ from: ['file'], name: 'MyType' }], + [{ from: ['lib'], name: 'MyType' }], + [{ from: ['package'], name: 'MyType' }], + [ + { + from: 'package', + name: ['MyType', 'myValue'], + package: ['jquery', './another-file.js'], + }, + ], + [ + { + from: 'package', + name: 'MyType', + package: 'jquery', + unrelatedProperty: '', + }, + ], + ])("doesn't match a malformed package specifier: %s", runTestNegative); + }); + + describe('typeMatchesSpecifier', () => { + function runTests( + code: string, + specifier: TypeOrValueSpecifier, + expected: boolean, + ): void { + const rootDir = path.join(__dirname, 'fixtures'); + const { ast, services } = parseForESLint(code, { + project: './tsconfig.json', + filePath: path.join(rootDir, 'file.ts'), + tsconfigRootDir: rootDir, + }); + const type = services + .program!.getTypeChecker() + .getTypeAtLocation( + services.esTreeNodeToTSNodeMap.get( + (ast.body[ast.body.length - 1] as TSESTree.TSTypeAliasDeclaration) + .id, + ), + ); + expect(typeMatchesSpecifier(type, specifier, services.program!)).toBe( + expected, + ); + } + + function runTestPositive( + code: string, + specifier: TypeOrValueSpecifier, + ): void { + runTests(code, specifier, true); + } + + function runTestNegative( + code: string, + specifier: TypeOrValueSpecifier, + ): void { + runTests(code, specifier, false); + } + + it.each<[string, TypeOrValueSpecifier]>([ + ['interface Foo {prop: string}; type Test = Foo;', 'Foo'], + ['type Test = RegExp;', 'RegExp'], + ])('matches a matching universal string specifier', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + ['interface Foo {prop: string}; type Test = Foo;', 'Bar'], + ['interface Foo {prop: string}; type Test = Foo;', 'RegExp'], + ['type Test = RegExp;', 'Foo'], + ['type Test = RegExp;', 'BigInt'], + ])( + "doesn't match a mismatched universal string specifier", + runTestNegative, + ); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'file', name: 'Foo' }, + ], + [ + 'type Foo = {prop: string}; type Test = Foo;', + { from: 'file', name: 'Foo' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'file', name: ['Foo', 'Bar'] }, + ], + [ + 'type Foo = {prop: string}; type Test = Foo;', + { from: 'file', name: ['Foo', 'Bar'] }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'file', name: 'Foo', path: 'file.ts' }, + ], + [ + 'type Foo = {prop: string}; type Test = Foo;', + { from: 'file', name: 'Foo', path: 'file.ts' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { + from: 'file', + name: 'Foo', + path: './////file.ts', + }, + ], + [ + 'type Foo = {prop: string}; type Test = Foo;', + { + from: 'file', + name: 'Foo', + path: './////file.ts', + }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { + from: 'file', + name: ['Foo', 'Bar'], + path: 'file.ts', + }, + ], + [ + 'type Foo = {prop: string}; type Test = Foo;', + { + from: 'file', + name: ['Foo', 'Bar'], + path: 'file.ts', + }, + ], + ])('matches a matching file specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'file', name: 'Bar' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'file', name: ['Bar', 'Baz'] }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'file', name: 'Foo', path: 'wrong-file.ts' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { + from: 'file', + name: ['Foo', 'Bar'], + path: 'wrong-file.ts', + }, + ], + ])("doesn't match a mismatched file specifier: %s", runTestNegative); + + it.each<[string, TypeOrValueSpecifier]>([ + ['type Test = RegExp;', { from: 'lib', name: 'RegExp' }], + ['type Test = RegExp;', { from: 'lib', name: ['RegExp', 'BigInt'] }], + ])('matches a matching lib specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + ['type Test = RegExp;', { from: 'lib', name: 'BigInt' }], + ['type Test = RegExp;', { from: 'lib', name: ['BigInt', 'Date'] }], + ])("doesn't match a mismatched lib specifier: %s", runTestNegative); + + it.each<[string, TypeOrValueSpecifier]>([ + ['type Test = string;', { from: 'lib', name: 'string' }], + ['type Test = string;', { from: 'lib', name: ['string', 'number'] }], + ])('matches a matching intrinsic type specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + ['type Test = string;', { from: 'lib', name: 'number' }], + ['type Test = string;', { from: 'lib', name: ['number', 'boolean'] }], + ])( + "doesn't match a mismatched intrinsic type specifier: %s", + runTestNegative, + ); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'import type {Node} from "typescript"; type Test = Node;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], + [ + 'import type {Node} from "typescript"; type Test = Node;', + { from: 'package', name: ['Node', 'Symbol'], package: 'typescript' }, + ], + [ + 'import {Node} from "typescript"; type Test = Node;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], + [ + 'import {Node} from "typescript"; type Test = Node;', + { from: 'package', name: ['Node', 'Symbol'], package: 'typescript' }, + ], + [ + 'import * as ts from "typescript"; type Test = ts.Node;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], + [ + 'import * as ts from "typescript"; type Test = ts.Node;', + { from: 'package', name: ['Node', 'Symbol'], package: 'typescript' }, + ], + [ + 'import type * as ts from "typescript"; type Test = ts.Node;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], + [ + 'import type * as ts from "typescript"; type Test = ts.Node;', + { from: 'package', name: ['Node', 'Symbol'], package: 'typescript' }, + ], + [ + 'import type {Node as TsNode} from "typescript"; type Test = TsNode;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], + [ + 'import type {Node as TsNode} from "typescript"; type Test = TsNode;', + { from: 'package', name: ['Node', 'Symbol'], package: 'typescript' }, + ], + // The following type is available from the @types/semver package. + [ + 'import {SemVer} from "semver"; type Test = SemVer;', + { from: 'package', name: 'SemVer', package: 'semver' }, + ], + // The following type is available from the scoped @types/babel__code-frame package. + [ + 'import {BabelCodeFrameOptions} from "@babel/code-frame"; type Test = BabelCodeFrameOptions;', + { + from: 'package', + name: 'BabelCodeFrameOptions', + package: '@babel/code-frame', + }, + ], + ])('matches a matching package specifier: %s', runTestPositive); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'import type {Node} from "typescript"; type Test = Node;', + { from: 'package', name: 'Symbol', package: 'typescript' }, + ], + [ + 'import type {Node} from "typescript"; type Test = Node;', + { from: 'package', name: ['Symbol', 'Checker'], package: 'typescript' }, + ], + [ + 'import type {Node} from "typescript"; type Test = Node;', + { from: 'package', name: 'Node', package: 'other-package' }, + ], + [ + 'import type {Node} from "typescript"; type Test = Node;', + { from: 'package', name: ['Node', 'Symbol'], package: 'other-package' }, + ], + [ + 'interface Node {prop: string}; type Test = Node;', + { from: 'package', name: 'Node', package: 'typescript' }, + ], + [ + 'import type {Node as TsNode} from "typescript"; type Test = TsNode;', + { from: 'package', name: 'TsNode', package: 'typescript' }, + ], + ])("doesn't match a mismatched lib specifier: %s", runTestNegative); + + it.each<[string, TypeOrValueSpecifier]>([ + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'lib', name: 'Foo' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'lib', name: ['Foo', 'Bar'] }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'package', name: 'Foo', package: 'foo-package' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'package', name: ['Foo', 'Bar'], package: 'foo-package' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { from: 'package', name: 'Foo', package: 'foo-package' }, + ], + [ + 'interface Foo {prop: string}; type Test = Foo;', + { + from: 'package', + name: ['Foo', 'Bar'], + package: 'foo-package', + }, + ], + ['type Test = RegExp;', { from: 'file', name: 'RegExp' }], + ['type Test = RegExp;', { from: 'file', name: ['RegExp', 'BigInt'] }], + [ + 'type Test = RegExp;', + { from: 'file', name: 'RegExp', path: 'file.ts' }, + ], + [ + 'type Test = RegExp;', + { + from: 'file', + name: ['RegExp', 'BigInt'], + path: 'file.ts', + }, + ], + [ + 'type Test = RegExp;', + { from: 'package', name: 'RegExp', package: 'foo-package' }, + ], + [ + 'type Test = RegExp;', + { from: 'package', name: ['RegExp', 'BigInt'], package: 'foo-package' }, + ], + ])("doesn't match a mismatched specifier type: %s", runTestNegative); + + it.each<[string, TypeOrValueSpecifier]>([ + ['type Test = Foo;', { from: 'lib', name: 'Foo' }], + ['type Test = Foo;', { from: 'lib', name: ['Foo', 'number'] }], + ])("doesn't match an error type: %s", runTestNegative); + }); +}); diff --git a/packages/type-utils/tests/fixtures/tsconfig.json b/packages/type-utils/tests/fixtures/tsconfig.json index 65b63294fc1..7e9126b848c 100644 --- a/packages/type-utils/tests/fixtures/tsconfig.json +++ b/packages/type-utils/tests/fixtures/tsconfig.json @@ -8,7 +8,5 @@ "lib": ["es2015", "es2017", "esnext"], "experimentalDecorators": true }, - "include": [ - "file.ts" - ] + "include": ["file.ts"] } diff --git a/packages/type-utils/tests/isTypeReadonly.test.ts b/packages/type-utils/tests/isTypeReadonly.test.ts index 0b171dc12a2..2adfaaec7aa 100644 --- a/packages/type-utils/tests/isTypeReadonly.test.ts +++ b/packages/type-utils/tests/isTypeReadonly.test.ts @@ -7,6 +7,7 @@ import { isTypeReadonly, type ReadonlynessOptions, } from '../src/isTypeReadonly'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; describe('isTypeReadonly', () => { const rootDir = path.join(__dirname, 'fixtures'); @@ -14,22 +15,23 @@ describe('isTypeReadonly', () => { describe('TSTypeAliasDeclaration ', () => { function getType(code: string): { type: ts.Type; - checker: ts.TypeChecker; + program: ts.Program; } { const { ast, services } = parseForESLint(code, { project: './tsconfig.json', filePath: path.join(rootDir, 'file.ts'), tsconfigRootDir: rootDir, }); - const checker = services.program.getTypeChecker(); + expectToHaveParserServices(services); + const program = services.program; const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; const declaration = ast.body[0] as TSESTree.TSTypeAliasDeclaration; return { - type: checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(declaration.id), - ), - checker, + type: program + .getTypeChecker() + .getTypeAtLocation(esTreeNodeToTSNodeMap.get(declaration.id)), + program, }; } @@ -38,9 +40,9 @@ describe('isTypeReadonly', () => { options: ReadonlynessOptions | undefined, expected: boolean, ): void { - const { type, checker } = getType(code); + const { type, program } = getType(code); - const result = isTypeReadonly(checker, type, options); + const result = isTypeReadonly(program, type, options); expect(result).toBe(expected); } @@ -308,5 +310,52 @@ describe('isTypeReadonly', () => { ])('handles non fully readonly sets and maps', runTests); }); }); + + describe('allowlist', () => { + const options: ReadonlynessOptions = { + allow: [ + { + from: 'lib', + name: 'RegExp', + }, + { + from: 'file', + name: 'Foo', + }, + ], + }; + + function runTestIsReadonly(code: string): void { + runTestForAliasDeclaration(code, options, true); + } + + function runTestIsNotReadonly(code: string): void { + runTestForAliasDeclaration(code, options, false); + } + + describe('is readonly', () => { + it.each([ + [ + 'interface Foo {readonly prop: RegExp}; type Test = (arg: Foo) => void;', + ], + [ + 'interface Foo {prop: RegExp}; type Test = (arg: Readonly) => void;', + ], + ['interface Foo {prop: string}; type Test = (arg: Foo) => void;'], + ])('correctly marks allowlisted types as readonly', runTestIsReadonly); + }); + + describe('is not readonly', () => { + it.each([ + [ + 'interface Bar {prop: RegExp}; type Test = (arg: Readonly) => void;', + ], + ['interface Bar {prop: string}; type Test = (arg: Bar) => void;'], + ])( + 'correctly marks allowlisted types as readonly', + runTestIsNotReadonly, + ); + }); + }); }); }); diff --git a/packages/type-utils/tests/isUnsafeAssignment.test.ts b/packages/type-utils/tests/isUnsafeAssignment.test.ts index e49e25c8655..55e2195f93a 100644 --- a/packages/type-utils/tests/isUnsafeAssignment.test.ts +++ b/packages/type-utils/tests/isUnsafeAssignment.test.ts @@ -4,6 +4,7 @@ import path from 'path'; import type * as ts from 'typescript'; import { isUnsafeAssignment } from '../src/isUnsafeAssignment'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; describe('isUnsafeAssignment', () => { const rootDir = path.join(__dirname, 'fixtures'); @@ -19,18 +20,14 @@ describe('isUnsafeAssignment', () => { filePath: path.join(rootDir, 'file.ts'), tsconfigRootDir: rootDir, }); + expectToHaveParserServices(services); const checker = services.program.getTypeChecker(); - const esTreeNodeToTSNodeMap = services.esTreeNodeToTSNodeMap; const declaration = ast.body[0] as TSESTree.VariableDeclaration; const declarator = declaration.declarations[0]; return { - receiver: checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(declarator.id), - ), - sender: checker.getTypeAtLocation( - esTreeNodeToTSNodeMap.get(declarator.init!), - ), + receiver: services.getTypeAtLocation(declarator.id), + sender: services.getTypeAtLocation(declarator.init!), senderNode: declarator.init!, checker, }; diff --git a/packages/type-utils/tests/test-utils/expectToHaveParserServices.ts b/packages/type-utils/tests/test-utils/expectToHaveParserServices.ts new file mode 100644 index 00000000000..6ff95a7076b --- /dev/null +++ b/packages/type-utils/tests/test-utils/expectToHaveParserServices.ts @@ -0,0 +1,12 @@ +import type { + ParserServices, + ParserServicesWithTypeInformation, +} from '@typescript-eslint/typescript-estree'; + +export function expectToHaveParserServices( + services: ParserServices | null | undefined, +): asserts services is ParserServicesWithTypeInformation { + expect(services?.program).toBeDefined(); + expect(services?.esTreeNodeToTSNodeMap).toBeDefined(); + expect(services?.tsNodeToESTreeNodeMap).toBeDefined(); +} diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index bea02db0635..c71751de086 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,198 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** add config that disables type-aware linting ([#6470](https://github.com/typescript-eslint/typescript-eslint/issues/6470)) ([3b063cf](https://github.com/typescript-eslint/typescript-eslint/commit/3b063cfadce50985f8ec6d8f44f5b1cbd5c1ea57)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove moduleResolver API ([#6609](https://github.com/typescript-eslint/typescript-eslint/issues/6609)) ([f0f45a9](https://github.com/typescript-eslint/typescript-eslint/commit/f0f45a9d35453c3ec601df770092d236c72d447b)) + + +### BREAKING CHANGES + +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/types + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/types + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/types + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/types diff --git a/packages/types/package.json b/packages/types/package.json index 22820c6ba3d..180e8dc4d3b 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,22 +1,25 @@ { "name": "@typescript-eslint/types", - "version": "5.56.0", + "version": "6.0.0", "description": "Types for the TypeScript-ESTree AST spec", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", - "_ts3.4", + "_ts4.3", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,22 +29,25 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { - "prebuild": "yarn tsx ./tools/copy-ast-spec.ts", + "copy-ast-spec": "tsx ./tools/copy-ast-spec.ts", "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", + "postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf src/generated && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf src/generated && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "generate:lib": "yarn tsx ../scope-manager/tools/generate-lib.ts", + "generate-lib": "nx run scope-manager:generate-lib", "lint": "nx lint", "typecheck": "tsc -p tsconfig.json --noEmit" }, "nx": { "targets": { - "prebuild": { + "copy-ast-spec": { "dependsOn": [ { "target": "build", @@ -59,25 +65,25 @@ "projects": "dependencies" }, { - "target": "prebuild", + "target": "copy-ast-spec", "projects": "self" } ] } } }, + "devDependencies": { + "typescript": "*" + }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } - }, - "devDependencies": { - "typescript": "*" } } diff --git a/packages/types/project.json b/packages/types/project.json index 74fee293f18..d5e33a48595 100644 --- a/packages/types/project.json +++ b/packages/types/project.json @@ -5,10 +5,11 @@ "implicitDependencies": ["ast-spec"], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/types/**/*.ts"] + "lintFilePatterns": ["packages/types/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index c1c60650ffd..bdd8348d24e 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -4,89 +4,89 @@ // npx nx generate-lib @typescript-eslint/scope-manager type Lib = + | 'decorators.legacy' + | 'decorators' + | 'dom.iterable' + | 'dom' | 'es5' | 'es6' - | 'es2015' | 'es7' - | 'es2016' - | 'es2017' - | 'es2018' - | 'es2019' - | 'es2020' - | 'es2021' - | 'es2022' - | 'es2023' - | 'esnext' - | 'dom' - | 'dom.iterable' - | 'webworker' - | 'webworker.importscripts' - | 'webworker.iterable' - | 'scripthost' - | 'es2015.core' | 'es2015.collection' + | 'es2015.core' | 'es2015.generator' | 'es2015.iterable' | 'es2015.promise' | 'es2015.proxy' | 'es2015.reflect' - | 'es2015.symbol' | 'es2015.symbol.wellknown' + | 'es2015.symbol' + | 'es2015' | 'es2016.array.include' + | 'es2016.full' + | 'es2016' + | 'es2017.full' + | 'es2017.intl' | 'es2017.object' | 'es2017.sharedmemory' | 'es2017.string' - | 'es2017.intl' | 'es2017.typedarrays' + | 'es2017' | 'es2018.asyncgenerator' | 'es2018.asynciterable' + | 'es2018.full' | 'es2018.intl' | 'es2018.promise' | 'es2018.regexp' + | 'es2018' | 'es2019.array' + | 'es2019.full' + | 'es2019.intl' | 'es2019.object' | 'es2019.string' | 'es2019.symbol' - | 'es2019.intl' + | 'es2019' | 'es2020.bigint' | 'es2020.date' + | 'es2020.full' + | 'es2020.intl' + | 'es2020.number' | 'es2020.promise' | 'es2020.sharedmemory' | 'es2020.string' | 'es2020.symbol.wellknown' - | 'es2020.intl' - | 'es2020.number' + | 'es2020' + | 'es2021.full' + | 'es2021.intl' | 'es2021.promise' | 'es2021.string' | 'es2021.weakref' - | 'es2021.intl' + | 'es2021' | 'es2022.array' | 'es2022.error' + | 'es2022.full' | 'es2022.intl' | 'es2022.object' + | 'es2022.regexp' | 'es2022.sharedmemory' | 'es2022.string' - | 'es2022.regexp' + | 'es2022' | 'es2023.array' + | 'es2023.full' + | 'es2023' | 'esnext.array' - | 'esnext.symbol' | 'esnext.asynciterable' - | 'esnext.intl' | 'esnext.bigint' - | 'esnext.string' + | 'esnext.full' + | 'esnext.intl' | 'esnext.promise' + | 'esnext.string' + | 'esnext.symbol' | 'esnext.weakref' - | 'decorators' - | 'decorators.legacy' - | 'es2016.full' - | 'es2017.full' - | 'es2018.full' - | 'es2019.full' - | 'es2020.full' - | 'es2021.full' - | 'es2022.full' - | 'es2023.full' - | 'esnext.full' - | 'lib'; + | 'esnext' + | 'lib' + | 'scripthost' + | 'webworker.importscripts' + | 'webworker.iterable' + | 'webworker'; export { Lib }; diff --git a/packages/types/src/parser-options.ts b/packages/types/src/parser-options.ts index f77b601e0d0..5389efba75e 100644 --- a/packages/types/src/parser-options.ts +++ b/packages/types/src/parser-options.ts @@ -2,7 +2,7 @@ import type { Program } from 'typescript'; import type { Lib } from './lib'; -type DebugLevel = boolean | ('typescript-eslint' | 'eslint' | 'typescript')[]; +type DebugLevel = ('eslint' | 'typescript-eslint' | 'typescript')[] | boolean; type CacheDurationSeconds = number | 'Infinity'; type EcmaVersion = @@ -25,7 +25,7 @@ type EcmaVersion = | 2021 | 2022; -type SourceType = 'script' | 'module'; +type SourceType = 'module' | 'script'; interface ParserOptions { ecmaFeatures?: { @@ -47,19 +47,19 @@ interface ParserOptions { debugLevel?: DebugLevel; errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; errorOnUnknownASTType?: boolean; + EXPERIMENTAL_useProjectService?: boolean; // purposely undocumented for now EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; // purposely undocumented for now extraFileExtensions?: string[]; filePath?: string; loc?: boolean; - program?: Program; - project?: string | string[] | true; - projectFolderIgnoreList?: (string | RegExp)[]; + program?: Program | null; + project?: string[] | string | true | null; + projectFolderIgnoreList?: (RegExp | string)[]; range?: boolean; sourceType?: SourceType; tokens?: boolean; tsconfigRootDir?: string; warnOnUnsupportedTypeScriptVersion?: boolean; - moduleResolver?: string; cacheLifetime?: { glob?: CacheDurationSeconds; }; diff --git a/packages/types/src/ts-estree.ts b/packages/types/src/ts-estree.ts index 7ce3d0a674a..acfd90fb9a3 100644 --- a/packages/types/src/ts-estree.ts +++ b/packages/types/src/ts-estree.ts @@ -2,20 +2,16 @@ import type * as TSESTree from './generated/ast-spec'; // augment to add the parent property, which isn't part of the spec declare module './generated/ast-spec' { - interface BaseNode { - parent?: TSESTree.Node; - } - - // TODO - make this change as a breaking change - /* interface BaseNode { parent: TSESTree.Node; } interface Program { - parent?: undefined; + /** + * @remarks This never-used property exists only as a convenience for code that tries to access node parents repeatedly. + */ + parent?: never; } - */ } export * as TSESTree from './generated/ast-spec'; diff --git a/packages/types/tools/copy-ast-spec.ts b/packages/types/tools/copy-ast-spec.ts index 7e4eff420c9..dc2227ae48b 100644 --- a/packages/types/tools/copy-ast-spec.ts +++ b/packages/types/tools/copy-ast-spec.ts @@ -9,7 +9,7 @@ const writeFile = promisify(fs.writeFile); // the promisify util will eat the stderr logs async function execAsync( command: string, - args: ReadonlyArray, + args: readonly string[], options: childProcess.SpawnOptions, ): Promise { return new Promise((resolve, reject) => { @@ -67,8 +67,10 @@ async function copyFile( } async function main(): Promise { - // ensure the package is built - await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH }); + if (process.env.SKIP_AST_SPEC_REBUILD) { + // ensure the package is built + await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH }); + } await Promise.all([ copyFile('dist', 'ast-spec.ts', code => diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 852b1fc1ac7..219c4cba387 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,240 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* **ast-spec:** remove more invalid properties ([#6243](https://github.com/typescript-eslint/typescript-eslint/issues/6243)) ([aa20f63](https://github.com/typescript-eslint/typescript-eslint/commit/aa20f63e8f345767bb4693c9d20f751e6998bd65)) +* bumped ts-api-utils to 0.0.39 ([#6497](https://github.com/typescript-eslint/typescript-eslint/issues/6497)) ([217c710](https://github.com/typescript-eslint/typescript-eslint/commit/217c710d99445994b9c8db7b9bee9b9cc63bc4cb)) +* fix illegal decorator check ([#6723](https://github.com/typescript-eslint/typescript-eslint/issues/6723)) ([c456f8c](https://github.com/typescript-eslint/typescript-eslint/commit/c456f8cdef5a931c631bfbcfc84d8a25caaf019f)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* replace tsutils with ts-api-tools ([#6428](https://github.com/typescript-eslint/typescript-eslint/issues/6428)) ([79327b4](https://github.com/typescript-eslint/typescript-eslint/commit/79327b4999999cde3003901b40527af002c4906a)) +* **type-utils:** file variant of TypeOrValueSpecifier uses canonical filenames instead of lowercasing ([#6781](https://github.com/typescript-eslint/typescript-eslint/issues/6781)) ([5095d05](https://github.com/typescript-eslint/typescript-eslint/commit/5095d05ac97320e7e50decef58279b01f2bfbd18)) +* **type-utils:** treat intrinsic types as if they are from lib and never match error types ([#6869](https://github.com/typescript-eslint/typescript-eslint/issues/6869)) ([ecb57de](https://github.com/typescript-eslint/typescript-eslint/commit/ecb57de5eb50511bed163f6e1b27e31b8577344e)) +* **typescript-estree:** account for namespace nesting in AST conversion ([#6272](https://github.com/typescript-eslint/typescript-eslint/issues/6272)) ([09e3877](https://github.com/typescript-eslint/typescript-eslint/commit/09e38776c63fea3328f71df36644ee11dd137cc1)) +* **typescript-estree:** allow writing to deprecated node properties ([#6670](https://github.com/typescript-eslint/typescript-eslint/issues/6670)) ([6652ebe](https://github.com/typescript-eslint/typescript-eslint/commit/6652ebea3e338f05a377f6f124d20520a840b1d5)) +* **typescript-estree:** fix error handling on `ImportExpression` ([#6587](https://github.com/typescript-eslint/typescript-eslint/issues/6587)) ([e8cdd5c](https://github.com/typescript-eslint/typescript-eslint/commit/e8cdd5ce48fa0a2f6f93e6b3ed7c337d042ab45d)) +* **typescript-estree:** forbid `override` on non-constructor function/methods ([#6729](https://github.com/typescript-eslint/typescript-eslint/issues/6729)) ([2f3638f](https://github.com/typescript-eslint/typescript-eslint/commit/2f3638fb00745429d6392a8e6492e83f853e92db)) +* **typescript-estree:** wrap import = declaration in an export node ([#5885](https://github.com/typescript-eslint/typescript-eslint/issues/5885)) ([1c3f470](https://github.com/typescript-eslint/typescript-eslint/commit/1c3f470da75bf63526efbf5b45615772e562dcb5)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* bump minimum supported TS version to 4.2.4 ([#5915](https://github.com/typescript-eslint/typescript-eslint/issues/5915)) ([a8e71d5](https://github.com/typescript-eslint/typescript-eslint/commit/a8e71d52169f32ab9e836ec96d980ba52deffe12)) +* bump ts-api-utils to v0.0.21 ([#6459](https://github.com/typescript-eslint/typescript-eslint/issues/6459)) ([3915661](https://github.com/typescript-eslint/typescript-eslint/commit/391566172dbc6013be79952fc68a588bf653fa8d)) +* bump ts-api-utils to v0.0.22 ([#6472](https://github.com/typescript-eslint/typescript-eslint/issues/6472)) ([b88cd23](https://github.com/typescript-eslint/typescript-eslint/commit/b88cd2332921efcca7ec5f4176f19779346d963b)) +* create TSTypeQuery node when TSImportType has isTypeOf ([#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076)) ([2b69b65](https://github.com/typescript-eslint/typescript-eslint/commit/2b69b659d87b58468e413801d31086ae0eeafff4)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) +* **eslint-plugin:** add config that disables type-aware linting ([#6470](https://github.com/typescript-eslint/typescript-eslint/issues/6470)) ([3b063cf](https://github.com/typescript-eslint/typescript-eslint/commit/3b063cfadce50985f8ec6d8f44f5b1cbd5c1ea57)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* **eslint-plugin:** final final config changes for v6 ([#7157](https://github.com/typescript-eslint/typescript-eslint/issues/7157)) ([e35c5c1](https://github.com/typescript-eslint/typescript-eslint/commit/e35c5c1c39f3d76b916ad1c1ac2c7bf05b379193)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* improve error location ([#6556](https://github.com/typescript-eslint/typescript-eslint/issues/6556)) ([355adf0](https://github.com/typescript-eslint/typescript-eslint/commit/355adf0b5dcc1b4f5c360722acc1ba8b6f4e4117)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove moduleResolver API ([#6609](https://github.com/typescript-eslint/typescript-eslint/issues/6609)) ([f0f45a9](https://github.com/typescript-eslint/typescript-eslint/commit/f0f45a9d35453c3ec601df770092d236c72d447b)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration ([#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863)) ([844875c](https://github.com/typescript-eslint/typescript-eslint/commit/844875cbe933195ff25ba218f82ede3ebde9a0a0)) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) +* **typescript-estree:** added allowInvalidAST option to not throw on invalid tokens ([#6247](https://github.com/typescript-eslint/typescript-eslint/issues/6247)) ([a3b177d](https://github.com/typescript-eslint/typescript-eslint/commit/a3b177d59adaf8ea76b205befc8b12d86447f1fb)) +* **typescript-estree:** allow providing code as a ts.SourceFile ([#5892](https://github.com/typescript-eslint/typescript-eslint/issues/5892)) ([af41b7f](https://github.com/typescript-eslint/typescript-eslint/commit/af41b7fa7b9b8f3023fdabd40846598d5d4d4f61)) +* **typescript-estree:** check for illegal decorators on function declarations ([#6590](https://github.com/typescript-eslint/typescript-eslint/issues/6590)) ([1b39cfd](https://github.com/typescript-eslint/typescript-eslint/commit/1b39cfd307955deb8e407cf8dd3a6ca1ed1b8df6)) +* **typescript-estree:** check modifiers on every node ([#6615](https://github.com/typescript-eslint/typescript-eslint/issues/6615)) ([62d6230](https://github.com/typescript-eslint/typescript-eslint/commit/62d62304e16b553274a80d8ab2653543a22f2391)) +* **typescript-estree:** deprecate createDefaultProgram ([#5890](https://github.com/typescript-eslint/typescript-eslint/issues/5890)) ([426d6b6](https://github.com/typescript-eslint/typescript-eslint/commit/426d6b647e6df3e312d1cef3e28dadaef6675fd3)) +* **typescript-estree:** forbid members in Mapped Type ([#6802](https://github.com/typescript-eslint/typescript-eslint/issues/6802)) ([b93458f](https://github.com/typescript-eslint/typescript-eslint/commit/b93458f9dfe36409d3a736a081ab69ba749caf24)) +* **typescript-estree:** remove optionality from AST boolean properties ([#6274](https://github.com/typescript-eslint/typescript-eslint/issues/6274)) ([df131e2](https://github.com/typescript-eslint/typescript-eslint/commit/df131e258c93e5714c88c0373cfeb2e1e75afc75)) +* **typescript-estree:** remove parseWithNodeMaps ([#7120](https://github.com/typescript-eslint/typescript-eslint/issues/7120)) ([e2a0a76](https://github.com/typescript-eslint/typescript-eslint/commit/e2a0a768d18a6aed5046946a2b57b219a54dcf3e)) +* **typescript-estree:** strict class heritage clauses check ([#6576](https://github.com/typescript-eslint/typescript-eslint/issues/6576)) ([530185b](https://github.com/typescript-eslint/typescript-eslint/commit/530185bd7e62b05adc673d1f96257dd14bb4d9dc)) +* **typescript-estree:** throw errors for object methods without function bodies ([#6589](https://github.com/typescript-eslint/typescript-eslint/issues/6589)) ([1d78576](https://github.com/typescript-eslint/typescript-eslint/commit/1d78576d41323e35c2d2a2ecc92f6ee76ed61d57)) +* **typescript-estree:** throw errors on interface with implements ([#6551](https://github.com/typescript-eslint/typescript-eslint/issues/6551)) ([67e05c8](https://github.com/typescript-eslint/typescript-eslint/commit/67e05c8f0381ba7065a0257d6038f0a50a3b9888)) +* **typescript-estree:** throw errors when abstract property has initializer ([#6613](https://github.com/typescript-eslint/typescript-eslint/issues/6613)) ([dcdbc76](https://github.com/typescript-eslint/typescript-eslint/commit/dcdbc76d5418a383968d15e32d2eba7a9d2d7e79)) +* **typescript-estree:** warn on deprecated AST property accesses ([#6525](https://github.com/typescript-eslint/typescript-eslint/issues/6525)) ([79c058d](https://github.com/typescript-eslint/typescript-eslint/commit/79c058d69f723ed18a3a7631370009359510d128)) + + +### BREAKING CHANGES + +* drops support for node v17 +* Bumps the minimum supported range and removes handling for old versions +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/typescript-estree + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/README.md b/packages/typescript-estree/README.md index 4ce7f1e7cf4..c98838dad40 100644 --- a/packages/typescript-estree/README.md +++ b/packages/typescript-estree/README.md @@ -1,10 +1,14 @@ # `@typescript-eslint/typescript-estree` +> A parser that produces an ESTree-compatible AST for TypeScript code. + [![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/typescript-estree.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) [![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/typescript-estree.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) ## Contributing -👉 See **https://typescript-eslint.io/architecture/typescript-estree** for documentation on this package. +👉 See **https://typescript-eslint.io/packages/typescript-estree** for documentation on this package. > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/typescript-estree/jest.config.js b/packages/typescript-estree/jest.config.js index 43f847a6fbf..c7916ca935e 100644 --- a/packages/typescript-estree/jest.config.js +++ b/packages/typescript-estree/jest.config.js @@ -1,11 +1,11 @@ 'use strict'; - // @ts-check + /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), testRegex: [ - './tests/lib/.*\\.ts$', + './tests/lib/.*\\.test\\.ts$', './tests/ast-alignment/spec\\.ts$', './tests/[^/]+\\.test\\.ts$', ], diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index f5a6f7222c4..80c68ff86f3 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,17 +1,27 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "5.56.0", + "version": "6.0.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", - "main": "dist/index.js", - "types": "dist/index.d.ts", "files": [ "dist", - "_ts3.4", + "_ts4.3", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json", + "./use-at-your-own-risk": { + "types": "./dist/use-at-your-own-risk.d.ts", + "default": "./dist/use-at-your-own-risk.js" + } + }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "repository": { "type": "git", @@ -33,32 +43,26 @@ ], "scripts": { "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", + "postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", - "test": "jest --coverage", + "test": "jest --coverage --runInBand --verbose", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "devDependencies": { "@babel/code-frame": "*", "@babel/parser": "*", - "@types/babel__code-frame": "*", - "@types/debug": "*", - "@types/glob": "*", - "@types/is-glob": "*", - "@types/semver": "*", - "@types/tmp": "*", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", @@ -75,9 +79,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } } diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json index 2856ffe4f07..6782cffd4fe 100644 --- a/packages/typescript-estree/project.json +++ b/packages/typescript-estree/project.json @@ -5,10 +5,13 @@ "implicitDependencies": ["types"], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/typescript-estree/**/*.ts"] + "lintFilePatterns": [ + "packages/typescript-estree/**/*.{mts,cts,ts,tsx}" + ], + "ignorePath": ".eslintignore" } } } diff --git a/packages/typescript-estree/src/ast-converter.ts b/packages/typescript-estree/src/ast-converter.ts index b9be864f529..a4cb0a4b7dd 100644 --- a/packages/typescript-estree/src/ast-converter.ts +++ b/packages/typescript-estree/src/ast-converter.ts @@ -26,8 +26,11 @@ export function astConverter( * Recursively convert the TypeScript AST into an ESTree-compatible AST */ const instance = new Converter(ast, { - errorOnUnknownASTType: parseSettings.errorOnUnknownASTType || false, + allowInvalidAST: parseSettings.allowInvalidAST, + errorOnUnknownASTType: parseSettings.errorOnUnknownASTType, shouldPreserveNodeMaps, + suppressDeprecatedPropertyWarnings: + parseSettings.suppressDeprecatedPropertyWarnings, }); const estree = instance.convertProgram(); @@ -63,7 +66,7 @@ export function astConverter( * Optionally convert and include all comments in the AST */ if (parseSettings.comment) { - estree.comments = convertComments(ast, parseSettings.code); + estree.comments = convertComments(ast, parseSettings.codeFullText); } const astMaps = instance.getASTMaps(); diff --git a/packages/typescript-estree/src/clear-caches.ts b/packages/typescript-estree/src/clear-caches.ts index aea4d6cf845..015fd18e29c 100644 --- a/packages/typescript-estree/src/clear-caches.ts +++ b/packages/typescript-estree/src/clear-caches.ts @@ -1,6 +1,9 @@ import { clearWatchCaches } from './create-program/getWatchProgramsForProjects'; import { clearProgramCache as clearProgramCacheOriginal } from './parser'; -import { clearTSConfigMatchCache } from './parseSettings/createParseSettings'; +import { + clearTSConfigMatchCache, + clearTSServerProjectService, +} from './parseSettings/createParseSettings'; import { clearGlobCache } from './parseSettings/resolveProjectList'; /** @@ -14,6 +17,7 @@ export function clearCaches(): void { clearProgramCacheOriginal(); clearWatchCaches(); clearTSConfigMatchCache(); + clearTSServerProjectService(); clearGlobCache(); } diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index d4dd9f124a7..db1278baa4c 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -1,4 +1,4 @@ -import { forEachComment } from 'tsutils/util/util'; +import * as tsutils from 'ts-api-utils'; import * as ts from 'typescript'; import { getLocFor } from './node-utils'; @@ -18,7 +18,7 @@ export function convertComments( ): TSESTree.Comment[] { const comments: TSESTree.Comment[] = []; - forEachComment( + tsutils.forEachComment( ast, (_, comment) => { const type = @@ -26,7 +26,7 @@ export function convertComments( ? AST_TOKEN_TYPES.Line : AST_TOKEN_TYPES.Block; const range: TSESTree.Range = [comment.pos, comment.end]; - const loc = getLocFor(range[0], range[1], ast); + const loc = getLocFor(range, ast); // both comments start with 2 characters - /* or // const textStart = range[0] + 2; diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index e9c3e39d7a9..7c1018f7a8a 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -9,6 +9,7 @@ import { createError, findNextToken, getBinaryExpressionType, + getContainingFunction, getDeclarationKind, getLastModifier, getLineAndCharacterFor, @@ -24,6 +25,9 @@ import { isESTreeClassMember, isOptional, isThisInTypeQuery, + nodeCanBeDecorated, + nodeHasIllegalDecorators, + nodeIsPresent, unescapeStringLiteralText, } from './node-utils'; import type { @@ -33,13 +37,14 @@ import type { import type { SemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import type { TSESTree, TSESTreeToTSNode, TSNode } from './ts-estree'; import { AST_NODE_TYPES } from './ts-estree'; -import { typescriptVersionIsAtLeast } from './version-check'; const SyntaxKind = ts.SyntaxKind; -interface ConverterOptions { - errorOnUnknownASTType: boolean; - shouldPreserveNodeMaps: boolean; +export interface ConverterOptions { + allowInvalidAST?: boolean; + errorOnUnknownASTType?: boolean; + shouldPreserveNodeMaps?: boolean; + suppressDeprecatedPropertyWarnings?: boolean; } /** @@ -48,12 +53,12 @@ interface ConverterOptions { * @returns converted error object */ export function convertError( - error: ts.DiagnosticWithLocation | SemanticOrSyntacticError, + error: SemanticOrSyntacticError | ts.DiagnosticWithLocation, ): TSError { return createError( + ('message' in error && error.message) || (error.messageText as string), error.file!, error.start!, - ('message' in error && error.message) || (error.messageText as string), ); } @@ -69,7 +74,6 @@ export class Converter { private readonly tsNodeToESTreeNodeMap = new WeakMap(); private allowPattern = false; - private inTypeMode = false; /** * Converts a TypeScript node into an ESTree node @@ -77,7 +81,7 @@ export class Converter { * @param options additional options for the conversion * @returns the converted ESTreeNode */ - constructor(ast: ts.SourceFile, options: ConverterOptions) { + constructor(ast: ts.SourceFile, options?: ConverterOptions) { this.ast = ast; this.options = { ...options }; } @@ -97,14 +101,12 @@ export class Converter { * Converts a TypeScript node into an ESTree node. * @param node the child ts.Node * @param parent parentNode - * @param inTypeMode flag to determine if we are in typeMode * @param allowPattern flag to determine if patterns are allowed * @returns the converted ESTree node */ private converter( node?: ts.Node, parent?: ts.Node, - inTypeMode?: boolean, allowPattern?: boolean, ): any { /** @@ -114,11 +116,9 @@ export class Converter { return null; } - const typeMode = this.inTypeMode; + this.#checkModifiers(node); + const pattern = this.allowPattern; - if (inTypeMode !== undefined) { - this.inTypeMode = inTypeMode; - } if (allowPattern !== undefined) { this.allowPattern = allowPattern; } @@ -130,7 +130,6 @@ export class Converter { this.registerTSNodeInNodeMap(node, result); - this.inTypeMode = typeMode; this.allowPattern = pattern; return result; } @@ -147,17 +146,17 @@ export class Converter { | TSESTree.NamedExportDeclarations, >( node: - | ts.FunctionDeclaration - | ts.VariableStatement | ts.ClassDeclaration | ts.ClassExpression - | ts.TypeAliasDeclaration - | ts.InterfaceDeclaration | ts.EnumDeclaration - | ts.ModuleDeclaration, + | ts.FunctionDeclaration + | ts.ImportEqualsDeclaration + | ts.InterfaceDeclaration + | ts.ModuleDeclaration + | ts.TypeAliasDeclaration + | ts.VariableStatement, result: T, - ): TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | T { - // check for exports + ): T | TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration { const modifiers = getModifiers(node); if (modifiers?.[0].kind === SyntaxKind.ExportKeyword) { /** @@ -168,22 +167,25 @@ export class Converter { const exportKeyword = modifiers[0]; const nextModifier = modifiers[1]; const declarationIsDefault = - nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword; + nextModifier?.kind === SyntaxKind.DefaultKeyword; const varToken = declarationIsDefault ? findNextToken(nextModifier, this.ast, this.ast) : findNextToken(exportKeyword, this.ast, this.ast); result.range[0] = varToken!.getStart(this.ast); - result.loc = getLocFor(result.range[0], result.range[1], this.ast); + result.loc = getLocFor(result.range, this.ast); if (declarationIsDefault) { - return this.createNode(node, { - type: AST_NODE_TYPES.ExportDefaultDeclaration, - declaration: result, - range: [exportKeyword.getStart(this.ast), result.range[1]], - exportKind: 'value', - }); + return this.createNode( + node as Exclude, + { + type: AST_NODE_TYPES.ExportDefaultDeclaration, + declaration: result as TSESTree.DefaultExportDeclarations, + range: [exportKeyword.getStart(this.ast), result.range[1]], + exportKind: 'value', + }, + ); } else { const isType = result.type === AST_NODE_TYPES.TSInterfaceDeclaration || @@ -225,18 +227,8 @@ export class Converter { * @param parent parentNode * @returns the converted ESTree node */ - private convertPattern(child?: ts.Node, parent?: ts.Node): any | null { - return this.converter(child, parent, this.inTypeMode, true); - } - - /** - * Converts a TypeScript node into an ESTree node. - * @param child the child ts.Node - * @param parent parentNode - * @returns the converted ESTree node - */ - private convertChild(child?: ts.Node, parent?: ts.Node): any | null { - return this.converter(child, parent, this.inTypeMode, false); + private convertPattern(child?: ts.Node, parent?: ts.Node): any { + return this.converter(child, parent, true); } /** @@ -245,25 +237,18 @@ export class Converter { * @param parent parentNode * @returns the converted ESTree node */ - private convertType(child?: ts.Node, parent?: ts.Node): any | null { - return this.converter(child, parent, true, false); + private convertChild(child?: ts.Node, parent?: ts.Node): any { + return this.converter(child, parent, false); } private createNode( - node: TSESTreeToTSNode, - data: TSESTree.OptionalRangeAndLoc, + // The 'parent' property will be added later if specified + node: Omit, 'parent'>, + data: Omit, 'parent'>, ): T { const result = data; - if (!result.range) { - result.range = getRange( - // this is completely valid, but TS hates it - node as never, - this.ast, - ); - } - if (!result.loc) { - result.loc = getLocFor(result.range[0], result.range[1], this.ast); - } + result.range ??= getRange(node, this.ast); + result.loc ??= getLocFor(result.range, this.ast); if (result && this.options.shouldPreserveNodeMaps) { this.esTreeNodeToTSNodeMap.set(result, node); @@ -304,14 +289,15 @@ export class Converter { ? 2 : 1; const annotationStartCol = child.getFullStart() - offset; + const range: TSESTree.Range = [annotationStartCol, child.end]; + const loc = getLocFor(range, this.ast); - const loc = getLocFor(annotationStartCol, child.end, this.ast); return { type: AST_NODE_TYPES.TSTypeAnnotation, loc, - range: [annotationStartCol, child.end], - typeAnnotation: this.convertType(child), - }; + range, + typeAnnotation: this.convertChild(child), + } as TSESTree.TSTypeAnnotation; } /** @@ -323,10 +309,10 @@ export class Converter { private convertBodyExpressions( nodes: ts.NodeArray, parent: - | ts.SourceFile | ts.Block + | ts.ClassStaticBlockDeclaration | ts.ModuleBlock - | ts.ClassStaticBlockDeclaration, + | ts.SourceFile, ): TSESTree.Statement[] { let allowDirectives = canContainDirective(parent); @@ -360,7 +346,7 @@ export class Converter { * @param node parent used to create this node * @returns TypeParameterInstantiation node */ - private convertTypeArgumentsToTypeParameters( + private convertTypeArgumentsToTypeParameterInstantiation( typeArguments: ts.NodeArray, node: TSESTreeToTSNode, ): TSESTree.TSTypeParameterInstantiation { @@ -369,7 +355,9 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.TSTypeParameterInstantiation, range: [typeArguments.pos - 1, greaterThanToken.end], - params: typeArguments.map(typeArgument => this.convertType(typeArgument)), + params: typeArguments.map(typeArgument => + this.convertChild(typeArgument), + ), }); } @@ -382,15 +370,19 @@ export class Converter { typeParameters: ts.NodeArray, ): TSESTree.TSTypeParameterDeclaration { const greaterThanToken = findNextToken(typeParameters, this.ast, this.ast)!; + const range: TSESTree.Range = [ + typeParameters.pos - 1, + greaterThanToken.end, + ]; return { type: AST_NODE_TYPES.TSTypeParameterDeclaration, - range: [typeParameters.pos - 1, greaterThanToken.end], - loc: getLocFor(typeParameters.pos - 1, greaterThanToken.end, this.ast), + range, + loc: getLocFor(range, this.ast), params: typeParameters.map(typeParameter => - this.convertType(typeParameter), + this.convertChild(typeParameter), ), - }; + } as TSESTree.TSTypeParameterDeclaration; } /** @@ -407,10 +399,9 @@ export class Converter { return parameters.map(param => { const convertedParam = this.convertChild(param) as TSESTree.Parameter; - const decorators = getDecorators(param); - if (decorators?.length) { - convertedParam.decorators = decorators.map(el => this.convertChild(el)); - } + convertedParam.decorators = + getDecorators(param)?.map(el => this.convertChild(el)) ?? []; + return convertedParam; }); } @@ -418,11 +409,11 @@ export class Converter { private convertChainExpression( node: TSESTree.ChainElement, tsNode: - | ts.PropertyAccessExpression - | ts.ElementAccessExpression | ts.CallExpression - | ts.NonNullExpression, - ): TSESTree.ChainExpression | TSESTree.ChainElement { + | ts.ElementAccessExpression + | ts.NonNullExpression + | ts.PropertyAccessExpression, + ): TSESTree.ChainElement | TSESTree.ChainExpression { const { child, isOptional } = ((): { child: TSESTree.Node; isOptional: boolean; @@ -466,9 +457,8 @@ export class Converter { */ private deeplyCopy(node: TSNode): any { if (node.kind === ts.SyntaxKind.JSDocFunctionType) { - throw createError( - this.ast, - node.pos, + this.#throwError( + node, 'JSDoc types can only be used inside documentation comments.', ); } @@ -494,10 +484,18 @@ export class Converter { : null; } if ('typeArguments' in node) { - result.typeParameters = + result.typeArguments = node.typeArguments && 'pos' in node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) : null; + this.#withDeprecatedAliasGetter( + result, + 'typeParameters', + 'typeArguments', + ); } if ('typeParameters' in node) { result.typeParameters = @@ -564,13 +562,33 @@ export class Converter { } private convertJSXNamespaceOrIdentifier( - node: ts.Identifier | ts.ThisExpression, + node: ts.JsxNamespacedName | ts.Identifier | ts.ThisExpression, ): TSESTree.JSXIdentifier | TSESTree.JSXNamespacedName { + // TypeScript@5.1 added in ts.JsxNamespacedName directly + // We prefer using that if it's relevant for this node type + if (node.kind === ts.SyntaxKind.JsxNamespacedName) { + const result = this.createNode(node, { + type: AST_NODE_TYPES.JSXNamespacedName, + namespace: this.createNode(node.namespace, { + type: AST_NODE_TYPES.JSXIdentifier, + name: node.namespace.text, + }), + name: this.createNode(node.name, { + type: AST_NODE_TYPES.JSXIdentifier, + name: node.name.text, + }), + }); + this.registerTSNodeInNodeMap(node, result); + return result; + } + + // TypeScript@<5.1 has to manually parse the JSX attributes const text = node.getText(); const colonIndex = text.indexOf(':'); // this is intentional we can ignore conversion if `:` is in first character if (colonIndex > 0) { const range = getRange(node, this.ast); + // @ts-expect-error -- TypeScript@<5.1 doesn't have ts.JsxNamespacedName const result = this.createNode(node, { type: AST_NODE_TYPES.JSXNamespacedName, namespace: this.createNode(node, { @@ -608,7 +626,7 @@ export class Converter { if (node.name.kind === SyntaxKind.PrivateIdentifier) { // This is one of the few times where TS explicitly errors, and doesn't even gracefully handle the syntax. // So we shouldn't ever get into this state to begin with. - throw new Error('Non-private identifier expected.'); + this.#throwError(node.name, 'Non-private identifier expected.'); } result = this.createNode(node, { @@ -630,16 +648,16 @@ export class Converter { private convertMethodSignature( node: - | ts.MethodSignature | ts.GetAccessorDeclaration + | ts.MethodSignature | ts.SetAccessorDeclaration, ): TSESTree.TSMethodSignature { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSMethodSignature, + accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), key: this.convertChild(node.name), - params: this.convertParameters(node.parameters), - kind: ((): 'get' | 'set' | 'method' => { + kind: ((): 'get' | 'method' | 'set' => { switch (node.kind) { case SyntaxKind.GetAccessor: return 'get'; @@ -651,41 +669,17 @@ export class Converter { return 'method'; } })(), - }); - - if (isOptional(node)) { - result.optional = true; - } - - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) { - result.readonly = true; - } - - if (node.typeParameters) { - result.typeParameters = + optional: isOptional(node), + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if (hasModifier(SyntaxKind.ExportKeyword, node)) { - result.export = true; - } - - if (hasModifier(SyntaxKind.StaticKeyword, node)) { - result.static = true; - } - - return result; + ), + }); } private convertAssertClasue( @@ -696,62 +690,6 @@ export class Converter { : node.elements.map(element => this.convertChild(element)); } - /** - * Applies the given TS modifiers to the given result object. - * - * This method adds not standardized `modifiers` property in nodes - * - * @param result - * @param modifiers original ts.Nodes from the node.modifiers array - * @returns the current result object will be mutated - */ - private applyModifiersToResult( - result: TSESTree.TSEnumDeclaration | TSESTree.TSModuleDeclaration, - modifiers: Iterable | undefined, - ): void { - if (!modifiers) { - return; - } - - const remainingModifiers: TSESTree.Modifier[] = []; - /** - * Some modifiers are explicitly handled by applying them as - * boolean values on the result node. As well as adding them - * to the result, we remove them from the array, so that they - * are not handled twice. - */ - for (const modifier of modifiers) { - switch (modifier.kind) { - /** - * Ignore ExportKeyword and DefaultKeyword, they are handled - * via the fixExports utility function - */ - case SyntaxKind.ExportKeyword: - case SyntaxKind.DefaultKeyword: - break; - case SyntaxKind.ConstKeyword: - (result as any).const = true; - break; - case SyntaxKind.DeclareKeyword: - result.declare = true; - break; - default: - remainingModifiers.push( - this.convertChild(modifier) as TSESTree.Modifier, - ); - break; - } - } - /** - * If there are still valid modifiers available which have - * not been explicitly handled above, we just convert and - * add the modifiers array to the result node. - */ - if (remainingModifiers.length > 0) { - result.modifiers = remainingModifiers; - } - } - /** * Uses the provided range location to adjust the location data of the given Node * @param result The node that will have its location data mutated @@ -776,9 +714,8 @@ export class Converter { allowNull: boolean, ): void { if (!allowNull && node.moduleSpecifier == null) { - throw createError( - this.ast, - node.pos, + this.#throwUnlessAllowInvalidAST( + node, 'Module specifier must be a string literal.', ); } @@ -787,9 +724,8 @@ export class Converter { node.moduleSpecifier && node.moduleSpecifier?.kind !== SyntaxKind.StringLiteral ) { - throw createError( - this.ast, - node.moduleSpecifier.pos, + this.#throwUnlessAllowInvalidAST( + node.moduleSpecifier, 'Module specifier must be a string literal.', ); } @@ -809,8 +745,10 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.Program, body: this.convertBodyExpressions(node.statements, node), - sourceType: node.externalModuleIndicator ? 'module' : 'script', + comments: undefined, range: [node.getStart(this.ast), node.endOfFileToken.end], + sourceType: node.externalModuleIndicator ? 'module' : 'script', + tokens: undefined, }); } @@ -831,7 +769,10 @@ export class Converter { } return this.createNode(node, { type: AST_NODE_TYPES.Identifier, + decorators: [], name: node.text, + optional: false, + typeAnnotation: undefined, }); } @@ -909,6 +850,13 @@ export class Converter { // Exceptions case SyntaxKind.ThrowStatement: + if (node.expression.end === node.expression.pos) { + this.#throwUnlessAllowInvalidAST( + node, + 'A throw statement must throw an expression.', + ); + } + return this.createNode(node, { type: AST_NODE_TYPES.ThrowStatement, argument: this.convertChild(node.expression), @@ -989,44 +937,34 @@ export class Converter { const isDeclare = hasModifier(SyntaxKind.DeclareKeyword, node); const result = this.createNode< - TSESTree.TSDeclareFunction | TSESTree.FunctionDeclaration + TSESTree.FunctionDeclaration | TSESTree.TSDeclareFunction >(node, { type: isDeclare || !node.body ? AST_NODE_TYPES.TSDeclareFunction : AST_NODE_TYPES.FunctionDeclaration, - id: this.convertChild(node.name), - generator: !!node.asteriskToken, - expression: false, async: hasModifier(SyntaxKind.AsyncKeyword, node), - params: this.convertParameters(node.parameters), body: this.convertChild(node.body) || undefined, - }); - - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + declare: isDeclare, + expression: false, + generator: !!node.asteriskToken, + id: this.convertChild(node.name), + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - - if (isDeclare) { - result.declare = true; - } + ), + }); - // check for exports return this.fixExports(node, result); } case SyntaxKind.VariableDeclaration: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.VariableDeclarator, + definite: !!node.exclamationToken, id: this.convertBindingNameWithTypeAnnotation( node.name, node.type, @@ -1034,12 +972,6 @@ export class Converter { ), init: this.convertChild(node.initializer), }); - - if (node.exclamationToken) { - result.definite = true; - } - - return result; } case SyntaxKind.VariableStatement: { @@ -1048,9 +980,17 @@ export class Converter { declarations: node.declarationList.declarations.map(el => this.convertChild(el), ), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), kind: getDeclarationKind(node.declarationList), }); + if (!result.declarations.length) { + this.#throwUnlessAllowInvalidAST( + node, + 'A variable declaration list must have at least one variable declarator.', + ); + } + /** * Semantically, decorators are not allowed on variable declarations, * Pre 4.8 TS would include them in the AST, so we did as well. @@ -1058,12 +998,6 @@ export class Converter { * * So for consistency across versions, we no longer include it either. */ - - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - - // check for exports return this.fixExports(node, result); } @@ -1072,6 +1006,7 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, declarations: node.declarations.map(el => this.convertChild(el)), + declare: false, kind: getDeclarationKind(node), }); @@ -1080,6 +1015,7 @@ export class Converter { case SyntaxKind.ExpressionStatement: return this.createNode(node, { type: AST_NODE_TYPES.ExpressionStatement, + directive: undefined, expression: this.convertChild(node.expression), }); @@ -1093,7 +1029,10 @@ export class Converter { if (this.allowPattern) { return this.createNode(node, { type: AST_NODE_TYPES.ArrayPattern, + decorators: [], elements: node.elements.map(el => this.convertPattern(el)), + optional: false, + typeAnnotation: undefined, }); } else { return this.createNode(node, { @@ -1108,56 +1047,116 @@ export class Converter { if (this.allowPattern) { return this.createNode(node, { type: AST_NODE_TYPES.ObjectPattern, + decorators: [], + optional: false, properties: node.properties.map(el => this.convertPattern(el)), + typeAnnotation: undefined, }); - } else { - return this.createNode(node, { - type: AST_NODE_TYPES.ObjectExpression, - properties: node.properties.map(el => this.convertChild(el)), - }); } + + const properties: TSESTree.Property[] = []; + for (const property of node.properties) { + if ( + (property.kind === SyntaxKind.GetAccessor || + property.kind === SyntaxKind.SetAccessor || + property.kind === SyntaxKind.MethodDeclaration) && + !property.body + ) { + this.#throwUnlessAllowInvalidAST(property.end - 1, "'{' expected."); + } + + properties.push(this.convertChild(property) as TSESTree.Property); + } + + return this.createNode(node, { + type: AST_NODE_TYPES.ObjectExpression, + properties, + }); } - case SyntaxKind.PropertyAssignment: + case SyntaxKind.PropertyAssignment: { + // eslint-disable-next-line deprecation/deprecation + const { questionToken, exclamationToken } = node; + + if (questionToken) { + this.#throwError( + questionToken, + 'A property assignment cannot have a question token.', + ); + } + + if (exclamationToken) { + this.#throwError( + exclamationToken, + 'A property assignment cannot have an exclamation token.', + ); + } + return this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.name), - value: this.converter( - node.initializer, - node, - this.inTypeMode, - this.allowPattern, - ), + value: this.converter(node.initializer, node, this.allowPattern), computed: isComputedProperty(node.name), method: false, + optional: false, shorthand: false, kind: 'init', }); + } case SyntaxKind.ShorthandPropertyAssignment: { + // eslint-disable-next-line deprecation/deprecation + const { modifiers, questionToken, exclamationToken } = node; + + if (modifiers) { + this.#throwError( + modifiers[0], + 'A shorthand property assignment cannot have modifiers.', + ); + } + + if (questionToken) { + this.#throwError( + questionToken, + 'A shorthand property assignment cannot have a question token.', + ); + } + + if (exclamationToken) { + this.#throwError( + exclamationToken, + 'A shorthand property assignment cannot have an exclamation token.', + ); + } + if (node.objectAssignmentInitializer) { return this.createNode(node, { type: AST_NODE_TYPES.Property, key: this.convertChild(node.name), value: this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: this.convertPattern(node.name), + optional: false, right: this.convertChild(node.objectAssignmentInitializer), + typeAnnotation: undefined, }), computed: false, method: false, + optional: false, shorthand: true, kind: 'init', }); } else { return this.createNode(node, { type: AST_NODE_TYPES.Property, - key: this.convertChild(node.name), - value: this.convertChild(node.name), computed: false, + key: this.convertChild(node.name), + kind: 'init', method: false, + optional: false, shorthand: true, - kind: 'init', + value: this.convertChild(node.name), }); } } @@ -1167,9 +1166,15 @@ export class Converter { case SyntaxKind.PropertyDeclaration: { const isAbstract = hasModifier(SyntaxKind.AbstractKeyword, node); - const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option + if (isAbstract && node.initializer) { + this.#throwError( + node.initializer, + `Abstract property cannot have an initializer.`, + ); + } + + const isAccessor = hasModifier(SyntaxKind.AccessorKeyword, node); const type = (() => { if (isAccessor) { if (isAbstract) { @@ -1184,53 +1189,36 @@ export class Converter { return AST_NODE_TYPES.PropertyDefinition; })(); - const result = this.createNode< + const key = this.convertChild(node.name); + + return this.createNode< + | TSESTree.AccessorProperty + | TSESTree.PropertyDefinition | TSESTree.TSAbstractAccessorProperty | TSESTree.TSAbstractPropertyDefinition - | TSESTree.PropertyDefinition - | TSESTree.AccessorProperty >(node, { type, - key: this.convertChild(node.name), + key, + accessibility: getTSNodeAccessibility(node), value: isAbstract ? null : this.convertChild(node.initializer), computed: isComputedProperty(node.name), static: hasModifier(SyntaxKind.StaticKeyword, node), - readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + decorators: + getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + declare: hasModifier(SyntaxKind.DeclareKeyword, node), override: hasModifier(SyntaxKind.OverrideKeyword, node), + typeAnnotation: + node.type && this.convertTypeAnnotation(node.type, node), + optional: + (key.type === AST_NODE_TYPES.Literal || + node.name.kind === SyntaxKind.Identifier || + node.name.kind === SyntaxKind.ComputedPropertyName || + node.name.kind === SyntaxKind.PrivateIdentifier) && + !!node.questionToken, + definite: !!node.exclamationToken, }); - - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - } - - const decorators = getDecorators(node); - if (decorators) { - result.decorators = decorators.map(el => this.convertChild(el)); - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if ( - (node.name.kind === SyntaxKind.Identifier || - node.name.kind === SyntaxKind.ComputedPropertyName || - node.name.kind === SyntaxKind.PrivateIdentifier) && - node.questionToken - ) { - result.optional = true; - } - - if (node.exclamationToken) { - result.definite = true; - } - - if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) { - result.optional = true; - } - return result; } case SyntaxKind.GetAccessor: @@ -1245,7 +1233,7 @@ export class Converter { // otherwise, it is a non-type accessor - intentional fallthrough case SyntaxKind.MethodDeclaration: { const method = this.createNode< - TSESTree.TSEmptyBodyFunctionExpression | TSESTree.FunctionExpression + TSESTree.FunctionExpression | TSESTree.TSEmptyBodyFunctionExpression >(node, { type: !node.body ? AST_NODE_TYPES.TSEmptyBodyFunctionExpression @@ -1255,27 +1243,25 @@ export class Converter { expression: false, // ESTreeNode as ESTreeNode here async: hasModifier(SyntaxKind.AsyncKeyword, node), body: this.convertChild(node.body), + declare: false, range: [node.parameters.pos - 1, node.end], params: [], - }); - - if (node.type) { - method.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - method.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); + ), + }); + + if (method.typeParameters) { this.fixParentLocation(method, method.typeParameters.range); } let result: + | TSESTree.MethodDefinition | TSESTree.Property - | TSESTree.TSAbstractMethodDefinition - | TSESTree.MethodDefinition; + | TSESTree.TSAbstractMethodDefinition; if (parent.kind === SyntaxKind.ObjectLiteralExpression) { method.params = node.parameters.map(el => this.convertChild(el)); @@ -1285,6 +1271,7 @@ export class Converter { key: this.convertChild(node.name), value: method, computed: isComputedProperty(node.name), + optional: !!node.questionToken, method: node.kind === SyntaxKind.MethodDeclaration, shorthand: false, kind: 'init', @@ -1308,30 +1295,20 @@ export class Converter { : AST_NODE_TYPES.MethodDefinition; result = this.createNode< - TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition + TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition >(node, { type: methodDefinitionType, - key: this.convertChild(node.name), - value: method, + accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), - static: hasModifier(SyntaxKind.StaticKeyword, node), + decorators: + getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + key: this.convertChild(node.name), kind: 'method', + optional: !!node.questionToken, override: hasModifier(SyntaxKind.OverrideKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + value: method, }); - - const decorators = getDecorators(node); - if (decorators) { - result.decorators = decorators.map(el => this.convertChild(el)); - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - } - - if (node.questionToken) { - result.optional = true; } if (node.kind === SyntaxKind.GetAccessor) { @@ -1353,91 +1330,81 @@ export class Converter { case SyntaxKind.Constructor: { const lastModifier = getLastModifier(node); const constructorToken = - (lastModifier && findNextToken(lastModifier, node, this.ast)) || + (lastModifier && findNextToken(lastModifier, node, this.ast)) ?? node.getFirstToken()!; const constructor = this.createNode< - TSESTree.TSEmptyBodyFunctionExpression | TSESTree.FunctionExpression + TSESTree.FunctionExpression | TSESTree.TSEmptyBodyFunctionExpression >(node, { type: !node.body ? AST_NODE_TYPES.TSEmptyBodyFunctionExpression : AST_NODE_TYPES.FunctionExpression, - id: null, - params: this.convertParameters(node.parameters), - generator: false, - expression: false, // is not present in ESTreeNode async: false, body: this.convertChild(node.body), + declare: false, + expression: false, // is not present in ESTreeNode + generator: false, + id: null, + params: this.convertParameters(node.parameters), range: [node.parameters.pos - 1, node.end], - }); - - // Process typeParameters - if (node.typeParameters) { - constructor.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - this.fixParentLocation(constructor, constructor.typeParameters.range); - } + ), + }); - // Process returnType - if (node.type) { - constructor.returnType = this.convertTypeAnnotation(node.type, node); + if (constructor.typeParameters) { + this.fixParentLocation(constructor, constructor.typeParameters.range); } const constructorKey = this.createNode(node, { type: AST_NODE_TYPES.Identifier, + decorators: [], name: 'constructor', + optional: false, range: [constructorToken.getStart(this.ast), constructorToken.end], + typeAnnotation: undefined, }); const isStatic = hasModifier(SyntaxKind.StaticKeyword, node); - const result = this.createNode< - TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition + + return this.createNode< + TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition >(node, { type: hasModifier(SyntaxKind.AbstractKeyword, node) ? AST_NODE_TYPES.TSAbstractMethodDefinition : AST_NODE_TYPES.MethodDefinition, - key: constructorKey, - value: constructor, + accessibility: getTSNodeAccessibility(node), computed: false, - static: isStatic, + decorators: [], + optional: false, + key: constructorKey, kind: isStatic ? 'method' : 'constructor', override: false, + static: isStatic, + value: constructor, }); - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - return result; - } + } case SyntaxKind.FunctionExpression: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.FunctionExpression, - id: this.convertChild(node.name), - generator: !!node.asteriskToken, - params: this.convertParameters(node.parameters), - body: this.convertChild(node.body), async: hasModifier(SyntaxKind.AsyncKeyword, node), + body: this.convertChild(node.body), + declare: false, expression: false, - }); - - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + generator: !!node.asteriskToken, + id: this.convertChild(node.name), + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.SuperKeyword: @@ -1448,7 +1415,10 @@ export class Converter { case SyntaxKind.ArrayBindingPattern: return this.createNode(node, { type: AST_NODE_TYPES.ArrayPattern, + decorators: [], elements: node.elements.map(el => this.convertPattern(el)), + optional: false, + typeAnnotation: undefined, }); // occurs with missing array elements like [,] @@ -1458,7 +1428,10 @@ export class Converter { case SyntaxKind.ObjectBindingPattern: return this.createNode(node, { type: AST_NODE_TYPES.ObjectPattern, + decorators: [], + optional: false, properties: node.elements.map(el => this.convertPattern(el)), + typeAnnotation: undefined, }); case SyntaxKind.BindingElement: { @@ -1468,23 +1441,34 @@ export class Converter { if (node.initializer) { return this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: arrayItem, + optional: false, right: this.convertChild(node.initializer), + typeAnnotation: undefined, }); } else if (node.dotDotDotToken) { return this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: arrayItem, + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else { return arrayItem; } } else { - let result: TSESTree.RestElement | TSESTree.Property; + let result: TSESTree.Property | TSESTree.RestElement; if (node.dotDotDotToken) { result = this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertChild(node.propertyName ?? node.name), + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else { result = this.createNode(node, { @@ -1496,6 +1480,7 @@ export class Converter { node.propertyName.kind === SyntaxKind.ComputedPropertyName, ), method: false, + optional: false, shorthand: !node.propertyName, kind: 'init', }); @@ -1504,9 +1489,12 @@ export class Converter { if (node.initializer) { result.value = this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: this.convertChild(node.name), - right: this.convertChild(node.initializer), + optional: false, range: [node.name.getStart(this.ast), node.initializer.end], + right: this.convertChild(node.initializer), + typeAnnotation: undefined, }); } return result; @@ -1514,7 +1502,7 @@ export class Converter { } case SyntaxKind.ArrowFunction: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ArrowFunctionExpression, generator: false, id: null, @@ -1522,21 +1510,13 @@ export class Converter { body: this.convertChild(node.body), async: hasModifier(SyntaxKind.AsyncKeyword, node), expression: node.body.kind !== SyntaxKind.Block, - }); - - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.YieldExpression: @@ -1592,17 +1572,24 @@ export class Converter { } case SyntaxKind.TaggedTemplateExpression: - return this.createNode(node, { - type: AST_NODE_TYPES.TaggedTemplateExpression, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, - tag: this.convertChild(node.tag), - quasi: this.convertChild(node.template), - }); + return this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.TaggedTemplateExpression, + typeArguments: + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ), + tag: this.convertChild(node.tag), + quasi: this.convertChild(node.template), + }, + 'typeParameters', + 'typeArguments', + ), + ); case SyntaxKind.TemplateHead: case SyntaxKind.TemplateMiddle: @@ -1629,6 +1616,10 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertPattern(node.expression), + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else { return this.createNode(node, { @@ -1639,27 +1630,34 @@ export class Converter { } case SyntaxKind.Parameter: { - let parameter: TSESTree.RestElement | TSESTree.BindingName; - let result: TSESTree.RestElement | TSESTree.AssignmentPattern; + let parameter: TSESTree.BindingName | TSESTree.RestElement; + let result: TSESTree.AssignmentPattern | TSESTree.RestElement; if (node.dotDotDotToken) { parameter = result = this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertChild(node.name), + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else if (node.initializer) { parameter = this.convertChild(node.name) as TSESTree.BindingName; result = this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: parameter, + optional: false, right: this.convertChild(node.initializer), + typeAnnotation: undefined, }); const modifiers = getModifiers(node); if (modifiers) { // AssignmentPattern should not contain modifiers in range result.range[0] = parameter.range[0]; - result.loc = getLocFor(result.range[0], result.range[1], this.ast); + result.loc = getLocFor(result.range, this.ast); } } else { parameter = result = this.convertChild(node.name, parent); @@ -1688,14 +1686,12 @@ export class Converter { if (modifiers) { return this.createNode(node, { type: AST_NODE_TYPES.TSParameterProperty, - accessibility: getTSNodeAccessibility(node) ?? undefined, - readonly: - hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined, - override: - hasModifier(SyntaxKind.OverrideKeyword, node) || undefined, + accessibility: getTSNodeAccessibility(node), + decorators: [], + override: hasModifier(SyntaxKind.OverrideKeyword, node), parameter: result, + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), }); } return result; @@ -1704,6 +1700,17 @@ export class Converter { // Classes case SyntaxKind.ClassDeclaration: + if ( + !node.name && + (!hasModifier(ts.SyntaxKind.ExportKeyword, node) || + !hasModifier(ts.SyntaxKind.DefaultKeyword, node)) + ) { + this.#throwUnlessAllowInvalidAST( + node, + "A class declaration without the 'default' modifier must have a name.", + ); + } + /* intentional fallthrough */ case SyntaxKind.ClassExpression: { const heritageClauses = node.heritageClauses ?? []; const classNodeType = @@ -1711,83 +1718,97 @@ export class Converter { ? AST_NODE_TYPES.ClassDeclaration : AST_NODE_TYPES.ClassExpression; - const superClass = heritageClauses.find( - clause => clause.token === SyntaxKind.ExtendsKeyword, - ); + let extendsClause: ts.HeritageClause | undefined; + let implementsClause: ts.HeritageClause | undefined; + for (const heritageClause of heritageClauses) { + const { token, types } = heritageClause; - const implementsClause = heritageClauses.find( - clause => clause.token === SyntaxKind.ImplementsKeyword, - ); - - const result = this.createNode< - TSESTree.ClassDeclaration | TSESTree.ClassExpression - >(node, { - type: classNodeType, - id: this.convertChild(node.name), - body: this.createNode(node, { - type: AST_NODE_TYPES.ClassBody, - body: [], - range: [node.members.pos - 1, node.end], - }), - superClass: superClass?.types[0] - ? this.convertChild(superClass.types[0].expression) - : null, - }); - - if (superClass) { - if (superClass.types.length > 1) { - throw createError( - this.ast, - superClass.types[1].pos, - 'Classes can only extend a single class.', + if (types.length === 0) { + this.#throwUnlessAllowInvalidAST( + heritageClause, + `'${ts.tokenToString(token)}' list cannot be empty.`, ); } - if (superClass.types[0]?.typeArguments) { - result.superTypeParameters = - this.convertTypeArgumentsToTypeParameters( - superClass.types[0].typeArguments, - superClass.types[0], + if (token === SyntaxKind.ExtendsKeyword) { + if (extendsClause) { + this.#throwUnlessAllowInvalidAST( + heritageClause, + "'extends' clause already seen.", ); - } - } - - if (node.typeParameters) { - result.typeParameters = - this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); - } + } - if (implementsClause) { - result.implements = implementsClause.types.map(el => - this.convertChild(el), - ); - } + if (implementsClause) { + this.#throwUnlessAllowInvalidAST( + heritageClause, + "'extends' clause must precede 'implements' clause.", + ); + } - /** - * TypeScript class declarations can be defined as "abstract" - */ - if (hasModifier(SyntaxKind.AbstractKeyword, node)) { - result.abstract = true; - } + if (types.length > 1) { + this.#throwUnlessAllowInvalidAST( + types[1], + 'Classes can only extend a single class.', + ); + } - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } + extendsClause ??= heritageClause; + } else if (token === SyntaxKind.ImplementsKeyword) { + if (implementsClause) { + this.#throwUnlessAllowInvalidAST( + heritageClause, + "'implements' clause already seen.", + ); + } - const decorators = getDecorators(node); - if (decorators) { - result.decorators = decorators.map(el => this.convertChild(el)); + implementsClause ??= heritageClause; + } } - const filteredMembers = node.members.filter(isESTreeClassMember); + const result = this.createNode< + TSESTree.ClassDeclaration | TSESTree.ClassExpression + >( + node, + this.#withDeprecatedAliasGetter( + { + type: classNodeType, + abstract: hasModifier(SyntaxKind.AbstractKeyword, node), + body: this.createNode(node, { + type: AST_NODE_TYPES.ClassBody, + body: node.members + .filter(isESTreeClassMember) + .map(el => this.convertChild(el)), + range: [node.members.pos - 1, node.end], + }), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), + decorators: + getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + id: this.convertChild(node.name), + implements: + implementsClause?.types.map(el => this.convertChild(el)) ?? [], + superClass: extendsClause?.types[0] + ? this.convertChild(extendsClause.types[0].expression) + : null, + superTypeArguments: undefined, + typeParameters: + node.typeParameters && + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ), + }, + 'superTypeParameters', + 'superTypeArguments', + ), + ); - if (filteredMembers.length) { - result.body.body = filteredMembers.map(el => this.convertChild(el)); + if (extendsClause?.types[0]?.typeArguments) { + result.superTypeArguments = + this.convertTypeArgumentsToTypeParameterInstantiation( + extendsClause.types[0].typeArguments, + extendsClause.types[0], + ); } - // check for exports return this.fixExports(node, result); } @@ -2001,29 +2022,30 @@ export class Converter { ); return result; } else { - const type = getBinaryExpressionType(node.operatorToken); + const expressionType = getBinaryExpressionType(node.operatorToken); if ( this.allowPattern && - type === AST_NODE_TYPES.AssignmentExpression + expressionType.type === AST_NODE_TYPES.AssignmentExpression ) { return this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: this.convertPattern(node.left, node), + optional: false, right: this.convertChild(node.right), + typeAnnotation: undefined, }); } return this.createNode< | TSESTree.AssignmentExpression - | TSESTree.LogicalExpression | TSESTree.BinaryExpression + | TSESTree.LogicalExpression >(node, { - type, - operator: getTextForTokenKind(node.operatorToken.kind), + ...expressionType, left: this.converter( node.left, node, - this.inTypeMode, - type === AST_NODE_TYPES.AssignmentExpression, + expressionType.type === AST_NODE_TYPES.AssignmentExpression, ), right: this.convertChild(node.right), }); @@ -2065,9 +2087,8 @@ export class Converter { case SyntaxKind.CallExpression: { if (node.expression.kind === SyntaxKind.ImportKeyword) { if (node.arguments.length !== 1 && node.arguments.length !== 2) { - throw createError( - this.ast, - node.arguments.pos, + this.#throwUnlessAllowInvalidAST( + node.arguments[2] ?? node, 'Dynamic import requires exactly one or two arguments.', ); } @@ -2082,40 +2103,55 @@ export class Converter { const callee = this.convertChild(node.expression); const args = node.arguments.map(el => this.convertChild(el)); - - const result = this.createNode(node, { - type: AST_NODE_TYPES.CallExpression, - callee, - arguments: args, - optional: node.questionDotToken !== undefined, - }); - - if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters( + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( node.typeArguments, node, ); - } + + const result = this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.CallExpression, + callee, + arguments: args, + optional: node.questionDotToken !== undefined, + typeArguments, + }, + 'typeParameters', + 'typeArguments', + ), + ); return this.convertChainExpression(result, node); } case SyntaxKind.NewExpression: { - // NOTE - NewExpression cannot have an optional chain in it - const result = this.createNode(node, { - type: AST_NODE_TYPES.NewExpression, - callee: this.convertChild(node.expression), - arguments: node.arguments - ? node.arguments.map(el => this.convertChild(el)) - : [], - }); - if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters( + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( node.typeArguments, node, ); - } - return result; + + // NOTE - NewExpression cannot have an optional chain in it + return this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.NewExpression, + arguments: node.arguments + ? node.arguments.map(el => this.convertChild(el)) + : [], + callee: this.convertChild(node.expression), + typeArguments, + }, + 'typeParameters', + 'typeArguments', + ), + ); } case SyntaxKind.ConditionalExpression: @@ -2134,7 +2170,10 @@ export class Converter { node.getFirstToken()! as ts.Token, { type: AST_NODE_TYPES.Identifier, + decorators: [], name: getTextForTokenKind(node.keywordToken), + optional: false, + typeAnnotation: undefined, }, ), property: this.convertChild(node.name), @@ -2195,8 +2234,8 @@ export class Converter { let regex = null; try { regex = new RegExp(pattern, flags); - } catch (exception: unknown) { - regex = null; + } catch { + // Intentionally blank, so regex stays null } return this.createNode(node, { @@ -2225,13 +2264,6 @@ export class Converter { }); case SyntaxKind.NullKeyword: { - if (!typescriptVersionIsAtLeast['4.0'] && this.inTypeMode) { - // 4.0 started nesting null types inside a LiteralType node, but we still need to support pre-4.0 - return this.createNode(node, { - type: AST_NODE_TYPES.TSNullKeyword, - }); - } - return this.createNode(node, { type: AST_NODE_TYPES.Literal, value: null, @@ -2274,41 +2306,56 @@ export class Converter { * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, * TypeScript does not seem to have the idea of openingElement when tag is self-closing */ - openingElement: this.createNode(node, { - type: AST_NODE_TYPES.JSXOpeningElement, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, - selfClosing: true, - name: this.convertJSXTagName(node.tagName, node), - attributes: node.attributes.properties.map(el => - this.convertChild(el), + openingElement: this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.JSXOpeningElement, + typeArguments: node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) + : undefined, + selfClosing: true, + name: this.convertJSXTagName(node.tagName, node), + attributes: node.attributes.properties.map(el => + this.convertChild(el), + ), + range: getRange(node, this.ast), + }, + 'typeParameters', + 'typeArguments', ), - range: getRange(node, this.ast), - }), + ), closingElement: null, children: [], }); } - case SyntaxKind.JsxOpeningElement: - return this.createNode(node, { - type: AST_NODE_TYPES.JSXOpeningElement, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, - selfClosing: false, - name: this.convertJSXTagName(node.tagName, node), - attributes: node.attributes.properties.map(el => - this.convertChild(el), + case SyntaxKind.JsxOpeningElement: { + return this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.JSXOpeningElement, + typeArguments: + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ), + selfClosing: false, + name: this.convertJSXTagName(node.tagName, node), + attributes: node.attributes.properties.map(el => + this.convertChild(el), + ), + }, + 'typeParameters', + 'typeArguments', ), - }); + ); + } case SyntaxKind.JsxClosingElement: return this.createNode(node, { @@ -2384,27 +2431,31 @@ export class Converter { // TypeScript specific - case SyntaxKind.TypeReference: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSTypeReference, - typeName: this.convertType(node.typeName), - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : undefined, - }); - } + case SyntaxKind.TypeReference: + return this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.TSTypeReference, + typeName: this.convertChild(node.typeName), + typeArguments: + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ), + }, + 'typeParameters', + 'typeArguments', + ), + ); case SyntaxKind.TypeParameter: { return this.createNode(node, { type: AST_NODE_TYPES.TSTypeParameter, - name: this.convertType(node.name), - constraint: node.constraint - ? this.convertType(node.constraint) - : undefined, - default: node.default ? this.convertType(node.default) : undefined, + name: this.convertChild(node.name), + constraint: node.constraint && this.convertChild(node.constraint), + default: node.default ? this.convertChild(node.default) : undefined, in: hasModifier(SyntaxKind.InKeyword, node), out: hasModifier(SyntaxKind.OutKeyword, node), const: hasModifier(SyntaxKind.ConstKeyword, node), @@ -2452,65 +2503,69 @@ export class Converter { case SyntaxKind.ArrayType: { return this.createNode(node, { type: AST_NODE_TYPES.TSArrayType, - elementType: this.convertType(node.elementType), + elementType: this.convertChild(node.elementType), }); } case SyntaxKind.IndexedAccessType: { return this.createNode(node, { type: AST_NODE_TYPES.TSIndexedAccessType, - objectType: this.convertType(node.objectType), - indexType: this.convertType(node.indexType), + objectType: this.convertChild(node.objectType), + indexType: this.convertChild(node.indexType), }); } case SyntaxKind.ConditionalType: { return this.createNode(node, { type: AST_NODE_TYPES.TSConditionalType, - checkType: this.convertType(node.checkType), - extendsType: this.convertType(node.extendsType), - trueType: this.convertType(node.trueType), - falseType: this.convertType(node.falseType), + checkType: this.convertChild(node.checkType), + extendsType: this.convertChild(node.extendsType), + trueType: this.convertChild(node.trueType), + falseType: this.convertChild(node.falseType), }); } - case SyntaxKind.TypeQuery: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSTypeQuery, - exprName: this.convertType(node.exprName), - typeParameters: - node.typeArguments && - this.convertTypeArgumentsToTypeParameters(node.typeArguments, node), - }); - } + case SyntaxKind.TypeQuery: + return this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.TSTypeQuery, + exprName: this.convertChild(node.exprName), + typeArguments: + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ), + }, + 'typeParameters', + 'typeArguments', + ), + ); case SyntaxKind.MappedType: { - const result = this.createNode(node, { - type: AST_NODE_TYPES.TSMappedType, - typeParameter: this.convertType(node.typeParameter), - nameType: this.convertType(node.nameType) ?? null, - }); - - if (node.readonlyToken) { - if (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword) { - result.readonly = true; - } else { - result.readonly = getTextForTokenKind(node.readonlyToken.kind); - } - } - - if (node.questionToken) { - if (node.questionToken.kind === SyntaxKind.QuestionToken) { - result.optional = true; - } else { - result.optional = getTextForTokenKind(node.questionToken.kind); - } + if (node.members && node.members.length > 0) { + this.#throwUnlessAllowInvalidAST( + node.members[0], + 'A mapped type may not declare properties or methods.', + ); } - if (node.type) { - result.typeAnnotation = this.convertType(node.type); - } - return result; + return this.createNode(node, { + type: AST_NODE_TYPES.TSMappedType, + nameType: this.convertChild(node.nameType) ?? null, + optional: + node.questionToken && + (node.questionToken.kind === SyntaxKind.QuestionToken || + getTextForTokenKind(node.questionToken.kind)), + readonly: + node.readonlyToken && + (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword || + getTextForTokenKind(node.readonlyToken.kind)), + typeAnnotation: node.type && this.convertChild(node.type), + typeParameter: this.convertChild(node.typeParameter), + }); } case SyntaxKind.ParenthesizedExpression: @@ -2519,23 +2574,16 @@ export class Converter { case SyntaxKind.TypeAliasDeclaration: { const result = this.createNode(node, { type: AST_NODE_TYPES.TSTypeAliasDeclaration, + declare: hasModifier(SyntaxKind.DeclareKeyword, node), id: this.convertChild(node.name), - typeAnnotation: this.convertType(node.type), - }); - - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + typeAnnotation: this.convertChild(node.type), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } + ), + }); - // check for exports return this.fixExports(node, result); } @@ -2544,79 +2592,65 @@ export class Converter { } case SyntaxKind.PropertySignature: { - const result = this.createNode(node, { + // eslint-disable-next-line deprecation/deprecation + const { initializer } = node; + if (initializer) { + this.#throwError( + initializer, + 'A property signature cannot have an initializer.', + ); + } + + return this.createNode(node, { type: AST_NODE_TYPES.TSPropertySignature, - optional: isOptional(node) || undefined, + accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), key: this.convertChild(node.name), - typeAnnotation: node.type - ? this.convertTypeAnnotation(node.type, node) - : undefined, - initializer: - this.convertChild( - // @ts-expect-error TODO breaking change remove this from the AST - node.initializer as ts.Node, - ) || undefined, - readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - export: hasModifier(SyntaxKind.ExportKeyword, node) || undefined, - }); - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - return result; + optional: isOptional(node), + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + typeAnnotation: + node.type && this.convertTypeAnnotation(node.type, node), + }); } case SyntaxKind.IndexSignature: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSIndexSignature, + accessibility: getTSNodeAccessibility(node), parameters: node.parameters.map(el => this.convertChild(el)), + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + typeAnnotation: + node.type && this.convertTypeAnnotation(node.type, node), }); - - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - } - - if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) { - result.readonly = true; - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if (hasModifier(SyntaxKind.ExportKeyword, node)) { - result.export = true; - } - - if (hasModifier(SyntaxKind.StaticKeyword, node)) { - result.static = true; - } - return result; } + case SyntaxKind.ConstructorType: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSConstructorType, - params: this.convertParameters(node.parameters), abstract: hasModifier(SyntaxKind.AbstractKeyword, node), - }); - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - if (node.typeParameters) { - result.typeParameters = + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } - case SyntaxKind.FunctionType: + case SyntaxKind.FunctionType: { + // eslint-disable-next-line deprecation/deprecation + const { modifiers } = node; + if (modifiers) { + this.#throwError( + modifiers[0], + 'A function type cannot have modifiers.', + ); + } + } + // intentional fallthrough case SyntaxKind.ConstructSignature: case SyntaxKind.CallSignature: { const type = @@ -2625,25 +2659,21 @@ export class Converter { : node.kind === SyntaxKind.CallSignature ? AST_NODE_TYPES.TSCallSignatureDeclaration : AST_NODE_TYPES.TSFunctionType; - const result = this.createNode< - | TSESTree.TSFunctionType + + return this.createNode< | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration + | TSESTree.TSFunctionType >(node, { - type: type, + type, params: this.convertParameters(node.parameters), - }); - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - if (node.typeParameters) { - result.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.ExpressionWithTypeArguments: { @@ -2654,26 +2684,54 @@ export class Converter { : parentKind === SyntaxKind.HeritageClause ? AST_NODE_TYPES.TSClassImplements : AST_NODE_TYPES.TSInstantiationExpression; - const result = this.createNode< - | TSESTree.TSInterfaceHeritage + + return this.createNode< | TSESTree.TSClassImplements | TSESTree.TSInstantiationExpression - >(node, { - type, - expression: this.convertChild(node.expression), - }); - - if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ); - } - return result; + | TSESTree.TSInterfaceHeritage + >( + node, + this.#withDeprecatedAliasGetter( + { + type, + expression: this.convertChild(node.expression), + typeArguments: + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ), + }, + 'typeParameters', + 'typeArguments', + ), + ); } case SyntaxKind.InterfaceDeclaration: { const interfaceHeritageClauses = node.heritageClauses ?? []; + const interfaceExtends: TSESTree.TSInterfaceHeritage[] = []; + + for (const heritageClause of interfaceHeritageClauses) { + if (heritageClause.token !== SyntaxKind.ExtendsKeyword) { + this.#throwError( + heritageClause, + heritageClause.token === SyntaxKind.ImplementsKeyword + ? "Interface declaration cannot have 'implements' clause." + : 'Unexpected token.', + ); + } + + for (const heritageType of heritageClause.types) { + interfaceExtends.push( + this.convertChild( + heritageType, + node, + ) as TSESTree.TSInterfaceHeritage, + ); + } + } + const result = this.createNode(node, { type: AST_NODE_TYPES.TSInterfaceDeclaration, body: this.createNode(node, { @@ -2681,52 +2739,16 @@ export class Converter { body: node.members.map(member => this.convertChild(member)), range: [node.members.pos - 1, node.end], }), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), + extends: interfaceExtends, id: this.convertChild(node.name), - }); - - if (node.typeParameters) { - result.typeParameters = + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - - if (interfaceHeritageClauses.length > 0) { - const interfaceExtends: TSESTree.TSInterfaceHeritage[] = []; - const interfaceImplements: TSESTree.TSInterfaceHeritage[] = []; - - for (const heritageClause of interfaceHeritageClauses) { - if (heritageClause.token === SyntaxKind.ExtendsKeyword) { - for (const n of heritageClause.types) { - interfaceExtends.push( - this.convertChild(n, node) as TSESTree.TSInterfaceHeritage, - ); - } - } else { - for (const n of heritageClause.types) { - interfaceImplements.push( - this.convertChild(n, node) as TSESTree.TSInterfaceHeritage, - ); - } - } - } - - if (interfaceExtends.length) { - result.extends = interfaceExtends; - } - - if (interfaceImplements.length) { - result.implements = interfaceImplements; - } - } + ), + }); - if (hasModifier(SyntaxKind.AbstractKeyword, node)) { - result.abstract = true; - } - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - // check for exports return this.fixExports(node, result); } @@ -2749,146 +2771,220 @@ export class Converter { return result; } - case SyntaxKind.ImportType: - return this.createNode(node, { - type: AST_NODE_TYPES.TSImportType, - isTypeOf: !!node.isTypeOf, - parameter: this.convertChild(node.argument), - qualifier: this.convertChild(node.qualifier), - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters( - node.typeArguments, - node, - ) - : null, - }); + case SyntaxKind.ImportType: { + const range = getRange(node, this.ast); + if (node.isTypeOf) { + const token = findNextToken(node.getFirstToken()!, node, this.ast)!; + range[0] = token.getStart(this.ast); + } + const result = this.createNode( + node, + this.#withDeprecatedAliasGetter( + { + type: AST_NODE_TYPES.TSImportType, + argument: this.convertChild(node.argument), + qualifier: this.convertChild(node.qualifier), + typeArguments: node.typeArguments + ? this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ) + : null, + range: range, + }, + 'typeParameters', + 'typeArguments', + ), + ); + + if (node.isTypeOf) { + return this.createNode(node, { + type: AST_NODE_TYPES.TSTypeQuery, + exprName: result, + typeArguments: undefined, + typeParameters: undefined, + }); + } + return result; + } case SyntaxKind.EnumDeclaration: { const result = this.createNode(node, { type: AST_NODE_TYPES.TSEnumDeclaration, + const: hasModifier(SyntaxKind.ConstKeyword, node), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), id: this.convertChild(node.name), members: node.members.map(el => this.convertChild(el)), }); - // apply modifiers first... - this.applyModifiersToResult(result, getModifiers(node)); - // ...then check for exports + return this.fixExports(node, result); } case SyntaxKind.EnumMember: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSEnumMember, + computed: node.name.kind === ts.SyntaxKind.ComputedPropertyName, id: this.convertChild(node.name), + initializer: node.initializer && this.convertChild(node.initializer), }); - if (node.initializer) { - result.initializer = this.convertChild(node.initializer); - } - if (node.name.kind === ts.SyntaxKind.ComputedPropertyName) { - result.computed = true; - } - return result; } case SyntaxKind.ModuleDeclaration: { const result = this.createNode(node, { type: AST_NODE_TYPES.TSModuleDeclaration, - // eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option - ...(() => { - const id: TSESTree.Identifier | TSESTree.StringLiteral = - this.convertChild(node.name); - const body: - | TSESTree.TSModuleBlock - | TSESTree.TSModuleDeclaration - | null = this.convertChild(node.body); - + ...((): TSESTree.OptionalRangeAndLoc< + Omit + > => { // the constraints checked by this function are syntactically enforced by TS // the checks mostly exist for type's sake if (node.flags & ts.NodeFlags.GlobalAugmentation) { + const id: TSESTree.Identifier | TSESTree.StringLiteral = + this.convertChild(node.name); + const body: + | TSESTree.TSModuleBlock + | TSESTree.TSModuleDeclaration + | null = this.convertChild(node.body); + if ( body == null || body.type === AST_NODE_TYPES.TSModuleDeclaration ) { - throw new Error('Expected a valid module body'); + this.#throwUnlessAllowInvalidAST( + node.body ?? node, + 'Expected a valid module body', + ); } if (id.type !== AST_NODE_TYPES.Identifier) { - throw new Error( + this.#throwUnlessAllowInvalidAST( + node.name, 'global module augmentation must have an Identifier id', ); } return { kind: 'global', + body: body as TSESTree.TSModuleBlock, + declare: false, + global: false, id, - body, - global: true, - } satisfies TSESTree.OptionalRangeAndLoc< - Omit - >; - } else if (node.flags & ts.NodeFlags.Namespace) { - if (body == null) { - throw new Error('Expected a module body'); - } - if (id.type !== AST_NODE_TYPES.Identifier) { - throw new Error('`namespace`s must have an Identifier id'); - } - return { - kind: 'namespace', - id, - body, - } satisfies TSESTree.OptionalRangeAndLoc< - Omit - >; - } else { + }; + } + + if (!(node.flags & ts.NodeFlags.Namespace)) { + const body: TSESTree.TSModuleBlock | null = this.convertChild( + node.body, + ); return { kind: 'module', - id, ...(body != null ? { body } : {}), - } satisfies TSESTree.OptionalRangeAndLoc< - Omit - >; + declare: false, + global: false, + id: this.convertChild(node.name), + }; + } + + // Nested module declarations are stored in TypeScript as nested tree nodes. + // We "unravel" them here by making our own nested TSQualifiedName, + // with the innermost node's body as the actual node body. + + if (node.body == null) { + this.#throwUnlessAllowInvalidAST(node, 'Expected a module body'); + } + if (node.name.kind !== ts.SyntaxKind.Identifier) { + this.#throwUnlessAllowInvalidAST( + node.name, + '`namespace`s must have an Identifier id', + ); + } + + let name: TSESTree.Identifier | TSESTree.TSQualifiedName = + this.createNode(node.name, { + decorators: [], + name: node.name.text, + optional: false, + range: [node.name.getStart(this.ast), node.name.getEnd()], + type: AST_NODE_TYPES.Identifier, + typeAnnotation: undefined, + }); + + while ( + node.body && + ts.isModuleDeclaration(node.body) && + node.body.name + ) { + node = node.body; + + const nextName = node.name as ts.Identifier; + + const right = this.createNode(nextName, { + decorators: [], + name: nextName.text, + optional: false, + range: [nextName.getStart(this.ast), nextName.getEnd()], + type: AST_NODE_TYPES.Identifier, + typeAnnotation: undefined, + }); + + name = this.createNode(nextName, { + left: name, + right: right, + range: [name.range[0], right.range[1]], + type: AST_NODE_TYPES.TSQualifiedName, + }); } + + return { + kind: 'namespace', + body: this.convertChild(node.body), + declare: false, + global: false, + id: name, + }; })(), }); - this.applyModifiersToResult(result, getModifiers(node)); - // ...then check for exports + if (hasModifier(SyntaxKind.DeclareKeyword, node)) { + result.declare = true; + } + + if (node.flags & ts.NodeFlags.GlobalAugmentation) { + result.global = true; + } + return this.fixExports(node, result); } // TypeScript specific types case SyntaxKind.ParenthesizedType: { - return this.convertType(node.type); + return this.convertChild(node.type); } case SyntaxKind.UnionType: { return this.createNode(node, { type: AST_NODE_TYPES.TSUnionType, - types: node.types.map(el => this.convertType(el)), + types: node.types.map(el => this.convertChild(el)), }); } case SyntaxKind.IntersectionType: { return this.createNode(node, { type: AST_NODE_TYPES.TSIntersectionType, - types: node.types.map(el => this.convertType(el)), + types: node.types.map(el => this.convertChild(el)), }); } case SyntaxKind.AsExpression: { return this.createNode(node, { type: AST_NODE_TYPES.TSAsExpression, expression: this.convertChild(node.expression), - typeAnnotation: this.convertType(node.type), + typeAnnotation: this.convertChild(node.type), }); } case SyntaxKind.InferType: { return this.createNode(node, { type: AST_NODE_TYPES.TSInferType, - typeParameter: this.convertType(node.typeParameter), + typeParameter: this.convertChild(node.typeParameter), }); } case SyntaxKind.LiteralType: { - if ( - typescriptVersionIsAtLeast['4.0'] && - node.literal.kind === SyntaxKind.NullKeyword - ) { + if (node.literal.kind === SyntaxKind.NullKeyword) { // 4.0 started nesting null types inside a LiteralType node // but our AST is designed around the old way of null being a keyword return this.createNode( @@ -2900,25 +2996,27 @@ export class Converter { } else { return this.createNode(node, { type: AST_NODE_TYPES.TSLiteralType, - literal: this.convertType(node.literal), + literal: this.convertChild(node.literal), }); } } case SyntaxKind.TypeAssertionExpression: { return this.createNode(node, { type: AST_NODE_TYPES.TSTypeAssertion, - typeAnnotation: this.convertType(node.type), + typeAnnotation: this.convertChild(node.type), expression: this.convertChild(node.expression), }); } case SyntaxKind.ImportEqualsDeclaration: { - return this.createNode(node, { - type: AST_NODE_TYPES.TSImportEqualsDeclaration, - id: this.convertChild(node.name), - moduleReference: this.convertChild(node.moduleReference), - importKind: node.isTypeOnly ? 'type' : 'value', - isExport: hasModifier(SyntaxKind.ExportKeyword, node), - }); + return this.fixExports( + node, + this.createNode(node, { + type: AST_NODE_TYPES.TSImportEqualsDeclaration, + id: this.convertChild(node.name), + importKind: node.isTypeOnly ? 'type' : 'value', + moduleReference: this.convertChild(node.moduleReference), + }), + ); } case SyntaxKind.ExternalModuleReference: { return this.createNode(node, { @@ -2946,9 +3044,9 @@ export class Converter { const elementTypes = 'elementTypes' in node ? (node as any).elementTypes.map((el: ts.Node) => - this.convertType(el), + this.convertChild(el), ) - : node.elements.map(el => this.convertType(el)); + : node.elements.map(el => this.convertChild(el)); return this.createNode(node, { type: AST_NODE_TYPES.TSTupleType, @@ -2958,7 +3056,7 @@ export class Converter { case SyntaxKind.NamedTupleMember: { const member = this.createNode(node, { type: AST_NODE_TYPES.TSNamedTupleMember, - elementType: this.convertType(node.type, node), + elementType: this.convertChild(node.type, node), label: this.convertChild(node.name, node), optional: node.questionToken != null, }); @@ -2978,13 +3076,13 @@ export class Converter { case SyntaxKind.OptionalType: { return this.createNode(node, { type: AST_NODE_TYPES.TSOptionalType, - typeAnnotation: this.convertType(node.type), + typeAnnotation: this.convertChild(node.type), }); } case SyntaxKind.RestType: { return this.createNode(node, { type: AST_NODE_TYPES.TSRestType, - typeAnnotation: this.convertType(node.type), + typeAnnotation: this.convertChild(node.type), }); } @@ -3034,4 +3132,285 @@ export class Converter { return this.deeplyCopy(node); } } + + #checkModifiers(node: ts.Node): void { + if (this.options.allowInvalidAST) { + return; + } + + // typescript<5.0.0 + if (nodeHasIllegalDecorators(node)) { + this.#throwError( + node.illegalDecorators[0], + 'Decorators are not valid here.', + ); + } + + for (const decorator of getDecorators( + node, + /* includeIllegalDecorators */ true, + ) ?? []) { + // `checkGrammarModifiers` function in typescript + if (!nodeCanBeDecorated(node as TSNode)) { + if (ts.isMethodDeclaration(node) && !nodeIsPresent(node.body)) { + this.#throwError( + decorator, + 'A decorator can only decorate a method implementation, not an overload.', + ); + } else { + this.#throwError(decorator, 'Decorators are not valid here.'); + } + } + } + + for (const modifier of getModifiers( + node, + /* includeIllegalModifiers */ true, + ) ?? []) { + if (modifier.kind !== SyntaxKind.ReadonlyKeyword) { + if ( + node.kind === SyntaxKind.PropertySignature || + node.kind === SyntaxKind.MethodSignature + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a type member`, + ); + } + + if ( + node.kind === SyntaxKind.IndexSignature && + (modifier.kind !== SyntaxKind.StaticKeyword || + !ts.isClassLike(node.parent)) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on an index signature`, + ); + } + } + + if ( + modifier.kind !== SyntaxKind.InKeyword && + modifier.kind !== SyntaxKind.OutKeyword && + modifier.kind !== SyntaxKind.ConstKeyword && + node.kind === SyntaxKind.TypeParameter + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a type parameter`, + ); + } + + if ( + (modifier.kind === SyntaxKind.InKeyword || + modifier.kind === SyntaxKind.OutKeyword) && + (node.kind !== SyntaxKind.TypeParameter || + !( + ts.isInterfaceDeclaration(node.parent) || + ts.isClassLike(node.parent) || + ts.isTypeAliasDeclaration(node.parent) + )) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier can only appear on a type parameter of a class, interface or type alias`, + ); + } + + if ( + modifier.kind === SyntaxKind.ReadonlyKeyword && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.PropertySignature && + node.kind !== SyntaxKind.IndexSignature && + node.kind !== SyntaxKind.Parameter + ) { + this.#throwError( + modifier, + "'readonly' modifier can only appear on a property declaration or index signature.", + ); + } + + if ( + modifier.kind === SyntaxKind.DeclareKeyword && + ts.isClassLike(node.parent) && + !ts.isPropertyDeclaration(node) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on class elements of this kind.`, + ); + } + + if ( + modifier.kind === SyntaxKind.AbstractKeyword && + node.kind !== SyntaxKind.ClassDeclaration && + node.kind !== SyntaxKind.ConstructorType && + node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.PropertyDeclaration && + node.kind !== SyntaxKind.GetAccessor && + node.kind !== SyntaxKind.SetAccessor + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier can only appear on a class, method, or property declaration.`, + ); + } + + if ( + (modifier.kind === SyntaxKind.StaticKeyword || + modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.PrivateKeyword) && + (node.parent.kind === SyntaxKind.ModuleBlock || + node.parent.kind === SyntaxKind.SourceFile) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a module or namespace element.`, + ); + } + + if ( + modifier.kind === SyntaxKind.AccessorKeyword && + node.kind !== SyntaxKind.PropertyDeclaration + ) { + this.#throwError( + modifier, + "'accessor' modifier can only appear on a property declaration.", + ); + } + + // `checkGrammarAsyncModifier` function in `typescript` + if ( + modifier.kind === SyntaxKind.AsyncKeyword && + node.kind !== SyntaxKind.MethodDeclaration && + node.kind !== SyntaxKind.FunctionDeclaration && + node.kind !== SyntaxKind.FunctionExpression && + node.kind !== SyntaxKind.ArrowFunction + ) { + this.#throwError(modifier, "'async' modifier cannot be used here."); + } + + // `checkGrammarModifiers` function in `typescript` + if ( + node.kind === SyntaxKind.Parameter && + (modifier.kind === SyntaxKind.StaticKeyword || + modifier.kind === SyntaxKind.ExportKeyword || + modifier.kind === SyntaxKind.DeclareKeyword || + modifier.kind === SyntaxKind.AsyncKeyword) + ) { + this.#throwError( + modifier, + `'${ts.tokenToString( + modifier.kind, + )}' modifier cannot appear on a parameter.`, + ); + } + + // `checkParameter` function in `typescript` + if ( + node.kind === SyntaxKind.Parameter && + // In `typescript` package, it's `ts.hasSyntacticModifier(node, ts.ModifierFlags.ParameterPropertyModifier)` + // https://github.com/typescript-eslint/typescript-eslint/pull/6615#discussion_r1136489935 + (modifier.kind === SyntaxKind.PublicKeyword || + modifier.kind === SyntaxKind.PrivateKeyword || + modifier.kind === SyntaxKind.ProtectedKeyword || + modifier.kind === SyntaxKind.ReadonlyKeyword || + modifier.kind === SyntaxKind.OverrideKeyword) + ) { + const func = getContainingFunction(node)!; + + if ( + !(func.kind === SyntaxKind.Constructor && nodeIsPresent(func.body)) + ) { + this.#throwError( + modifier, + 'A parameter property is only allowed in a constructor implementation.', + ); + } + } + } + } + + #throwUnlessAllowInvalidAST( + node: ts.Node | number, + message: string, + ): asserts node is never { + if (!this.options.allowInvalidAST) { + this.#throwError(node, message); + } + } + + /** + * Creates a getter for a property under aliasKey that returns the value under + * valueKey. If suppressDeprecatedPropertyWarnings is not enabled, the + * getter also console warns about the deprecation. + * + * @see https://github.com/typescript-eslint/typescript-eslint/issues/6469 + */ + #withDeprecatedAliasGetter< + Properties extends { type: string }, + AliasKey extends string, + ValueKey extends string & keyof Properties, + >( + node: Properties, + aliasKey: AliasKey, + valueKey: ValueKey, + ): Properties & Record { + let warned = false; + + Object.defineProperty(node, aliasKey, { + configurable: true, + get: this.options.suppressDeprecatedPropertyWarnings + ? (): Properties[typeof valueKey] => node[valueKey] + : (): Properties[typeof valueKey] => { + if (!warned) { + process.emitWarning( + `The '${aliasKey}' property is deprecated on ${node.type} nodes. Use '${valueKey}' instead. See https://typescript-eslint.io/linting/troubleshooting#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.`, + 'DeprecationWarning', + ); + warned = true; + } + + return node[valueKey]; + }, + set(value): void { + Object.defineProperty(node, aliasKey, { + enumerable: true, + writable: true, + value, + }); + }, + }); + + return node as Properties & Record; + } + + #throwError(node: ts.Node | number, message: string): asserts node is never { + let start; + let end; + if (typeof node === 'number') { + start = end = node; + } else { + start = node.getStart(this.ast); + end = node.getEnd(); + } + + throw createError(message, this.ast, start, end); + } } diff --git a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts index 667e2b4b05e..04799b89580 100644 --- a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts +++ b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts @@ -8,9 +8,9 @@ import type * as ts from 'typescript'; interface DirectoryStructureHost { readDirectory?( path: string, - extensions?: ReadonlyArray, - exclude?: ReadonlyArray, - include?: ReadonlyArray, + extensions?: readonly string[], + exclude?: readonly string[], + include?: readonly string[], depth?: number, ): string[]; } @@ -19,9 +19,9 @@ interface DirectoryStructureHost { interface CachedDirectoryStructureHost extends DirectoryStructureHost { readDirectory( path: string, - extensions?: ReadonlyArray, - exclude?: ReadonlyArray, - include?: ReadonlyArray, + extensions?: readonly string[], + exclude?: readonly string[], + include?: readonly string[], depth?: number, ): string[]; } diff --git a/packages/typescript-estree/src/create-program/createDefaultProgram.ts b/packages/typescript-estree/src/create-program/createDefaultProgram.ts index b533746fff6..76db0b406f8 100644 --- a/packages/typescript-estree/src/create-program/createDefaultProgram.ts +++ b/packages/typescript-estree/src/create-program/createDefaultProgram.ts @@ -3,21 +3,21 @@ import path from 'path'; import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; -import type { ASTAndProgram } from './shared'; -import { - createDefaultCompilerOptionsFromExtra, - getModuleResolver, -} from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; +import { createDefaultCompilerOptionsFromExtra } from './shared'; const log = debug('typescript-eslint:typescript-estree:createDefaultProgram'); /** * @param parseSettings Internal settings for parsing the file * @returns If found, returns the source file corresponding to the code and the containing program + * @deprecated + * This is a legacy option that comes with severe performance penalties. + * Please do not use it. */ function createDefaultProgram( parseSettings: ParseSettings, -): ASTAndProgram | undefined { +): ASTAndDefiniteProgram | undefined { log( 'Getting default program for: %s', parseSettings.filePath || 'unnamed file', @@ -32,7 +32,12 @@ function createDefaultProgram( const commandLine = ts.getParsedCommandLineOfConfigFile( tsconfigPath, createDefaultCompilerOptionsFromExtra(parseSettings), - { ...ts.sys, onUnRecoverableConfigFileDiagnostic: () => {} }, + { + ...ts.sys, + // TODO: file issue on TypeScript to suggest making optional? + // eslint-disable-next-line @typescript-eslint/no-empty-function + onUnRecoverableConfigFileDiagnostic: () => {}, + }, ); if (!commandLine) { @@ -44,17 +49,10 @@ function createDefaultProgram( /* setParentNodes */ true, ); - if (parseSettings.moduleResolver) { - // eslint-disable-next-line deprecation/deprecation -- intentional for older TS versions - compilerHost.resolveModuleNames = getModuleResolver( - parseSettings.moduleResolver, - ).resolveModuleNames; - } - const oldReadFile = compilerHost.readFile; compilerHost.readFile = (fileName: string): string | undefined => path.normalize(fileName) === path.normalize(parseSettings.filePath) - ? parseSettings.code + ? parseSettings.codeFullText : oldReadFile(fileName); const program = ts.createProgram( @@ -67,4 +65,5 @@ function createDefaultProgram( return ast && { ast, program }; } +// eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major export { createDefaultProgram }; diff --git a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts index 5ec1c8e0fe7..0b6520f22aa 100644 --- a/packages/typescript-estree/src/create-program/createIsolatedProgram.ts +++ b/packages/typescript-estree/src/create-program/createIsolatedProgram.ts @@ -3,7 +3,7 @@ import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; import { getScriptKind } from './getScriptKind'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { createDefaultCompilerOptionsFromExtra } from './shared'; const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); @@ -12,7 +12,9 @@ const log = debug('typescript-eslint:typescript-estree:createIsolatedProgram'); * @param code The code of the file being linted * @returns Returns a new source file and program corresponding to the linted code */ -function createIsolatedProgram(parseSettings: ParseSettings): ASTAndProgram { +function createIsolatedProgram( + parseSettings: ParseSettings, +): ASTAndDefiniteProgram { log( 'Getting isolated program in %s mode for: %s', parseSettings.jsx ? 'TSX' : 'TS', @@ -43,7 +45,7 @@ function createIsolatedProgram(parseSettings: ParseSettings): ASTAndProgram { getSourceFile(filename: string) { return ts.createSourceFile( filename, - parseSettings.code, + parseSettings.codeFullText, ts.ScriptTarget.Latest, /* setParentNodes */ true, getScriptKind(parseSettings.filePath, parseSettings.jsx), diff --git a/packages/typescript-estree/src/create-program/createProjectProgram.ts b/packages/typescript-estree/src/create-program/createProjectProgram.ts index f60ae9cbfd5..edfe00992c1 100644 --- a/packages/typescript-estree/src/create-program/createProjectProgram.ts +++ b/packages/typescript-estree/src/create-program/createProjectProgram.ts @@ -5,8 +5,7 @@ import * as ts from 'typescript'; import { firstDefined } from '../node-utils'; import type { ParseSettings } from '../parseSettings'; import { describeFilePath } from './describeFilePath'; -import { getWatchProgramsForProjects } from './getWatchProgramsForProjects'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { getAstFromProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:createProjectProgram'); @@ -28,16 +27,17 @@ const DEFAULT_EXTRA_FILE_EXTENSIONS = [ */ function createProjectProgram( parseSettings: ParseSettings, -): ASTAndProgram | undefined { + programsForProjects: readonly ts.Program[], +): ASTAndDefiniteProgram | undefined { log('Creating project program for: %s', parseSettings.filePath); - const programsForProjects = getWatchProgramsForProjects(parseSettings); const astAndProgram = firstDefined(programsForProjects, currentProgram => - getAstFromProgram(currentProgram, parseSettings), + getAstFromProgram(currentProgram, parseSettings.filePath), ); // The file was either matched within the tsconfig, or we allow creating a default program - if (astAndProgram || parseSettings.createDefaultProgram) { + // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major + if (astAndProgram || parseSettings.DEPRECATED__createDefaultProgram) { return astAndProgram; } diff --git a/packages/typescript-estree/src/create-program/createProjectService.ts b/packages/typescript-estree/src/create-program/createProjectService.ts new file mode 100644 index 00000000000..333d221f85b --- /dev/null +++ b/packages/typescript-estree/src/create-program/createProjectService.ts @@ -0,0 +1,49 @@ +/* eslint-disable @typescript-eslint/no-empty-function -- for TypeScript APIs*/ +import type * as ts from 'typescript/lib/tsserverlibrary'; + +const doNothing = (): void => {}; + +const createStubFileWatcher = (): ts.FileWatcher => ({ + close: doNothing, +}); + +export type TypeScriptProjectService = ts.server.ProjectService; + +export function createProjectService(): TypeScriptProjectService { + // We import this lazily to avoid its cost for users who don't use the service + const tsserver = require('typescript/lib/tsserverlibrary') as typeof ts; + + // TODO: see getWatchProgramsForProjects + // We don't watch the disk, we just refer to these when ESLint calls us + // there's a whole separate update pass in maybeInvalidateProgram at the bottom of getWatchProgramsForProjects + // (this "goes nuclear on TypeScript") + const system: ts.server.ServerHost = { + ...tsserver.sys, + clearImmediate, + clearTimeout, + setImmediate, + setTimeout, + watchDirectory: createStubFileWatcher, + watchFile: createStubFileWatcher, + }; + + return new tsserver.server.ProjectService({ + host: system, + cancellationToken: { isCancellationRequested: (): boolean => false }, + useSingleInferredProject: false, + useInferredProjectPerProjectRoot: false, + logger: { + close: doNothing, + endGroup: doNothing, + getLogFileName: () => undefined, + hasLevel: () => false, + info: doNothing, + loggingEnabled: () => false, + msg: doNothing, + perftrc: doNothing, + startGroup: doNothing, + }, + session: undefined, + }); +} +/* eslint-enable @typescript-eslint/no-empty-function */ diff --git a/packages/typescript-estree/src/create-program/createSourceFile.ts b/packages/typescript-estree/src/create-program/createSourceFile.ts index 806e503f0e4..a89a364ac54 100644 --- a/packages/typescript-estree/src/create-program/createSourceFile.ts +++ b/packages/typescript-estree/src/create-program/createSourceFile.ts @@ -2,7 +2,9 @@ import debug from 'debug'; import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; +import { isSourceFile } from '../source-files'; import { getScriptKind } from './getScriptKind'; +import type { ASTAndNoProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:createSourceFile'); @@ -13,13 +15,22 @@ function createSourceFile(parseSettings: ParseSettings): ts.SourceFile { parseSettings.filePath, ); - return ts.createSourceFile( - parseSettings.filePath, - parseSettings.code, - ts.ScriptTarget.Latest, - /* setParentNodes */ true, - getScriptKind(parseSettings.filePath, parseSettings.jsx), - ); + return isSourceFile(parseSettings.code) + ? parseSettings.code + : ts.createSourceFile( + parseSettings.filePath, + parseSettings.codeFullText, + ts.ScriptTarget.Latest, + /* setParentNodes */ true, + getScriptKind(parseSettings.filePath, parseSettings.jsx), + ); +} + +function createNoProgram(parseSettings: ParseSettings): ASTAndNoProgram { + return { + ast: createSourceFile(parseSettings), + program: null, + }; } -export { createSourceFile }; +export { createSourceFile, createNoProgram }; diff --git a/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts b/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts index c1263ce342a..e5e4b70f7d0 100644 --- a/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts +++ b/packages/typescript-estree/src/create-program/getWatchProgramsForProjects.ts @@ -1,16 +1,15 @@ import debug from 'debug'; import fs from 'fs'; -import semver from 'semver'; import * as ts from 'typescript'; import type { ParseSettings } from '../parseSettings'; +import { getCodeText } from '../source-files'; import type { CanonicalPath } from './shared'; import { canonicalDirname, createDefaultCompilerOptionsFromExtra, createHash, getCanonicalFileName, - getModuleResolver, } from './shared'; import type { WatchCompilerHostOfConfigFile } from './WatchCompilerHostOfConfigFile'; @@ -91,7 +90,10 @@ function saveWatchCallback( /** * Holds information about the file currently being linted */ -const currentLintOperationState: { code: string; filePath: CanonicalPath } = { +const currentLintOperationState: { + code: ts.SourceFile | string; + filePath: CanonicalPath; +} = { code: '', filePath: '' as CanonicalPath, }; @@ -138,7 +140,7 @@ function getWatchProgramsForProjects( // Update file version if necessary const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); - const codeHash = createHash(parseSettings.code); + const codeHash = createHash(getCodeText(parseSettings.code)); if ( parsedFilesSeenHash.get(filePath) !== codeHash && fileWatchCallbacks && @@ -249,10 +251,6 @@ function getWatchProgramsForProjects( return results; } -const isRunningNoTimeoutFix = semver.satisfies(ts.version, '>=3.9.0-beta', { - includePrerelease: true, -}); - function createWatchProgram( tsconfigPath: string, parseSettings: ParseSettings, @@ -263,26 +261,24 @@ function createWatchProgram( const watchCompilerHost = ts.createWatchCompilerHost( tsconfigPath, createDefaultCompilerOptionsFromExtra(parseSettings), - ts.sys, + { + ...ts.sys, + getCurrentDirectory: () => parseSettings.tsconfigRootDir, + }, ts.createAbstractBuilder, diagnosticReporter, + // TODO: file issue on TypeScript to suggest making optional? + // eslint-disable-next-line @typescript-eslint/no-empty-function /*reportWatchStatus*/ () => {}, ) as WatchCompilerHostOfConfigFile; - if (parseSettings.moduleResolver) { - // eslint-disable-next-line deprecation/deprecation -- intentional for older TS versions - watchCompilerHost.resolveModuleNames = getModuleResolver( - parseSettings.moduleResolver, - ).resolveModuleNames; - } - // ensure readFile reads the code being linted instead of the copy on disk const oldReadFile = watchCompilerHost.readFile; watchCompilerHost.readFile = (filePathIn, encoding): string | undefined => { const filePath = getCanonicalFileName(filePathIn); const fileContent = filePath === currentLintOperationState.filePath - ? currentLintOperationState.code + ? getCodeText(currentLintOperationState.code) : oldReadFile(filePath, encoding); if (fileContent !== undefined) { parsedFilesSeenHash.set(filePath, createHash(fileContent)); @@ -364,34 +360,9 @@ function createWatchProgram( // Since we don't want to asynchronously update program we want to disable timeout methods // So any changes in the program will be delayed and updated when getProgram is called on watch - let callback: (() => void) | undefined; - if (isRunningNoTimeoutFix) { - watchCompilerHost.setTimeout = undefined; - watchCompilerHost.clearTimeout = undefined; - } else { - log('Running without timeout fix'); - // But because of https://github.com/microsoft/TypeScript/pull/37308 we cannot just set it to undefined - // instead save it and call before getProgram is called - watchCompilerHost.setTimeout = (cb, _ms, ...args: unknown[]): unknown => { - callback = cb.bind(/*this*/ undefined, ...args); - return callback; - }; - watchCompilerHost.clearTimeout = (): void => { - callback = undefined; - }; - } - const watch = ts.createWatchProgram(watchCompilerHost); - if (!isRunningNoTimeoutFix) { - const originalGetProgram = watch.getProgram; - watch.getProgram = (): ts.BuilderProgram => { - if (callback) { - callback(); - } - callback = undefined; - return originalGetProgram.call(watch); - }; - } - return watch; + watchCompilerHost.setTimeout = undefined; + watchCompilerHost.clearTimeout = undefined; + return ts.createWatchProgram(watchCompilerHost); } function hasTSConfigChanged(tsconfigPath: CanonicalPath): boolean { diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index e8de9796928..8966093372e 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -2,13 +2,17 @@ import path from 'path'; import type { Program } from 'typescript'; import * as ts from 'typescript'; -import type { ModuleResolver } from '../parser-options'; import type { ParseSettings } from '../parseSettings'; -interface ASTAndProgram { +interface ASTAndNoProgram { + ast: ts.SourceFile; + program: null; +} +interface ASTAndDefiniteProgram { ast: ts.SourceFile; program: ts.Program; } +type ASTAndProgram = ASTAndDefiniteProgram | ASTAndNoProgram; /** * Compiler options required to avoid critical functionality issues @@ -93,12 +97,12 @@ function getExtension(fileName: string | undefined): string | null { function getAstFromProgram( currentProgram: Program, - parseSettings: ParseSettings, -): ASTAndProgram | undefined { - const ast = currentProgram.getSourceFile(parseSettings.filePath); + filePath: string, +): ASTAndDefiniteProgram | undefined { + const ast = currentProgram.getSourceFile(filePath); // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 - const expectedExt = getExtension(parseSettings.filePath); + const expectedExt = getExtension(filePath); const returnedExt = getExtension(ast?.fileName); if (expectedExt !== returnedExt) { return undefined; @@ -107,23 +111,6 @@ function getAstFromProgram( return ast && { ast, program: currentProgram }; } -function getModuleResolver(moduleResolverPath: string): ModuleResolver { - let moduleResolver: ModuleResolver; - - try { - moduleResolver = require(moduleResolverPath) as ModuleResolver; - } catch (error) { - const errorLines = [ - 'Could not find the provided parserOptions.moduleResolver.', - 'Hint: use an absolute path if you are not in control over where the ESLint instance runs.', - ]; - - throw new Error(errorLines.join('\n')); - } - - return moduleResolver; -} - /** * Hash content for compare content. * @param content hashed contend @@ -138,6 +125,8 @@ function createHash(content: string): string { } export { + ASTAndDefiniteProgram, + ASTAndNoProgram, ASTAndProgram, CORE_COMPILER_OPTIONS, canonicalDirname, @@ -147,5 +136,4 @@ export { ensureAbsolutePath, getCanonicalFileName, getAstFromProgram, - getModuleResolver, }; diff --git a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts index fc99416faa5..c2b67e79575 100644 --- a/packages/typescript-estree/src/create-program/useProvidedPrograms.ts +++ b/packages/typescript-estree/src/create-program/useProvidedPrograms.ts @@ -3,24 +3,25 @@ import * as fs from 'fs'; import * as path from 'path'; import * as ts from 'typescript'; -import type { ParseSettings } from '../parseSettings'; -import type { ASTAndProgram } from './shared'; +import type { ASTAndDefiniteProgram } from './shared'; import { CORE_COMPILER_OPTIONS, getAstFromProgram } from './shared'; const log = debug('typescript-eslint:typescript-estree:useProvidedProgram'); +export interface ProvidedProgramsSettings { + filePath: string; + tsconfigRootDir: string; +} + function useProvidedPrograms( programInstances: Iterable, - parseSettings: ParseSettings, -): ASTAndProgram | undefined { - log( - 'Retrieving ast for %s from provided program instance(s)', - parseSettings.filePath, - ); + { filePath, tsconfigRootDir }: ProvidedProgramsSettings, +): ASTAndDefiniteProgram | undefined { + log('Retrieving ast for %s from provided program instance(s)', filePath); - let astAndProgram: ASTAndProgram | undefined; + let astAndProgram: ASTAndDefiniteProgram | undefined; for (const programInstance of programInstances) { - astAndProgram = getAstFromProgram(programInstance, parseSettings); + astAndProgram = getAstFromProgram(programInstance, filePath); // Stop at the first applicable program instance if (astAndProgram) { break; @@ -29,8 +30,8 @@ function useProvidedPrograms( if (!astAndProgram) { const relativeFilePath = path.relative( - parseSettings.tsconfigRootDir || process.cwd(), - parseSettings.filePath, + tsconfigRootDir || process.cwd(), + filePath, ); const errorLines = [ '"parserOptions.programs" has been provided for @typescript-eslint/parser.', diff --git a/packages/typescript-estree/src/createParserServices.ts b/packages/typescript-estree/src/createParserServices.ts new file mode 100644 index 00000000000..1e62bdbe351 --- /dev/null +++ b/packages/typescript-estree/src/createParserServices.ts @@ -0,0 +1,27 @@ +import type * as ts from 'typescript'; + +import type { ASTMaps } from './convert'; +import type { ParserServices } from './parser-options'; + +export function createParserServices( + astMaps: ASTMaps, + program: ts.Program | null, +): ParserServices { + if (!program) { + // we always return the node maps because + // (a) they don't require type info and + // (b) they can be useful when using some of TS's internal non-type-aware AST utils + return { program, ...astMaps }; + } + + const checker = program.getTypeChecker(); + + return { + program, + ...astMaps, + getSymbolAtLocation: node => + checker.getSymbolAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)), + getTypeAtLocation: node => + checker.getTypeAtLocation(astMaps.esTreeNodeToTSNodeMap.get(node)), + }; +} diff --git a/packages/typescript-estree/src/getModifiers.ts b/packages/typescript-estree/src/getModifiers.ts index 24ef670a2c0..0ccb3026a90 100644 --- a/packages/typescript-estree/src/getModifiers.ts +++ b/packages/typescript-estree/src/getModifiers.ts @@ -6,16 +6,17 @@ const isAtLeast48 = typescriptVersionIsAtLeast['4.8']; export function getModifiers( node: ts.Node | null | undefined, -): undefined | ts.Modifier[] { + includeIllegalModifiers = false, +): ts.Modifier[] | undefined { if (node == null) { return undefined; } if (isAtLeast48) { // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded - if (ts.canHaveModifiers(node)) { + if (includeIllegalModifiers || ts.canHaveModifiers(node)) { // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded - const modifiers = ts.getModifiers(node); + const modifiers = ts.getModifiers(node as ts.HasModifiers); return modifiers ? Array.from(modifiers) : undefined; } @@ -32,16 +33,17 @@ export function getModifiers( export function getDecorators( node: ts.Node | null | undefined, -): undefined | ts.Decorator[] { + includeIllegalDecorators = false, +): ts.Decorator[] | undefined { if (node == null) { return undefined; } if (isAtLeast48) { // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded - if (ts.canHaveDecorators(node)) { + if (includeIllegalDecorators || ts.canHaveDecorators(node)) { // eslint-disable-next-line deprecation/deprecation -- this is safe as it's guarded - const decorators = ts.getDecorators(node); + const decorators = ts.getDecorators(node as ts.HasDecorators); return decorators ? Array.from(decorators) : undefined; } diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 511ba6c769c..c86262b7cd9 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -2,22 +2,24 @@ export { AST, parse, parseAndGenerateServices, - parseWithNodeMaps, ParseAndGenerateServicesResult, - ParseWithNodeMapsResult, } from './parser'; -export { ParserServices, TSESTreeOptions } from './parser-options'; +export { + ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, + TSESTreeOptions, +} from './parser-options'; export { simpleTraverse } from './simple-traverse'; export * from './ts-estree'; export { createProgramFromConfigFile as createProgram } from './create-program/useProvidedPrograms'; export * from './create-program/getScriptKind'; +export { getCanonicalFileName } from './create-program/shared'; export { typescriptVersionIsAtLeast } from './version-check'; export * from './getModifiers'; +export { TSError } from './node-utils'; export * from './clear-caches'; -// re-export for backwards-compat -export { visitorKeys } from '@typescript-eslint/visitor-keys'; - // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access export const version: string = require('../package.json').version; diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 4be3ae8e373..e9bb2c44523 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -2,7 +2,7 @@ import * as ts from 'typescript'; import { getModifiers } from './getModifiers'; import { xhtmlEntities } from './jsx/xhtml-entities'; -import type { TSESTree } from './ts-estree'; +import type { TSESTree, TSNode } from './ts-estree'; import { AST_NODE_TYPES, AST_TOKEN_TYPES } from './ts-estree'; import { typescriptVersionIsAtLeast } from './version-check'; @@ -10,36 +10,84 @@ const isAtLeast50 = typescriptVersionIsAtLeast['5.0']; const SyntaxKind = ts.SyntaxKind; -const LOGICAL_OPERATORS: ( - | ts.LogicalOperator - | ts.SyntaxKind.QuestionQuestionToken -)[] = [ +type LogicalOperatorKind = + | ts.SyntaxKind.AmpersandAmpersandToken + | ts.SyntaxKind.BarBarToken + | ts.SyntaxKind.QuestionQuestionToken; +const LOGICAL_OPERATORS: ReadonlySet = new Set([ SyntaxKind.BarBarToken, SyntaxKind.AmpersandAmpersandToken, SyntaxKind.QuestionQuestionToken, -]; +]); -interface TokenToText extends TSESTree.PunctuatorTokenToText { +interface TokenToText + extends TSESTree.PunctuatorTokenToText, + TSESTree.BinaryOperatorToText { [SyntaxKind.ImportKeyword]: 'import'; - [SyntaxKind.InKeyword]: 'in'; - [SyntaxKind.InstanceOfKeyword]: 'instanceof'; [SyntaxKind.NewKeyword]: 'new'; [SyntaxKind.KeyOfKeyword]: 'keyof'; [SyntaxKind.ReadonlyKeyword]: 'readonly'; [SyntaxKind.UniqueKeyword]: 'unique'; } +type AssignmentOperatorKind = keyof TSESTree.AssignmentOperatorToText; +const ASSIGNMENT_OPERATORS: ReadonlySet = new Set([ + ts.SyntaxKind.EqualsToken, + ts.SyntaxKind.PlusEqualsToken, + ts.SyntaxKind.MinusEqualsToken, + ts.SyntaxKind.AsteriskEqualsToken, + ts.SyntaxKind.AsteriskAsteriskEqualsToken, + ts.SyntaxKind.SlashEqualsToken, + ts.SyntaxKind.PercentEqualsToken, + ts.SyntaxKind.LessThanLessThanEqualsToken, + ts.SyntaxKind.GreaterThanGreaterThanEqualsToken, + ts.SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, + ts.SyntaxKind.AmpersandEqualsToken, + ts.SyntaxKind.BarEqualsToken, + ts.SyntaxKind.BarBarEqualsToken, + ts.SyntaxKind.AmpersandAmpersandEqualsToken, + ts.SyntaxKind.QuestionQuestionEqualsToken, + ts.SyntaxKind.CaretEqualsToken, +]); + +type BinaryOperatorKind = keyof TSESTree.BinaryOperatorToText; +const BINARY_OPERATORS: ReadonlySet = new Set([ + SyntaxKind.InstanceOfKeyword, + SyntaxKind.InKeyword, + SyntaxKind.AsteriskAsteriskToken, + SyntaxKind.AsteriskToken, + SyntaxKind.SlashToken, + SyntaxKind.PercentToken, + SyntaxKind.PlusToken, + SyntaxKind.MinusToken, + SyntaxKind.AmpersandToken, + SyntaxKind.BarToken, + SyntaxKind.CaretToken, + SyntaxKind.LessThanLessThanToken, + SyntaxKind.GreaterThanGreaterThanToken, + SyntaxKind.GreaterThanGreaterThanGreaterThanToken, + SyntaxKind.AmpersandAmpersandToken, + SyntaxKind.BarBarToken, + SyntaxKind.LessThanToken, + SyntaxKind.LessThanEqualsToken, + SyntaxKind.GreaterThanToken, + SyntaxKind.GreaterThanEqualsToken, + SyntaxKind.EqualsEqualsToken, + SyntaxKind.EqualsEqualsEqualsToken, + SyntaxKind.ExclamationEqualsEqualsToken, + SyntaxKind.ExclamationEqualsToken, +]); + /** * Returns true if the given ts.Token is the assignment operator * @param operator the operator token * @returns is assignment */ -export function isAssignmentOperator( - operator: ts.Token, -): boolean { - return ( - operator.kind >= SyntaxKind.FirstAssignment && - operator.kind <= SyntaxKind.LastAssignment +function isAssignmentOperator( + operator: ts.BinaryOperatorToken, +): operator is ts.Token { + return (ASSIGNMENT_OPERATORS as ReadonlySet).has( + operator.kind, ); } @@ -48,12 +96,21 @@ export function isAssignmentOperator( * @param operator the operator token * @returns is a logical operator */ -export function isLogicalOperator( - operator: ts.Token, -): boolean { - return (LOGICAL_OPERATORS as ts.SyntaxKind[]).includes(operator.kind); +export function isLogicalOperator( + operator: ts.BinaryOperatorToken, +): operator is ts.Token { + return (LOGICAL_OPERATORS as ReadonlySet).has(operator.kind); +} + +export function isESTreeBinaryOperator( + operator: ts.BinaryOperatorToken, +): operator is ts.Token { + return (BINARY_OPERATORS as ReadonlySet).has(operator.kind); } +type TokenForTokenKind = T extends keyof TokenToText + ? TokenToText[T] + : string | undefined; /** * Returns the string form of the given TSToken SyntaxKind * @param kind the token's SyntaxKind @@ -61,7 +118,7 @@ export function isLogicalOperator( */ export function getTextForTokenKind( kind: T, -): T extends keyof TokenToText ? TokenToText[T] : string | undefined { +): TokenForTokenKind { return ts.tokenToString(kind) as T extends keyof TokenToText ? TokenToText[T] : string | undefined; @@ -131,7 +188,7 @@ export function isComment(node: ts.Node): boolean { * @param node the TypeScript node * @returns is JSDoc comment */ -export function isJSDocComment(node: ts.Node): node is ts.JSDoc { +function isJSDocComment(node: ts.Node): node is ts.JSDoc { return node.kind === SyntaxKind.JSDocComment; } @@ -140,18 +197,39 @@ export function isJSDocComment(node: ts.Node): node is ts.JSDoc { * @param operator the operator token * @returns the binary expression type */ -export function getBinaryExpressionType( - operator: ts.Token, -): - | AST_NODE_TYPES.AssignmentExpression - | AST_NODE_TYPES.LogicalExpression - | AST_NODE_TYPES.BinaryExpression { +export function getBinaryExpressionType(operator: ts.BinaryOperatorToken): + | { + type: AST_NODE_TYPES.AssignmentExpression; + operator: TokenForTokenKind; + } + | { + type: AST_NODE_TYPES.BinaryExpression; + operator: TokenForTokenKind; + } + | { + type: AST_NODE_TYPES.LogicalExpression; + operator: TokenForTokenKind; + } { if (isAssignmentOperator(operator)) { - return AST_NODE_TYPES.AssignmentExpression; + return { + type: AST_NODE_TYPES.AssignmentExpression, + operator: getTextForTokenKind(operator.kind), + }; } else if (isLogicalOperator(operator)) { - return AST_NODE_TYPES.LogicalExpression; + return { + type: AST_NODE_TYPES.LogicalExpression, + operator: getTextForTokenKind(operator.kind), + }; + } else if (isESTreeBinaryOperator(operator)) { + return { + type: AST_NODE_TYPES.BinaryExpression, + operator: getTextForTokenKind(operator.kind), + }; } - return AST_NODE_TYPES.BinaryExpression; + + throw new Error( + `Unexpected binary operator ${ts.tokenToString(operator.kind)}`, + ); } /** @@ -174,20 +252,16 @@ export function getLineAndCharacterFor( /** * Returns line and column data for the given start and end positions, * for the given AST - * @param start start data - * @param end end data + * @param range start end data * @param ast the AST object * @returns the loc data */ export function getLocFor( - start: number, - end: number, + range: TSESTree.Range, ast: ts.SourceFile, ): TSESTree.SourceLocation { - return { - start: getLineAndCharacterFor(start, ast), - end: getLineAndCharacterFor(end, ast), - }; + const [start, end] = range.map(pos => getLineAndCharacterFor(pos, ast)); + return { start, end }; } /** @@ -197,10 +271,10 @@ export function getLocFor( */ export function canContainDirective( node: - | ts.SourceFile | ts.Block + | ts.ClassStaticBlockDeclaration | ts.ModuleBlock - | ts.ClassStaticBlockDeclaration, + | ts.SourceFile, ): boolean { if (node.kind === ts.SyntaxKind.Block) { switch (node.parent.kind) { @@ -225,7 +299,10 @@ export function canContainDirective( * @param ast the AST object * @returns the range data */ -export function getRange(node: ts.Node, ast: ts.SourceFile): [number, number] { +export function getRange( + node: Pick, + ast: ts.SourceFile, +): [number, number] { return [node.getStart(ast), node.getEnd()]; } @@ -234,7 +311,7 @@ export function getRange(node: ts.Node, ast: ts.SourceFile): [number, number] { * @param node the ts.Node * @returns is a token */ -export function isToken(node: ts.Node): node is ts.Token { +function isToken(node: ts.Node): node is ts.Token { return ( node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken ); @@ -258,7 +335,7 @@ export function isJSXToken(node: ts.Node): boolean { */ export function getDeclarationKind( node: ts.VariableDeclarationList, -): 'let' | 'const' | 'var' { +): 'const' | 'let' | 'var' { if (node.flags & ts.NodeFlags.Let) { return 'let'; } @@ -275,10 +352,10 @@ export function getDeclarationKind( */ export function getTSNodeAccessibility( node: ts.Node, -): 'public' | 'protected' | 'private' | null { +): 'private' | 'protected' | 'public' | undefined { const modifiers = getModifiers(node); if (modifiers == null) { - return null; + return undefined; } for (const modifier of modifiers) { switch (modifier.kind) { @@ -292,7 +369,7 @@ export function getTSNodeAccessibility( break; } } - return null; + return undefined; } /** @@ -415,10 +492,10 @@ export function isChainExpression( */ export function isChildUnwrappableOptionalChain( node: - | ts.PropertyAccessExpression - | ts.ElementAccessExpression | ts.CallExpression - | ts.NonNullExpression, + | ts.ElementAccessExpression + | ts.NonNullExpression + | ts.PropertyAccessExpression, child: TSESTree.Node, ): boolean { return ( @@ -435,7 +512,7 @@ export function isChildUnwrappableOptionalChain( */ export function getTokenType( token: ts.Identifier | ts.Token, -): Exclude { +): Exclude { let keywordKind: ts.SyntaxKind | undefined; if (isAtLeast50 && token.kind === SyntaxKind.Identifier) { keywordKind = ts.identifierToKeywordKind(token as ts.Identifier); @@ -494,9 +571,8 @@ export function getTokenType( // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, // must actually be an ESTree-JSXText token if ( - token.parent && - (token.parent.kind === SyntaxKind.JsxAttribute || - token.parent.kind === SyntaxKind.JsxElement) + token.parent.kind === SyntaxKind.JsxAttribute || + token.parent.kind === SyntaxKind.JsxElement ) { return AST_TOKEN_TYPES.JSXText; } @@ -516,7 +592,7 @@ export function getTokenType( } // Some JSX tokens have to be determined based on their parent - if (token.parent && token.kind === SyntaxKind.Identifier) { + if (token.kind === SyntaxKind.Identifier) { if (isJSXToken(token.parent)) { return AST_TOKEN_TYPES.JSXIdentifier; } @@ -549,13 +625,15 @@ export function convertToken( const end = token.getEnd(); const value = ast.text.slice(start, end); const tokenType = getTokenType(token); + const range: TSESTree.Range = [start, end]; + const loc = getLocFor(range, ast); if (tokenType === AST_TOKEN_TYPES.RegularExpression) { return { type: tokenType, value, - range: [start, end], - loc: getLocFor(start, end, ast), + range, + loc, regex: { pattern: value.slice(1, value.lastIndexOf('/')), flags: value.slice(value.lastIndexOf('/') + 1), @@ -567,8 +645,8 @@ export function convertToken( return { type: tokenType, value, - range: [start, end], - loc: getLocFor(start, end, ast), + range, + loc, }; } } @@ -608,9 +686,18 @@ export class TSError extends Error { constructor( message: string, public readonly fileName: string, - public readonly index: number, - public readonly lineNumber: number, - public readonly column: number, + public readonly location: { + start: { + line: number; + column: number; + offset: number; + }; + end: { + line: number; + column: number; + offset: number; + }; + }, ) { super(message); Object.defineProperty(this, 'name', { @@ -619,21 +706,51 @@ export class TSError extends Error { configurable: true, }); } + + // For old version of ESLint https://github.com/typescript-eslint/typescript-eslint/pull/6556#discussion_r1123237311 + get index(): number { + return this.location.start.offset; + } + + // https://github.com/eslint/eslint/blob/b09a512107249a4eb19ef5a37b0bd672266eafdb/lib/linter/linter.js#L853 + get lineNumber(): number { + return this.location.start.line; + } + + // https://github.com/eslint/eslint/blob/b09a512107249a4eb19ef5a37b0bd672266eafdb/lib/linter/linter.js#L854 + get column(): number { + return this.location.start.column; + } } /** - * @param ast the AST object - * @param start the index at which the error starts * @param message the error message + * @param ast the AST object + * @param startIndex the index at which the error starts + * @param endIndex the index at which the error ends * @returns converted error object */ export function createError( - ast: ts.SourceFile, - start: number, message: string, + ast: ts.SourceFile, + startIndex: number, + endIndex: number = startIndex, ): TSError { - const loc = ast.getLineAndCharacterOfPosition(start); - return new TSError(message, ast.fileName, start, loc.line + 1, loc.character); + const [start, end] = [startIndex, endIndex].map(offset => { + const { line, character: column } = + ast.getLineAndCharacterOfPosition(offset); + return { line: line + 1, column, offset }; + }); + return new TSError(message, ast.fileName, { start, end }); +} + +export function nodeHasIllegalDecorators( + node: ts.Node, +): node is ts.Node & { illegalDecorators: ts.Node[] } { + return !!( + 'illegalDecorators' in node && + (node.illegalDecorators as unknown[] | undefined)?.length + ); } /** @@ -701,3 +818,110 @@ export function isThisInTypeQuery(node: ts.Node): boolean { return node.parent.kind === SyntaxKind.TypeQuery; } + +// `ts.nodeIsMissing` +function nodeIsMissing(node: ts.Node | undefined): boolean { + if (node === undefined) { + return true; + } + return ( + node.pos === node.end && + node.pos >= 0 && + node.kind !== SyntaxKind.EndOfFileToken + ); +} + +// `ts.nodeIsPresent` +export function nodeIsPresent(node: ts.Node | undefined): node is ts.Node { + return !nodeIsMissing(node); +} + +// `ts.getContainingFunction` +export function getContainingFunction( + node: ts.Node, +): ts.SignatureDeclaration | undefined { + return ts.findAncestor(node.parent, ts.isFunctionLike); +} + +// `ts.hasAbstractModifier` +function hasAbstractModifier(node: ts.Node): boolean { + return hasModifier(SyntaxKind.AbstractKeyword, node); +} + +// `ts.getThisParameter` +function getThisParameter( + signature: ts.SignatureDeclaration, +): ts.ParameterDeclaration | null { + if (signature.parameters.length && !ts.isJSDocSignature(signature)) { + const thisParameter = signature.parameters[0]; + if (parameterIsThisKeyword(thisParameter)) { + return thisParameter; + } + } + + return null; +} + +// `ts.parameterIsThisKeyword` +function parameterIsThisKeyword(parameter: ts.ParameterDeclaration): boolean { + return isThisIdentifier(parameter.name); +} + +// Rewrite version of `ts.nodeCanBeDecorated` +// Returns `true` for both `useLegacyDecorators: true` and `useLegacyDecorators: false` +export function nodeCanBeDecorated(node: TSNode): boolean { + switch (node.kind) { + case SyntaxKind.ClassDeclaration: + return true; + case SyntaxKind.ClassExpression: + // `ts.nodeCanBeDecorated` returns `false` if `useLegacyDecorators: true` + return true; + case SyntaxKind.PropertyDeclaration: { + const { parent } = node; + + // `ts.nodeCanBeDecorated` uses this if `useLegacyDecorators: true` + if (ts.isClassDeclaration(parent)) { + return true; + } + + // `ts.nodeCanBeDecorated` uses this if `useLegacyDecorators: false` + if (ts.isClassLike(parent) && !hasAbstractModifier(node)) { + return true; + } + + return false; + } + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: { + const { parent } = node; + // In `ts.nodeCanBeDecorated` + // when `useLegacyDecorators: true` uses `ts.isClassDeclaration` + // when `useLegacyDecorators: true` uses `ts.isClassLike` + return ( + Boolean(node.body) && + (ts.isClassDeclaration(parent) || ts.isClassLike(parent)) + ); + } + case SyntaxKind.Parameter: { + // `ts.nodeCanBeDecorated` returns `false` if `useLegacyDecorators: false` + + const { parent } = node; + const grandparent = parent.parent; + + return ( + Boolean(parent) && + 'body' in parent && + Boolean(parent.body) && + (parent.kind === SyntaxKind.Constructor || + parent.kind === SyntaxKind.MethodDeclaration || + parent.kind === SyntaxKind.SetAccessor) && + getThisParameter(parent) !== node && + Boolean(grandparent) && + grandparent.kind === SyntaxKind.ClassDeclaration + ); + } + } + + return false; +} diff --git a/packages/typescript-estree/src/parseSettings/createParseSettings.ts b/packages/typescript-estree/src/parseSettings/createParseSettings.ts index 7518b0b686c..3062a6164b3 100644 --- a/packages/typescript-estree/src/parseSettings/createParseSettings.ts +++ b/packages/typescript-estree/src/parseSettings/createParseSettings.ts @@ -1,7 +1,11 @@ import debug from 'debug'; +import type * as ts from 'typescript'; +import type { TypeScriptProjectService } from '../create-program/createProjectService'; +import { createProjectService } from '../create-program/createProjectService'; import { ensureAbsolutePath } from '../create-program/shared'; import type { TSESTreeOptions } from '../parser-options'; +import { isSourceFile } from '../source-files'; import { DEFAULT_TSCONFIG_CACHE_DURATION_SECONDS, ExpiringCache, @@ -17,21 +21,27 @@ const log = debug( ); let TSCONFIG_MATCH_CACHE: ExpiringCache | null; +let TSSERVER_PROJECT_SERVICE: TypeScriptProjectService | null = null; export function createParseSettings( - code: string, + code: ts.SourceFile | string, options: Partial = {}, ): MutableParseSettings { + const codeFullText = enforceCodeString(code); const singleRun = inferSingleRun(options); const tsconfigRootDir = typeof options.tsconfigRootDir === 'string' ? options.tsconfigRootDir : process.cwd(); const parseSettings: MutableParseSettings = { - code: enforceString(code), + allowInvalidAST: options.allowInvalidAST === true, + code, + codeFullText, comment: options.comment === true, comments: [], - createDefaultProgram: options.createDefaultProgram === true, + DEPRECATED__createDefaultProgram: + // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major + options.DEPRECATED__createDefaultProgram === true, debugLevel: options.debugLevel === true ? new Set(['typescript-eslint']) @@ -40,6 +50,13 @@ export function createParseSettings( : new Set(), errorOnTypeScriptSyntacticAndSemanticIssues: false, errorOnUnknownASTType: options.errorOnUnknownASTType === true, + EXPERIMENTAL_projectService: + (options.EXPERIMENTAL_useProjectService === true && + process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'false') || + (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER === 'true' && + options.EXPERIMENTAL_useProjectService !== false) + ? (TSSERVER_PROJECT_SERVICE ??= createProjectService()) + : undefined, EXPERIMENTAL_useSourceOfProjectReferenceRedirect: options.EXPERIMENTAL_useSourceOfProjectReferenceRedirect === true, extraFileExtensions: @@ -59,14 +76,16 @@ export function createParseSettings( typeof options.loggerFn === 'function' ? options.loggerFn : options.loggerFn === false - ? (): void => {} + ? (): void => {} // eslint-disable-line @typescript-eslint/no-empty-function : console.log, // eslint-disable-line no-console - moduleResolver: options.moduleResolver ?? '', preserveNodeMaps: options.preserveNodeMaps !== false, programs: Array.isArray(options.programs) ? options.programs : null, projects: [], range: options.range === true, singleRun, + suppressDeprecatedPropertyWarnings: + options.suppressDeprecatedPropertyWarnings ?? + process.env.NODE_ENV !== 'test', tokens: options.tokens === true ? [] : null, tsconfigMatchCache: (TSCONFIG_MATCH_CACHE ??= new ExpiringCache( singleRun @@ -105,8 +124,8 @@ export function createParseSettings( ); } - // Providing a program overrides project resolution - if (!parseSettings.programs) { + // Providing a program or project service overrides project resolution + if (!parseSettings.programs && !parseSettings.EXPERIMENTAL_projectService) { parseSettings.projects = resolveProjectList({ cacheLifetime: options.cacheLifetime, project: getProjectConfigFiles(parseSettings, options.project), @@ -125,15 +144,19 @@ export function clearTSConfigMatchCache(): void { TSCONFIG_MATCH_CACHE?.clear(); } +export function clearTSServerProjectService(): void { + TSSERVER_PROJECT_SERVICE = null; +} + /** * Ensures source code is a string. */ -function enforceString(code: unknown): string { - if (typeof code !== 'string') { - return String(code); - } - - return code; +function enforceCodeString(code: unknown): string { + return isSourceFile(code) + ? code.getFullText(code) + : typeof code === 'string' + ? code + : String(code); } /** diff --git a/packages/typescript-estree/src/parseSettings/getProjectConfigFiles.ts b/packages/typescript-estree/src/parseSettings/getProjectConfigFiles.ts index d3b97d6102a..64af27985f0 100644 --- a/packages/typescript-estree/src/parseSettings/getProjectConfigFiles.ts +++ b/packages/typescript-estree/src/parseSettings/getProjectConfigFiles.ts @@ -20,12 +20,16 @@ export function getProjectConfigFiles( ParseSettings, 'filePath' | 'tsconfigMatchCache' | 'tsconfigRootDir' >, - project: string | string[] | true | undefined, -): string[] | undefined { + project: string[] | string | true | null | undefined, +): string[] | null { if (project !== true) { - return project === undefined || Array.isArray(project) - ? project - : [project]; + if (project == null) { + return null; + } + if (Array.isArray(project)) { + return project; + } + return [project]; } log('Looking for tsconfig.json at or above file: %s', parseSettings.filePath); diff --git a/packages/typescript-estree/src/parseSettings/index.ts b/packages/typescript-estree/src/parseSettings/index.ts index 11df4c78489..da093dedfed 100644 --- a/packages/typescript-estree/src/parseSettings/index.ts +++ b/packages/typescript-estree/src/parseSettings/index.ts @@ -1,19 +1,30 @@ import type * as ts from 'typescript'; +import type * as tsserverlibrary from 'typescript/lib/tsserverlibrary'; import type { CanonicalPath } from '../create-program/shared'; import type { TSESTree } from '../ts-estree'; import type { CacheLike } from './ExpiringCache'; -type DebugModule = 'typescript-eslint' | 'eslint' | 'typescript'; +type DebugModule = 'eslint' | 'typescript-eslint' | 'typescript'; /** * Internal settings used by the parser to run on a file. */ export interface MutableParseSettings { /** - * Code of the file being parsed. + * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. */ - code: string; + allowInvalidAST: boolean; + + /** + * Code of the file being parsed, or raw source file containing it. + */ + code: ts.SourceFile | string; + + /** + * Full text of the file being parsed. + */ + codeFullText: string; /** * Whether the `comment` parse option is enabled. @@ -26,9 +37,11 @@ export interface MutableParseSettings { comments: TSESTree.Comment[]; /** - * Whether to create a TypeScript program if one is not provided. + * @deprecated + * This is a legacy option that comes with severe performance penalties. + * Please do not use it. */ - createDefaultProgram: boolean; + DEPRECATED__createDefaultProgram: boolean; /** * Which debug areas should be logged. @@ -45,6 +58,13 @@ export interface MutableParseSettings { */ errorOnUnknownASTType: boolean; + /** + * Experimental: TypeScript server to power program creation. + */ + EXPERIMENTAL_projectService: + | tsserverlibrary.server.ProjectService + | undefined; + /** * Whether TS should use the source files for referenced projects instead of the compiled .d.ts files. * @@ -81,11 +101,6 @@ export interface MutableParseSettings { */ log: (message: string) => void; - /** - * Path for a module resolver to use for the compiler host's `resolveModuleNames`. - */ - moduleResolver: string; - /** * Whether two-way AST node maps are preserved during the AST conversion process. */ @@ -94,7 +109,7 @@ export interface MutableParseSettings { /** * One or more instances of TypeScript Program objects to be used for type information. */ - programs: null | Iterable; + programs: Iterable | null; /** * Normalized paths to provided project paths. @@ -111,10 +126,15 @@ export interface MutableParseSettings { */ singleRun: boolean; + /** + * Whether deprecated AST properties should skip calling console.warn on accesses. + */ + suppressDeprecatedPropertyWarnings: boolean; + /** * If the `tokens` parse option is enabled, retrieved tokens. */ - tokens: null | TSESTree.Token[]; + tokens: TSESTree.Token[] | null; /** * Caches searches for TSConfigs from project directories. diff --git a/packages/typescript-estree/src/parseSettings/resolveProjectList.ts b/packages/typescript-estree/src/parseSettings/resolveProjectList.ts index f9d935b88cd..9c3b8480499 100644 --- a/packages/typescript-estree/src/parseSettings/resolveProjectList.ts +++ b/packages/typescript-estree/src/parseSettings/resolveProjectList.ts @@ -31,7 +31,7 @@ export function clearGlobCache(): void { export function resolveProjectList( options: Readonly<{ cacheLifetime?: TSESTreeOptions['cacheLifetime']; - project: TSESTreeOptions['project']; + project: string[] | null; projectFolderIgnoreList: TSESTreeOptions['projectFolderIgnoreList']; singleRun: boolean; tsconfigRootDir: string; @@ -40,9 +40,7 @@ export function resolveProjectList( const sanitizedProjects: string[] = []; // Normalize and sanitize the project paths - if (typeof options.project === 'string') { - sanitizedProjects.push(options.project); - } else if (Array.isArray(options.project)) { + if (options.project != null) { for (const project of options.project) { if (typeof project === 'string') { sanitizedProjects.push(project); diff --git a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts index 5d0069ed160..682f7dcc35f 100644 --- a/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts +++ b/packages/typescript-estree/src/parseSettings/warnAboutTSVersion.ts @@ -3,16 +3,16 @@ import * as ts from 'typescript'; import type { ParseSettings } from './index'; /** - * This needs to be kept in sync with /docs/maintenance/Versioning.md + * This needs to be kept in sync with /docs/maintenance/Versioning.mdx * in the typescript-eslint monorepo */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.3.1 <5.1.0'; +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=4.3.5 <5.2.0'; /* * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one * List them all separately here, so we can automatically create the full string */ -const SUPPORTED_PRERELEASE_RANGES: string[] = ['5.0.1-rc']; +const SUPPORTED_PRERELEASE_RANGES: string[] = []; const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies( ACTIVE_TYPESCRIPT_VERSION, diff --git a/packages/typescript-estree/src/parser-options.ts b/packages/typescript-estree/src/parser-options.ts index 57feea09427..711ef4bca34 100644 --- a/packages/typescript-estree/src/parser-options.ts +++ b/packages/typescript-estree/src/parser-options.ts @@ -11,6 +11,12 @@ import type { TSESTree, TSESTreeToTSNode, TSNode, TSToken } from './ts-estree'; ////////////////////////////////////////////////////////// interface ParseOptions { + /** + * Prevents the parser from throwing an error if it receives an invalid AST from TypeScript. + * This case only usually occurs when attempting to lint invalid code. + */ + allowInvalidAST?: boolean; + /** * create a top-level comments array containing all comments */ @@ -62,7 +68,7 @@ interface ParseOptions { * When value is `false`, no logging will occur. * When value is not provided, `console.log()` will be used. */ - loggerFn?: ((message: string) => void) | false; + loggerFn?: false | ((message: string) => void); /** * Controls whether the `range` property is included on AST nodes. @@ -75,6 +81,11 @@ interface ParseOptions { * Set to true to create a top-level array containing all tokens from the file. */ tokens?: boolean; + + /** + * Whether deprecated AST properties should skip calling console.warn on accesses. + */ + suppressDeprecatedPropertyWarnings?: boolean; } interface ParseAndGenerateServicesOptions extends ParseOptions { @@ -83,6 +94,15 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; + /** + * ***EXPERIMENTAL FLAG*** - Use this at your own risk. + * + * Whether to create a shared TypeScript server to power program creation. + * + * @see https://github.com/typescript-eslint/typescript-eslint/issues/6575 + */ + EXPERIMENTAL_useProjectService?: boolean; + /** * ***EXPERIMENTAL FLAG*** - Use this at your own risk. * @@ -91,7 +111,7 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { * * This flag REQUIRES at least TS v3.9, otherwise it does nothing. * - * See: https://github.com/typescript-eslint/typescript-eslint/issues/2094 + * @see https://github.com/typescript-eslint/typescript-eslint/issues/2094 */ EXPERIMENTAL_useSourceOfProjectReferenceRedirect?: boolean; @@ -124,7 +144,7 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { * or `true` to find the nearest tsconfig.json to the file. * If this is provided, type information will be returned. */ - project?: string | string[] | true; + project?: string[] | string | true | null; /** * If you provide a glob (or globs) to the project option, you can use this option to ignore certain folders from @@ -145,18 +165,13 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { * This overrides any program or programs that would have been computed from the `project` option. * All linted files must be part of the provided program(s). */ - programs?: ts.Program[]; + programs?: ts.Program[] | null; /** - *************************************************************************************** - * IT IS RECOMMENDED THAT YOU DO NOT USE THIS OPTION, AS IT CAUSES PERFORMANCE ISSUES. * - *************************************************************************************** - * - * When passed with `project`, this allows the parser to create a catch-all, default program. - * This means that if the parser encounters a file not included in any of the provided `project`s, - * it will not error, but will instead parse the file and its dependencies in a new program. + * @deprecated - this flag will be removed in the next major. + * Do not rely on the behavior provided by this flag. */ - createDefaultProgram?: boolean; + DEPRECATED__createDefaultProgram?: boolean; /** * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, @@ -187,11 +202,6 @@ interface ParseAndGenerateServicesOptions extends ParseOptions { */ glob?: CacheDurationSeconds; }; - - /** - * Path to a file exporting a custom `ModuleResolver`. - */ - moduleResolver?: string; } export type TSESTreeOptions = ParseAndGenerateServicesOptions; @@ -210,20 +220,20 @@ export interface ParserWeakMapESTreeToTSNode< has(key: unknown): boolean; } -export interface ParserServices { - program: ts.Program; +export interface ParserServicesNodeMaps { esTreeNodeToTSNodeMap: ParserWeakMapESTreeToTSNode; tsNodeToESTreeNodeMap: ParserWeakMap; - hasFullTypeInformation: boolean; } - -export interface ModuleResolver { - version: 1; - resolveModuleNames( - moduleNames: string[], - containingFile: string, - reusedNames: string[] | undefined, - redirectedReference: ts.ResolvedProjectReference | undefined, - options: ts.CompilerOptions, - ): (ts.ResolvedModule | undefined)[]; +export interface ParserServicesWithTypeInformation + extends ParserServicesNodeMaps { + program: ts.Program; + getSymbolAtLocation: (node: TSESTree.Node) => ts.Symbol | undefined; + getTypeAtLocation: (node: TSESTree.Node) => ts.Type; +} +export interface ParserServicesWithoutTypeInformation + extends ParserServicesNodeMaps { + program: null; } +export type ParserServices = + | ParserServicesWithoutTypeInformation + | ParserServicesWithTypeInformation; diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index b7f8c064dd6..4bf5dec26bd 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -6,17 +6,27 @@ import { convertError } from './convert'; import { createDefaultProgram } from './create-program/createDefaultProgram'; import { createIsolatedProgram } from './create-program/createIsolatedProgram'; import { createProjectProgram } from './create-program/createProjectProgram'; -import { createSourceFile } from './create-program/createSourceFile'; +import { + createNoProgram, + createSourceFile, +} from './create-program/createSourceFile'; +import { getWatchProgramsForProjects } from './create-program/getWatchProgramsForProjects'; import type { ASTAndProgram, CanonicalPath } from './create-program/shared'; import { createProgramFromConfigFile, useProvidedPrograms, } from './create-program/useProvidedPrograms'; -import type { ParserServices, TSESTreeOptions } from './parser-options'; +import { createParserServices } from './createParserServices'; +import type { + ParserServices, + ParserServicesNodeMaps, + TSESTreeOptions, +} from './parser-options'; import type { ParseSettings } from './parseSettings'; import { createParseSettings } from './parseSettings/createParseSettings'; import { getFirstSemanticOrSyntacticError } from './semantic-or-syntactic-errors'; import type { TSESTree } from './ts-estree'; +import { useProgramFromProjectService } from './useProgramFromProjectService'; const log = debug('typescript-eslint:typescript-estree:parser'); @@ -32,38 +42,72 @@ function clearProgramCache(): void { /** * @param parseSettings Internal settings for parsing the file - * @param shouldProvideParserServices True if the program should be attempted to be calculated from provided tsconfig files + * @param hasFullTypeInformation True if the program should be attempted to be calculated from provided tsconfig files * @returns Returns a source file and program corresponding to the linted code */ function getProgramAndAST( parseSettings: ParseSettings, - shouldProvideParserServices: boolean, + hasFullTypeInformation: boolean, ): ASTAndProgram { - return ( - (parseSettings.programs && - useProvidedPrograms(parseSettings.programs, parseSettings)) || - (shouldProvideParserServices && createProjectProgram(parseSettings)) || - (shouldProvideParserServices && - parseSettings.createDefaultProgram && - createDefaultProgram(parseSettings)) || - createIsolatedProgram(parseSettings) + if (parseSettings.EXPERIMENTAL_projectService) { + const fromProjectService = useProgramFromProjectService( + parseSettings.EXPERIMENTAL_projectService, + parseSettings, + ); + if (fromProjectService) { + return fromProjectService; + } + } + + if (parseSettings.programs) { + const fromProvidedPrograms = useProvidedPrograms( + parseSettings.programs, + parseSettings, + ); + if (fromProvidedPrograms) { + return fromProvidedPrograms; + } + } + + // no need to waste time creating a program as the caller didn't want parser services + // so we can save time and just create a lonesome source file + if (!hasFullTypeInformation) { + return createNoProgram(parseSettings); + } + + const fromProjectProgram = createProjectProgram( + parseSettings, + getWatchProgramsForProjects(parseSettings), ); + if (fromProjectProgram) { + return fromProjectProgram; + } + + // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major + if (parseSettings.DEPRECATED__createDefaultProgram) { + // eslint-disable-next-line deprecation/deprecation -- will be cleaned up with the next major + const fromDefaultProgram = createDefaultProgram(parseSettings); + if (fromDefaultProgram) { + return fromDefaultProgram; + } + } + + return createIsolatedProgram(parseSettings); } // eslint-disable-next-line @typescript-eslint/no-empty-interface interface EmptyObject {} type AST = TSESTree.Program & - (T['tokens'] extends true ? { tokens: TSESTree.Token[] } : EmptyObject) & - (T['comment'] extends true ? { comments: TSESTree.Comment[] } : EmptyObject); + (T['comment'] extends true ? { comments: TSESTree.Comment[] } : EmptyObject) & + (T['tokens'] extends true ? { tokens: TSESTree.Token[] } : EmptyObject); interface ParseAndGenerateServicesResult { ast: AST; services: ParserServices; } -interface ParseWithNodeMapsResult { +interface ParseWithNodeMapsResult + extends ParserServicesNodeMaps { ast: AST; - esTreeNodeToTSNodeMap: ParserServices['esTreeNodeToTSNodeMap']; - tsNodeToESTreeNodeMap: ParserServices['tsNodeToESTreeNodeMap']; } function parse( @@ -75,7 +119,7 @@ function parse( } function parseWithNodeMapsInternal( - code: string, + code: ts.SourceFile | string, options: T | undefined, shouldPreserveNodeMaps: boolean, ): ParseWithNodeMapsResult { @@ -114,13 +158,6 @@ function parseWithNodeMapsInternal( }; } -function parseWithNodeMaps( - code: string, - options?: T, -): ParseWithNodeMapsResult { - return parseWithNodeMapsInternal(code, options, true); -} - let parseAndGenerateServicesCalls: { [fileName: string]: number } = {}; // Privately exported utility intended for use in typescript-eslint unit tests only function clearParseAndGenerateServicesCalls(): void { @@ -128,7 +165,7 @@ function clearParseAndGenerateServicesCalls(): void { } function parseAndGenerateServices( - code: string, + code: ts.SourceFile | string, options: T, ): ParseAndGenerateServicesResult { /** @@ -136,16 +173,6 @@ function parseAndGenerateServices( */ const parseSettings = createParseSettings(code, options); - if (options !== undefined) { - if ( - typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === - 'boolean' && - options.errorOnTypeScriptSyntacticAndSemanticIssues - ) { - parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues = true; - } - } - /** * If this is a single run in which the user has not provided any existing programs but there * are programs which need to be created from the provided "project" option, @@ -179,9 +206,28 @@ function parseAndGenerateServices( /** * Generate a full ts.Program or offer provided instances in order to be able to provide parser services, such as type-checking */ - const shouldProvideParserServices = + const hasFullTypeInformation = parseSettings.programs != null || parseSettings.projects?.length > 0; + if (options !== undefined) { + if ( + typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === + 'boolean' && + options.errorOnTypeScriptSyntacticAndSemanticIssues + ) { + parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues = true; + } + + if ( + parseSettings.errorOnTypeScriptSyntacticAndSemanticIssues && + !hasFullTypeInformation + ) { + throw new Error( + 'Cannot calculate TypeScript semantic issues without a valid project.', + ); + } + } + /** * If we are in singleRun mode but the parseAndGenerateServices() function has been called more than once for the current file, * it must mean that we are in the middle of an ESLint automated fix cycle (in which parsing can be performed up to an additional @@ -200,7 +246,7 @@ function parseAndGenerateServices( options.filePath && parseAndGenerateServicesCalls[options.filePath] > 1 ? createIsolatedProgram(parseSettings) - : getProgramAndAST(parseSettings, shouldProvideParserServices)!; + : getProgramAndAST(parseSettings, hasFullTypeInformation)!; /** * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve @@ -233,12 +279,7 @@ function parseAndGenerateServices( */ return { ast: estree as AST, - services: { - hasFullTypeInformation: shouldProvideParserServices, - program, - esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, - }, + services: createParserServices(astMaps, program), }; } @@ -246,9 +287,7 @@ export { AST, parse, parseAndGenerateServices, - parseWithNodeMaps, ParseAndGenerateServicesResult, - ParseWithNodeMapsResult, clearProgramCache, clearParseAndGenerateServicesCalls, }; diff --git a/packages/typescript-estree/src/semantic-or-syntactic-errors.ts b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts index af6f33918df..0839409582c 100644 --- a/packages/typescript-estree/src/semantic-or-syntactic-errors.ts +++ b/packages/typescript-estree/src/semantic-or-syntactic-errors.ts @@ -22,18 +22,18 @@ export function getFirstSemanticOrSyntacticError( ast: SourceFile, ): SemanticOrSyntacticError | undefined { try { - const supportedSyntacticDiagnostics = whitelistSupportedDiagnostics( + const supportedSyntacticDiagnostics = allowlistSupportedDiagnostics( program.getSyntacticDiagnostics(ast), ); - if (supportedSyntacticDiagnostics.length) { + if (supportedSyntacticDiagnostics.length > 0) { return convertDiagnosticToSemanticOrSyntacticError( supportedSyntacticDiagnostics[0], ); } - const supportedSemanticDiagnostics = whitelistSupportedDiagnostics( + const supportedSemanticDiagnostics = allowlistSupportedDiagnostics( program.getSemanticDiagnostics(ast), ); - if (supportedSemanticDiagnostics.length) { + if (supportedSemanticDiagnostics.length > 0) { return convertDiagnosticToSemanticOrSyntacticError( supportedSemanticDiagnostics[0], ); @@ -57,9 +57,9 @@ export function getFirstSemanticOrSyntacticError( } } -function whitelistSupportedDiagnostics( - diagnostics: readonly (DiagnosticWithLocation | Diagnostic)[], -): readonly (DiagnosticWithLocation | Diagnostic)[] { +function allowlistSupportedDiagnostics( + diagnostics: readonly (Diagnostic | DiagnosticWithLocation)[], +): readonly (Diagnostic | DiagnosticWithLocation)[] { return diagnostics.filter(diagnostic => { switch (diagnostic.code) { case 1013: // "A rest parameter or binding pattern may not have a trailing comma." diff --git a/packages/typescript-estree/src/simple-traverse.ts b/packages/typescript-estree/src/simple-traverse.ts index 2d51cdbe4fa..bd6c3741c2c 100644 --- a/packages/typescript-estree/src/simple-traverse.ts +++ b/packages/typescript-estree/src/simple-traverse.ts @@ -1,11 +1,15 @@ +import type { VisitorKeys } from '@typescript-eslint/visitor-keys'; import { visitorKeys } from '@typescript-eslint/visitor-keys'; import type { TSESTree } from './ts-estree'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function isValidNode(x: any): x is TSESTree.Node { - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - return x != null && typeof x === 'object' && typeof x.type === 'string'; +function isValidNode(x: unknown): x is TSESTree.Node { + return ( + typeof x === 'object' && + x != null && + 'type' in x && + typeof x.type === 'string' + ); } function getVisitorKeysForNode( @@ -16,25 +20,33 @@ function getVisitorKeysForNode( return (keys ?? []) as never; } -type SimpleTraverseOptions = +type SimpleTraverseOptions = Readonly< | { + visitorKeys?: Readonly; enter: (node: TSESTree.Node, parent: TSESTree.Node | undefined) => void; } | { - [key: string]: ( - node: TSESTree.Node, - parent: TSESTree.Node | undefined, - ) => void; - }; + visitorKeys?: Readonly; + visitors: { + [key: string]: ( + node: TSESTree.Node, + parent: TSESTree.Node | undefined, + ) => void; + }; + } +>; class SimpleTraverser { - private readonly allVisitorKeys = visitorKeys; + private readonly allVisitorKeys: Readonly = visitorKeys; private readonly selectors: SimpleTraverseOptions; private readonly setParentPointers: boolean; constructor(selectors: SimpleTraverseOptions, setParentPointers = false) { this.selectors = selectors; this.setParentPointers = setParentPointers; + if (selectors.visitorKeys) { + this.allVisitorKeys = selectors.visitorKeys; + } } traverse(node: unknown, parent: TSESTree.Node | undefined): void { @@ -48,8 +60,8 @@ class SimpleTraverser { if ('enter' in this.selectors) { this.selectors.enter(node, parent); - } else if (node.type in this.selectors) { - this.selectors[node.type](node, parent); + } else if (node.type in this.selectors.visitors) { + this.selectors.visitors[node.type](node, parent); } const keys = getVisitorKeysForNode(this.allVisitorKeys, node); diff --git a/packages/typescript-estree/src/source-files.ts b/packages/typescript-estree/src/source-files.ts new file mode 100644 index 00000000000..8c4ae0fc87e --- /dev/null +++ b/packages/typescript-estree/src/source-files.ts @@ -0,0 +1,17 @@ +import * as ts from 'typescript'; + +export function isSourceFile(code: unknown): code is ts.SourceFile { + if (typeof code !== 'object' || code == null) { + return false; + } + + const maybeSourceFile = code as Partial; + return ( + maybeSourceFile.kind === ts.SyntaxKind.SourceFile && + typeof maybeSourceFile.getFullText === 'function' + ); +} + +export function getCodeText(code: ts.SourceFile | string): string { + return isSourceFile(code) ? code.getFullText(code) : code; +} 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 c080a83559b..4694c85445f 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 @@ -7,15 +7,15 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.AccessorProperty]: ts.PropertyDeclaration; [AST_NODE_TYPES.ArrayExpression]: ts.ArrayLiteralExpression; [AST_NODE_TYPES.ArrayPattern]: - | ts.ArrayLiteralExpression - | ts.ArrayBindingPattern; + | ts.ArrayBindingPattern + | ts.ArrayLiteralExpression; [AST_NODE_TYPES.ArrowFunctionExpression]: ts.ArrowFunction; [AST_NODE_TYPES.AssignmentExpression]: ts.BinaryExpression; [AST_NODE_TYPES.AssignmentPattern]: - | ts.ShorthandPropertyAssignment - | ts.BindingElement | ts.BinaryExpression - | ts.ParameterDeclaration; + | ts.BindingElement + | ts.ParameterDeclaration + | ts.ShorthandPropertyAssignment; [AST_NODE_TYPES.AwaitExpression]: ts.AwaitExpression; [AST_NODE_TYPES.BinaryExpression]: ts.BinaryExpression; [AST_NODE_TYPES.BlockStatement]: ts.Block; @@ -24,9 +24,9 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.CatchClause]: ts.CatchClause; [AST_NODE_TYPES.ChainExpression]: | ts.CallExpression - | ts.PropertyAccessExpression | ts.ElementAccessExpression - | ts.NonNullExpression; + | ts.NonNullExpression + | ts.PropertyAccessExpression; [AST_NODE_TYPES.ClassBody]: ts.ClassDeclaration | ts.ClassExpression; [AST_NODE_TYPES.ClassDeclaration]: ts.ClassDeclaration; [AST_NODE_TYPES.ClassExpression]: ts.ClassExpression; @@ -39,25 +39,26 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.EmptyStatement]: ts.EmptyStatement; [AST_NODE_TYPES.ExportAllDeclaration]: ts.ExportDeclaration; [AST_NODE_TYPES.ExportDefaultDeclaration]: + | ts.ClassDeclaration + | ts.ClassExpression + | ts.EnumDeclaration | ts.ExportAssignment | ts.FunctionDeclaration - | ts.VariableStatement + | ts.InterfaceDeclaration + | ts.ModuleDeclaration + | ts.TypeAliasDeclaration + | ts.VariableStatement; + [AST_NODE_TYPES.ExportNamedDeclaration]: | ts.ClassDeclaration | ts.ClassExpression - | ts.TypeAliasDeclaration - | ts.InterfaceDeclaration | ts.EnumDeclaration - | ts.ModuleDeclaration; - [AST_NODE_TYPES.ExportNamedDeclaration]: | ts.ExportDeclaration | ts.FunctionDeclaration - | ts.VariableStatement - | ts.ClassDeclaration - | ts.ClassExpression - | ts.TypeAliasDeclaration + | ts.ImportEqualsDeclaration | ts.InterfaceDeclaration - | ts.EnumDeclaration - | ts.ModuleDeclaration; + | ts.ModuleDeclaration + | ts.TypeAliasDeclaration + | ts.VariableStatement; [AST_NODE_TYPES.ExportSpecifier]: ts.ExportSpecifier; [AST_NODE_TYPES.ExpressionStatement]: ts.ExpressionStatement; [AST_NODE_TYPES.ForInStatement]: ts.ForInStatement; @@ -65,15 +66,15 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.ForStatement]: ts.ForStatement; [AST_NODE_TYPES.FunctionDeclaration]: ts.FunctionDeclaration; [AST_NODE_TYPES.FunctionExpression]: - | ts.FunctionExpression | ts.ConstructorDeclaration + | ts.FunctionExpression | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration - | ts.MethodDeclaration; + | ts.MethodDeclaration + | ts.SetAccessorDeclaration; [AST_NODE_TYPES.Identifier]: - | ts.Identifier | ts.ConstructorDeclaration - | ts.Token; + | ts.Identifier + | ts.Token; [AST_NODE_TYPES.PrivateIdentifier]: ts.PrivateIdentifier; [AST_NODE_TYPES.IfStatement]: ts.IfStatement; [AST_NODE_TYPES.ImportAttribute]: ts.AssertEntry; @@ -97,47 +98,47 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.JSXSpreadAttribute]: ts.JsxSpreadAttribute; [AST_NODE_TYPES.JSXSpreadChild]: ts.JsxExpression; [AST_NODE_TYPES.JSXMemberExpression]: ts.PropertyAccessExpression; - [AST_NODE_TYPES.JSXNamespacedName]: ts.Identifier | ts.ThisExpression; + [AST_NODE_TYPES.JSXNamespacedName]: ts.JsxNamespacedName; [AST_NODE_TYPES.JSXText]: ts.JsxText; [AST_NODE_TYPES.LabeledStatement]: ts.LabeledStatement; [AST_NODE_TYPES.Literal]: - | ts.StringLiteral + | ts.BigIntLiteral + | ts.BooleanLiteral + | ts.NullLiteral | ts.NumericLiteral | ts.RegularExpressionLiteral - | ts.NullLiteral - | ts.BooleanLiteral - | ts.BigIntLiteral; + | ts.StringLiteral; [AST_NODE_TYPES.LogicalExpression]: ts.BinaryExpression; [AST_NODE_TYPES.MemberExpression]: - | ts.PropertyAccessExpression - | ts.ElementAccessExpression; + | ts.ElementAccessExpression + | ts.PropertyAccessExpression; [AST_NODE_TYPES.MetaProperty]: ts.MetaProperty; [AST_NODE_TYPES.MethodDefinition]: + | ts.ConstructorDeclaration | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration | ts.MethodDeclaration - | ts.ConstructorDeclaration; + | ts.SetAccessorDeclaration; [AST_NODE_TYPES.NewExpression]: ts.NewExpression; [AST_NODE_TYPES.ObjectExpression]: ts.ObjectLiteralExpression; [AST_NODE_TYPES.ObjectPattern]: - | ts.ObjectLiteralExpression - | ts.ObjectBindingPattern; + | ts.ObjectBindingPattern + | ts.ObjectLiteralExpression; [AST_NODE_TYPES.Program]: ts.SourceFile; [AST_NODE_TYPES.Property]: - | ts.PropertyAssignment - | ts.ShorthandPropertyAssignment + | ts.BindingElement | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration | ts.MethodDeclaration - | ts.BindingElement; + | ts.PropertyAssignment + | ts.SetAccessorDeclaration + | ts.ShorthandPropertyAssignment; [AST_NODE_TYPES.RestElement]: | ts.BindingElement + | ts.ParameterDeclaration | ts.SpreadAssignment - | ts.SpreadElement - | ts.ParameterDeclaration; + | ts.SpreadElement; [AST_NODE_TYPES.ReturnStatement]: ts.ReturnStatement; [AST_NODE_TYPES.SequenceExpression]: ts.BinaryExpression; - [AST_NODE_TYPES.SpreadElement]: ts.SpreadElement | ts.SpreadAssignment; + [AST_NODE_TYPES.SpreadElement]: ts.SpreadAssignment | ts.SpreadElement; [AST_NODE_TYPES.StaticBlock]: ts.ClassStaticBlockDeclaration; [AST_NODE_TYPES.Super]: ts.SuperExpression; [AST_NODE_TYPES.SwitchCase]: ts.CaseClause | ts.DefaultClause; @@ -152,18 +153,18 @@ export interface EstreeToTsNodeTypes { | ts.NoSubstitutionTemplateLiteral | ts.TemplateExpression; [AST_NODE_TYPES.ThisExpression]: - | ts.ThisExpression + | ts.Identifier | ts.KeywordTypeNode - | ts.Identifier; + | ts.ThisExpression; [AST_NODE_TYPES.ThrowStatement]: ts.ThrowStatement; [AST_NODE_TYPES.TryStatement]: ts.TryStatement; [AST_NODE_TYPES.TSAbstractAccessorProperty]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractPropertyDefinition]: ts.PropertyDeclaration; [AST_NODE_TYPES.TSAbstractMethodDefinition]: + | ts.ConstructorDeclaration | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration | ts.MethodDeclaration - | ts.ConstructorDeclaration; + | ts.SetAccessorDeclaration; [AST_NODE_TYPES.TSArrayType]: ts.ArrayTypeNode; [AST_NODE_TYPES.TSAsExpression]: ts.AsExpression; [AST_NODE_TYPES.TSCallSignatureDeclaration]: ts.CallSignatureDeclaration; @@ -191,8 +192,8 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSLiteralType]: ts.LiteralTypeNode; [AST_NODE_TYPES.TSMappedType]: ts.MappedTypeNode; [AST_NODE_TYPES.TSMethodSignature]: - | ts.MethodSignature | ts.GetAccessorDeclaration + | ts.MethodSignature | ts.SetAccessorDeclaration; [AST_NODE_TYPES.TSModuleBlock]: ts.ModuleBlock; [AST_NODE_TYPES.TSModuleDeclaration]: ts.ModuleDeclaration; @@ -202,11 +203,10 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSOptionalType]: ts.OptionalTypeNode; [AST_NODE_TYPES.TSParameterProperty]: ts.ParameterDeclaration; [AST_NODE_TYPES.TSPropertySignature]: ts.PropertySignature; - [AST_NODE_TYPES.TSQualifiedName]: ts.QualifiedName; + [AST_NODE_TYPES.TSQualifiedName]: ts.Identifier | ts.QualifiedName; [AST_NODE_TYPES.TSRestType]: - | ts.RestTypeNode - // for consistency and following babel's choices, a named tuple member with a rest gets converted to a TSRestType - | ts.NamedTupleMember; + | ts.NamedTupleMember // for consistency and following babel's choices, a named tuple member with a rest gets converted to a TSRestType + | ts.RestTypeNode; [AST_NODE_TYPES.TSThisType]: ts.ThisTypeNode; [AST_NODE_TYPES.TSTupleType]: ts.TupleTypeNode; [AST_NODE_TYPES.TSTemplateLiteralType]: ts.TemplateLiteralTypeNode; @@ -218,28 +218,28 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSTypeParameter]: ts.TypeParameterDeclaration; [AST_NODE_TYPES.TSTypeParameterDeclaration]: undefined; [AST_NODE_TYPES.TSTypeParameterInstantiation]: - | ts.TaggedTemplateExpression - | ts.ImportTypeNode + | ts.CallExpression | ts.ExpressionWithTypeArguments - | ts.TypeReferenceNode + | ts.ImportTypeNode | ts.JsxOpeningElement | ts.JsxSelfClosingElement | ts.NewExpression - | ts.CallExpression - | ts.TypeQueryNode; + | ts.TaggedTemplateExpression + | ts.TypeQueryNode + | ts.TypeReferenceNode; [AST_NODE_TYPES.TSTypePredicate]: ts.TypePredicateNode; - [AST_NODE_TYPES.TSTypeQuery]: ts.TypeQueryNode; + [AST_NODE_TYPES.TSTypeQuery]: ts.ImportTypeNode | ts.TypeQueryNode; [AST_NODE_TYPES.TSTypeReference]: ts.TypeReferenceNode; [AST_NODE_TYPES.TSUnionType]: ts.UnionTypeNode; [AST_NODE_TYPES.UpdateExpression]: - | ts.PrefixUnaryExpression - | ts.PostfixUnaryExpression; - [AST_NODE_TYPES.UnaryExpression]: - | ts.PrefixUnaryExpression | ts.PostfixUnaryExpression + | ts.PrefixUnaryExpression; + [AST_NODE_TYPES.UnaryExpression]: | ts.DeleteExpression - | ts.VoidExpression - | ts.TypeOfExpression; + | ts.PostfixUnaryExpression + | ts.PrefixUnaryExpression + | ts.TypeOfExpression + | ts.VoidExpression; [AST_NODE_TYPES.VariableDeclaration]: | ts.VariableDeclarationList | ts.VariableStatement; @@ -251,15 +251,15 @@ export interface EstreeToTsNodeTypes { // Added by parser // Should be same as AST_NODE_TYPES.FunctionExpression [AST_NODE_TYPES.TSEmptyBodyFunctionExpression]: - | ts.FunctionExpression | ts.ConstructorDeclaration + | ts.FunctionExpression | ts.GetAccessorDeclaration - | ts.SetAccessorDeclaration - | ts.MethodDeclaration; + | ts.MethodDeclaration + | ts.SetAccessorDeclaration; // Keywords [AST_NODE_TYPES.TSAbstractKeyword]: ts.Token; - [AST_NODE_TYPES.TSNullKeyword]: ts.NullLiteral | ts.KeywordTypeNode; + [AST_NODE_TYPES.TSNullKeyword]: ts.KeywordTypeNode | ts.NullLiteral; [AST_NODE_TYPES.TSAnyKeyword]: ts.KeywordTypeNode; [AST_NODE_TYPES.TSBigIntKeyword]: ts.KeywordTypeNode; @@ -290,7 +290,7 @@ export interface EstreeToTsNodeTypes { * This mapping is based on the internal logic of the parser. */ export type TSESTreeToTSNode = Extract< - TSNode | ts.Token, + ts.Token | TSNode, // if this errors, it means that one of the AST_NODE_TYPES is not defined in the above interface EstreeToTsNodeTypes[T['type']] >; diff --git a/packages/typescript-estree/src/ts-estree/ts-nodes.ts b/packages/typescript-estree/src/ts-estree/ts-nodes.ts index fe1042260d8..588316c297a 100644 --- a/packages/typescript-estree/src/ts-estree/ts-nodes.ts +++ b/packages/typescript-estree/src/ts-estree/ts-nodes.ts @@ -2,8 +2,8 @@ import type * as ts from 'typescript'; // Workaround to support new TS version features for consumers on old TS versions // Eg: https://github.com/typescript-eslint/typescript-eslint/issues/2388, https://github.com/typescript-eslint/typescript-eslint/issues/2784 +/* eslint-disable @typescript-eslint/no-empty-interface */ declare module 'typescript' { - /* eslint-disable @typescript-eslint/no-empty-interface */ // added in TS 4.0 export interface NamedTupleMember extends ts.Node {} // added in TS 4.1 @@ -16,8 +16,8 @@ declare module 'typescript' { export interface AssertEntry extends ts.Node {} // added in TS 4.9 export interface SatisfiesExpression extends ts.Node {} - /* eslint-enable @typescript-eslint/no-empty-interface */ } +/* eslint-enable @typescript-eslint/no-empty-interface */ export type TSToken = ts.Token; @@ -131,6 +131,7 @@ export type TSNode = | ts.JsxSpreadAttribute | ts.JsxClosingElement | ts.JsxExpression + | ts.JsxNamespacedName | ts.JsxText | ts.NotEmittedStatement | ts.CommaListExpression diff --git a/packages/typescript-estree/src/use-at-your-own-risk.ts b/packages/typescript-estree/src/use-at-your-own-risk.ts new file mode 100644 index 00000000000..951d68d649a --- /dev/null +++ b/packages/typescript-estree/src/use-at-your-own-risk.ts @@ -0,0 +1,11 @@ +// required by website +export * from './create-program/getScriptKind'; +export * from './ast-converter'; +export type { ParseSettings } from './parseSettings'; + +// required by packages/utils/src/ts-estree.ts +export * from './getModifiers'; +export { typescriptVersionIsAtLeast } from './version-check'; + +// required by packages/type-utils +export { getCanonicalFileName } from './create-program/shared'; diff --git a/packages/typescript-estree/src/useProgramFromProjectService.ts b/packages/typescript-estree/src/useProgramFromProjectService.ts new file mode 100644 index 00000000000..16a7933a671 --- /dev/null +++ b/packages/typescript-estree/src/useProgramFromProjectService.ts @@ -0,0 +1,40 @@ +import path from 'path'; +import type * as ts from 'typescript'; +import type { server } from 'typescript/lib/tsserverlibrary'; + +import { createProjectProgram } from './create-program/createProjectProgram'; +import { type ASTAndDefiniteProgram } from './create-program/shared'; +import type { MutableParseSettings } from './parseSettings'; + +export function useProgramFromProjectService( + projectService: server.ProjectService, + parseSettings: Readonly, +): ASTAndDefiniteProgram | undefined { + const opened = projectService.openClientFile( + absolutify(parseSettings.filePath), + parseSettings.codeFullText, + /* scriptKind */ undefined, + parseSettings.tsconfigRootDir, + ); + if (!opened.configFileName) { + return undefined; + } + + const scriptInfo = projectService.getScriptInfo(parseSettings.filePath); + const program = projectService + .getDefaultProjectForFile(scriptInfo!.fileName, true)! + .getLanguageService(/*ensureSynchronized*/ true) + .getProgram(); + + if (!program) { + return undefined; + } + + return createProjectProgram(parseSettings, [program as ts.Program]); + + function absolutify(filePath: string): string { + return path.isAbsolute(filePath) + ? filePath + : path.join(projectService.host.getCurrentDirectory(), filePath); + } +} diff --git a/packages/typescript-estree/src/version-check.ts b/packages/typescript-estree/src/version-check.ts index 62bef222eb5..b4bc633753f 100644 --- a/packages/typescript-estree/src/version-check.ts +++ b/packages/typescript-estree/src/version-check.ts @@ -12,12 +12,6 @@ function semverCheck(version: string): boolean { } const versions = [ - '3.7', - '3.8', - '3.9', - '4.0', - '4.1', - '4.2', '4.3', '4.4', '4.5', diff --git a/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js b/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js index 112df1b4b5f..90765fc79ef 100644 --- a/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js +++ b/packages/typescript-estree/tests/fixtures/moduleResolver/moduleResolver.js @@ -32,5 +32,5 @@ module.exports = { } return resolvedModules; - } -} + }, +}; diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/badTSConfig/tsconfig.json b/packages/typescript-estree/tests/fixtures/semanticInfo/badTSConfig/tsconfig.json index 134439a183c..3fa1bfc0e66 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/badTSConfig/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/badTSConfig/tsconfig.json @@ -1,9 +1,9 @@ { - "compileOnSave": "hello", - "compilerOptions": { - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "strict": true, /* Enable all strict type-checking options. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - } - } \ No newline at end of file + "compileOnSave": "hello", + "compilerOptions": { + "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, + "strict": true /* Enable all strict type-checking options. */, + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + } +} diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/export-file.src.ts b/packages/typescript-estree/tests/fixtures/semanticInfo/export-file.src.ts index 8bb4cb89d7c..ae8c10ea728 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/export-file.src.ts +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/export-file.src.ts @@ -1 +1 @@ -export default [3, 4, 5]; \ No newline at end of file +export default [3, 4, 5]; diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/extra-file-extension.vue b/packages/typescript-estree/tests/fixtures/semanticInfo/extra-file-extension.vue index ca04667e621..0f03f097306 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/extra-file-extension.vue +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/extra-file-extension.vue @@ -1 +1 @@ -const x = [3, 4, 5]; \ No newline at end of file +const x = [3, 4, 5]; diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/import-file.src.ts b/packages/typescript-estree/tests/fixtures/semanticInfo/import-file.src.ts index da5d2023648..a038bf9c241 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/import-file.src.ts +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/import-file.src.ts @@ -1,2 +1,2 @@ -import arr from "./export-file.src"; -arr.push(6, 7); \ No newline at end of file +import arr from './export-file.src'; +arr.push(6, 7); diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/isolated-file.src.ts b/packages/typescript-estree/tests/fixtures/semanticInfo/isolated-file.src.ts index ca04667e621..0f03f097306 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/isolated-file.src.ts +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/isolated-file.src.ts @@ -1 +1 @@ -const x = [3, 4, 5]; \ No newline at end of file +const x = [3, 4, 5]; diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts b/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts index 4eb9dba432b..d9dece5e0be 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/non-existent-estree-nodes.src.ts @@ -1,4 +1,4 @@ -const binExp = (3 + 5); +const binExp = 3 + 5; class Bar { ['test']: string; diff --git a/packages/typescript-estree/tests/fixtures/semanticInfo/tsconfig.json b/packages/typescript-estree/tests/fixtures/semanticInfo/tsconfig.json index 3caa8722332..914d17298c5 100644 --- a/packages/typescript-estree/tests/fixtures/semanticInfo/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/semanticInfo/tsconfig.json @@ -5,4 +5,4 @@ "strict": true, "esModuleInterop": true } -} \ No newline at end of file +} diff --git a/packages/typescript-estree/tests/fixtures/simpleProject/file-jsx.tsx b/packages/typescript-estree/tests/fixtures/simpleProject/file-jsx.tsx new file mode 100644 index 00000000000..e69de29bb2d diff --git a/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json index 0967ef424bc..a32c9a1e328 100644 --- a/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json +++ b/packages/typescript-estree/tests/fixtures/simpleProject/tsconfig.json @@ -1 +1,7 @@ -{} +{ + "compilerOptions": { + "skipLibCheck": true, + "strict": true, + "target": "ES2022" + } +} 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 866e23ab1ce..0a1c9eb2ace 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -73,9 +73,11 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` "setExternalModuleIndicator": [Function], "statements": [ { + "directive": undefined, "expression": { "arguments": [], "callee": { + "decorators": [], "loc": { "end": { "column": 7, @@ -87,11 +89,13 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` }, }, "name": "foo", + "optional": false, "range": [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": { "end": { @@ -108,7 +112,7 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` 12, ], "type": "NewExpression", - "typeParameters": { + "typeArguments": { "loc": { "end": { "column": 10, @@ -136,7 +140,9 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` 9, ], "type": "TSTypeReference", + "typeArguments": undefined, "typeName": { + "decorators": [], "loc": { "end": { "column": 9, @@ -148,13 +154,14 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` }, }, "name": "T", + "optional": false, "range": [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "typeParameters": undefined, }, ], "range": [ @@ -230,6 +237,7 @@ exports[`convert deeplyCopy should convert node correctly 1`] = ` "typeParameters": null, }, ], + "comments": undefined, "loc": { "end": { "column": 35, @@ -245,6 +253,7 @@ exports[`convert deeplyCopy should convert node correctly 1`] = ` 35, ], "sourceType": "script", + "tokens": undefined, "type": "Program", } `; @@ -254,6 +263,7 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = "decorators": [ { "expression": { + "decorators": [], "loc": { "end": { "column": 5, @@ -265,11 +275,13 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = }, }, "name": "test", + "optional": false, "range": [ 1, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": { "end": { @@ -300,6 +312,7 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = }, "members": [], "name": { + "decorators": [], "loc": { "end": { "column": 15, @@ -311,11 +324,13 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = }, }, "name": "foo", + "optional": false, "range": [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": [ 0, @@ -330,6 +345,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` { "arguments": [], "expression": { + "decorators": [], "loc": { "end": { "column": 7, @@ -341,11 +357,13 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` }, }, "name": "foo", + "optional": false, "range": [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": { "end": { @@ -362,7 +380,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` 12, ], "type": "TSNewExpression", - "typeParameters": { + "typeArguments": { "loc": { "end": { "column": 10, @@ -390,7 +408,9 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` 9, ], "type": "TSTypeReference", + "typeArguments": undefined, "typeName": { + "decorators": [], "loc": { "end": { "column": 9, @@ -402,13 +422,14 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` }, }, "name": "T", + "optional": false, "range": [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "typeParameters": undefined, }, ], "range": [ @@ -434,6 +455,7 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, "members": [], "name": { + "decorators": [], "loc": { "end": { "column": 9, @@ -445,11 +467,13 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, }, "name": "foo", + "optional": false, "range": [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": [ 0, @@ -484,6 +508,7 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, }, "name": { + "decorators": [], "loc": { "end": { "column": 11, @@ -495,11 +520,13 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, }, "name": "T", + "optional": false, "range": [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": [ diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap index 2b406baf12b..c4182c42113 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap @@ -1,87 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is empty the extension does not match 1`] = ` -"ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json -The extension for the file (\`.unknown\`) is non-standard. You should add \`parserOptions.extraFileExtensions\` to your config." -`; - -exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty invalid extension 1`] = ` -"ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json -Found unexpected extension \`unknown\` specified with the \`parserOptions.extraFileExtensions\` option. Did you mean \`.unknown\`? -The extension for the file (\`.unknown\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`." -`; - -exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension does not match 1`] = ` -"ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json -The extension for the file (\`.unknown\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`." -`; - -exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension matches duplicate extension 1`] = ` -"ESLint was configured to run on \`/ts/notIncluded.ts\` using \`parserOptions.project\`: /tsconfig.json -You unnecessarily included the extension \`.ts\` with the \`parserOptions.extraFileExtensions\` option. This extension is already handled by the parser by default. -However, that TSConfig does not include this file. Either: -- Change ESLint's list of included files to not include this file -- Change that TSConfig to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - -exports[`parseAndGenerateServices invalid file error messages "parserOptions.extraFileExtensions" is non-empty the extension matches the file isn't included 1`] = ` -"ESLint was configured to run on \`/other/notIncluded.vue\` using \`parserOptions.project\`: /tsconfig.json -However, that TSConfig does not include this file. Either: -- Change ESLint's list of included files to not include this file -- Change that TSConfig to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - -exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 1`] = ` -"ESLint was configured to run on \`/ts/notIncluded0j1.ts\` using \`parserOptions.project\`: /tsconfig.json -However, that TSConfig does not include this file. Either: -- Change ESLint's list of included files to not include this file -- Change that TSConfig to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - -exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 2`] = ` -"ESLint was configured to run on \`/ts/notIncluded02.tsx\` using \`parserOptions.project\`: /tsconfig.json -However, that TSConfig does not include this file. Either: -- Change ESLint's list of included files to not include this file -- Change that TSConfig to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - -exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 3`] = ` -"ESLint was configured to run on \`/js/notIncluded01.js\` using \`parserOptions.project\`: /tsconfig.json -However, that TSConfig does not include this file. Either: -- Change ESLint's list of included files to not include this file -- Change that TSConfig to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - -exports[`parseAndGenerateServices invalid file error messages project includes errors for not included files 4`] = ` -"ESLint was configured to run on \`/js/notIncluded02.jsx\` using \`parserOptions.project\`: /tsconfig.json -However, that TSConfig does not include this file. Either: -- Change ESLint's list of included files to not include this file -- Change that TSConfig to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - -exports[`parseAndGenerateServices invalid project error messages throws when non of multiple projects include the file 1`] = ` -"ESLint was configured to run on \`/ts/notIncluded0j1.ts\` using \`parserOptions.project\`: -- /tsconfig.json -- /tsconfig.extra.json -However, none of those TSConfigs include this file. Either: -- Change ESLint's list of included files to not include this file -- Change one of those TSConfigs to include this file -- Create a new TSConfig that includes this file and include it in your parserOptions.project -See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" -`; - exports[`parseAndGenerateServices isolated parsing should parse .js file - with JSX content - parserOptions.jsx = false 1`] = ` { "ast": { @@ -89,7 +7,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -101,11 +21,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -156,7 +78,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -181,6 +103,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -365,8 +288,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -379,7 +301,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -391,11 +315,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -446,7 +372,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -471,6 +397,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -655,8 +582,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -669,7 +595,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -681,11 +609,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -723,6 +653,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -835,8 +766,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -849,7 +779,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -861,11 +793,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -903,6 +837,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1015,8 +950,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1027,6 +961,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit "ast": { "body": [ { + "directive": undefined, "expression": { "loc": { "end": { @@ -1072,6 +1007,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit }, }, "method": false, + "optional": false, "range": [ 2, 8, @@ -1234,8 +1170,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1248,7 +1183,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -1260,11 +1197,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -1315,7 +1254,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -1340,6 +1279,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1524,8 +1464,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1538,7 +1477,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -1550,11 +1491,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -1605,7 +1548,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -1630,6 +1573,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1814,8 +1758,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -1828,7 +1771,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -1840,11 +1785,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -1882,6 +1829,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1994,8 +1942,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2008,7 +1955,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2020,11 +1969,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -2062,6 +2013,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2174,8 +2126,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2188,7 +2139,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2200,11 +2153,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -2242,6 +2197,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2354,8 +2310,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2368,7 +2323,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2380,11 +2337,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -2422,6 +2381,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2534,8 +2494,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2548,7 +2507,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2560,11 +2521,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -2615,7 +2578,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -2640,6 +2603,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2824,8 +2788,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -2838,7 +2801,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2850,11 +2815,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -2905,7 +2872,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -2930,6 +2897,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3114,8 +3082,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3128,7 +3095,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3140,11 +3109,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -3182,6 +3153,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3294,8 +3266,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3308,7 +3279,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3320,11 +3293,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -3362,6 +3337,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3474,8 +3450,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3488,7 +3463,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3500,11 +3477,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -3555,7 +3534,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with ], "selfClosing": true, "type": "JSXOpeningElement", - "typeParameters": undefined, + "typeArguments": undefined, }, "range": [ 10, @@ -3580,6 +3559,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3764,8 +3744,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3778,7 +3757,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3790,11 +3771,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -3832,6 +3815,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3944,8 +3928,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } @@ -3958,7 +3941,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3970,11 +3955,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -4012,6 +3999,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -4124,480 +4112,8 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, "services": { "esTreeNodeToTSNodeMap": WeakMap {}, - "hasFullTypeInformation": false, - "program": {}, + "program": "No Program", "tsNodeToESTreeNodeMap": WeakMap {}, }, } `; - -exports[`parseWithNodeMaps() general output should not contain loc 1`] = ` -{ - "body": [ - { - "declarations": [ - { - "id": { - "name": "foo", - "range": [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": { - "name": "bar", - "range": [ - 10, - 13, - ], - "type": "Identifier", - }, - "range": [ - 4, - 13, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "range": [ - 0, - 14, - ], - "type": "VariableDeclaration", - }, - ], - "range": [ - 0, - 14, - ], - "sourceType": "script", - "type": "Program", -} -`; - -exports[`parseWithNodeMaps() general output should not contain range 1`] = ` -{ - "body": [ - { - "declarations": [ - { - "id": { - "loc": { - "end": { - "column": 7, - "line": 1, - }, - "start": { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "type": "Identifier", - }, - "init": { - "loc": { - "end": { - "column": 13, - "line": 1, - }, - "start": { - "column": 10, - "line": 1, - }, - }, - "name": "bar", - "type": "Identifier", - }, - "loc": { - "end": { - "column": 13, - "line": 1, - }, - "start": { - "column": 4, - "line": 1, - }, - }, - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": { - "end": { - "column": 14, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "type": "VariableDeclaration", - }, - ], - "loc": { - "end": { - "column": 14, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "sourceType": "script", - "type": "Program", -} -`; - -exports[`parseWithNodeMaps() general output tokens, comments, locs, and ranges when called with those options 1`] = ` -{ - "body": [ - { - "declarations": [ - { - "id": { - "loc": { - "end": { - "column": 7, - "line": 1, - }, - "start": { - "column": 4, - "line": 1, - }, - }, - "name": "foo", - "range": [ - 4, - 7, - ], - "type": "Identifier", - }, - "init": { - "loc": { - "end": { - "column": 13, - "line": 1, - }, - "start": { - "column": 10, - "line": 1, - }, - }, - "name": "bar", - "range": [ - 10, - 13, - ], - "type": "Identifier", - }, - "loc": { - "end": { - "column": 13, - "line": 1, - }, - "start": { - "column": 4, - "line": 1, - }, - }, - "range": [ - 4, - 13, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "let", - "loc": { - "end": { - "column": 14, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 14, - ], - "type": "VariableDeclaration", - }, - ], - "comments": [], - "loc": { - "end": { - "column": 14, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 14, - ], - "sourceType": "script", - "tokens": [ - { - "loc": { - "end": { - "column": 3, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 3, - ], - "type": "Keyword", - "value": "let", - }, - { - "loc": { - "end": { - "column": 7, - "line": 1, - }, - "start": { - "column": 4, - "line": 1, - }, - }, - "range": [ - 4, - 7, - ], - "type": "Identifier", - "value": "foo", - }, - { - "loc": { - "end": { - "column": 9, - "line": 1, - }, - "start": { - "column": 8, - "line": 1, - }, - }, - "range": [ - 8, - 9, - ], - "type": "Punctuator", - "value": "=", - }, - { - "loc": { - "end": { - "column": 13, - "line": 1, - }, - "start": { - "column": 10, - "line": 1, - }, - }, - "range": [ - 10, - 13, - ], - "type": "Identifier", - "value": "bar", - }, - { - "loc": { - "end": { - "column": 14, - "line": 1, - }, - "start": { - "column": 13, - "line": 1, - }, - }, - "range": [ - 13, - 14, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; - -exports[`parseWithNodeMaps() non string code should correctly convert code to a string for parse() 1`] = ` -{ - "body": [ - { - "expression": { - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "raw": "12345", - "type": "Literal", - "value": 12345, - }, - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "type": "ExpressionStatement", - }, - ], - "comments": [], - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "sourceType": "script", - "tokens": [ - { - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "type": "Numeric", - "value": "12345", - }, - ], - "type": "Program", -} -`; - -exports[`parseWithNodeMaps() non string code should correctly convert code to a string for parseAndGenerateServices() 1`] = ` -{ - "body": [ - { - "expression": { - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "raw": "12345", - "type": "Literal", - "value": 12345, - }, - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "type": "ExpressionStatement", - }, - ], - "comments": [], - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "sourceType": "script", - "tokens": [ - { - "loc": { - "end": { - "column": 5, - "line": 1, - }, - "start": { - "column": 0, - "line": 1, - }, - }, - "range": [ - 0, - 5, - ], - "type": "Numeric", - "value": "12345", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap index e0b0c94ee05..79772deb70e 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap @@ -101,8 +101,8 @@ exports[`semanticInfo fixtures/export-file.src 1`] = ` "comments": [], "loc": { "end": { - "column": 25, - "line": 1, + "column": 0, + "line": 2, }, "start": { "column": 0, @@ -111,7 +111,7 @@ exports[`semanticInfo fixtures/export-file.src 1`] = ` }, "range": [ 0, - 25, + 26, ], "sourceType": "module", "tokens": [ @@ -335,7 +335,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` 16, 35, ], - "raw": ""./export-file.src"", + "raw": "'./export-file.src'", "type": "Literal", "value": "./export-file.src", }, @@ -352,6 +352,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "local": { + "decorators": [], "loc": { "end": { "column": 10, @@ -363,6 +364,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "name": "arr", + "optional": false, "range": [ 7, 10, @@ -433,6 +435,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "object": { + "decorators": [], "loc": { "end": { "column": 3, @@ -444,6 +447,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "name": "arr", + "optional": false, "range": [ 37, 40, @@ -452,6 +456,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, "optional": false, "property": { + "decorators": [], "loc": { "end": { "column": 8, @@ -463,6 +468,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "name": "push", + "optional": false, "range": [ 41, 45, @@ -512,8 +518,8 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` "comments": [], "loc": { "end": { - "column": 15, - "line": 2, + "column": 0, + "line": 3, }, "start": { "column": 0, @@ -522,7 +528,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, "range": [ 0, - 52, + 53, ], "sourceType": "module", "tokens": [ @@ -596,7 +602,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` 35, ], "type": "String", - "value": ""./export-file.src"", + "value": "'./export-file.src'", }, { "loc": { @@ -789,7 +795,9 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -801,6 +809,7 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` }, }, "name": "x", + "optional": false, "range": [ 6, 7, @@ -900,6 +909,7 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -921,8 +931,8 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` "comments": [], "loc": { "end": { - "column": 20, - "line": 1, + "column": 0, + "line": 2, }, "start": { "column": 0, @@ -931,7 +941,7 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` }, "range": [ 0, - 20, + 21, ], "sourceType": "script", "tokens": [ @@ -1144,7 +1154,9 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 12, @@ -1156,6 +1168,7 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "name": "binExp", + "optional": false, "range": [ 6, 12, @@ -1166,17 +1179,17 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` "left": { "loc": { "end": { - "column": 17, + "column": 16, "line": 1, }, "start": { - "column": 16, + "column": 15, "line": 1, }, }, "range": [ + 15, 16, - 17, ], "raw": "3", "type": "Literal", @@ -1184,33 +1197,33 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, "loc": { "end": { - "column": 21, + "column": 20, "line": 1, }, "start": { - "column": 16, + "column": 15, "line": 1, }, }, "operator": "+", "range": [ - 16, - 21, + 15, + 20, ], "right": { "loc": { "end": { - "column": 21, + "column": 20, "line": 1, }, "start": { - "column": 20, + "column": 19, "line": 1, }, }, "range": [ + 19, 20, - 21, ], "raw": "5", "type": "Literal", @@ -1220,7 +1233,7 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, "loc": { "end": { - "column": 22, + "column": 20, "line": 1, }, "start": { @@ -1230,15 +1243,16 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, "range": [ 6, - 22, + 20, ], "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { - "column": 23, + "column": 21, "line": 1, }, "start": { @@ -1248,16 +1262,19 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, "range": [ 0, - 23, + 21, ], "type": "VariableDeclaration", }, { + "abstract": false, "body": { "body": [ { "computed": true, "declare": false, + "decorators": [], + "definite": false, "key": { "loc": { "end": { @@ -1270,8 +1287,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 40, - 46, + 38, + 44, ], "raw": "'test'", "type": "Literal", @@ -1287,11 +1304,13 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` "line": 4, }, }, + "optional": false, "override": false, "range": [ - 39, - 56, + 37, + 54, ], + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": { @@ -1306,8 +1325,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 47, - 55, + 45, + 53, ], "type": "TSTypeAnnotation", "typeAnnotation": { @@ -1322,8 +1341,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 49, - 55, + 47, + 53, ], "type": "TSStringKeyword", }, @@ -1342,12 +1361,15 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 35, - 58, + 33, + 56, ], "type": "ClassBody", }, + "declare": false, + "decorators": [], "id": { + "decorators": [], "loc": { "end": { "column": 9, @@ -1359,12 +1381,14 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "name": "Bar", + "optional": false, "range": [ - 31, - 34, + 29, + 32, ], "type": "Identifier", }, + "implements": [], "loc": { "end": { "column": 1, @@ -1376,8 +1400,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 25, - 58, + 23, + 56, ], "superClass": null, "type": "ClassDeclaration", @@ -1396,7 +1420,7 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, "range": [ 0, - 59, + 57, ], "sourceType": "script", "tokens": [ @@ -1469,41 +1493,23 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` 15, 16, ], - "type": "Punctuator", - "value": "(", - }, - { - "loc": { - "end": { - "column": 17, - "line": 1, - }, - "start": { - "column": 16, - "line": 1, - }, - }, - "range": [ - 16, - 17, - ], "type": "Numeric", "value": "3", }, { "loc": { "end": { - "column": 19, + "column": 18, "line": 1, }, "start": { - "column": 18, + "column": 17, "line": 1, }, }, "range": [ + 17, 18, - 19, ], "type": "Punctuator", "value": "+", @@ -1511,17 +1517,17 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` { "loc": { "end": { - "column": 21, + "column": 20, "line": 1, }, "start": { - "column": 20, + "column": 19, "line": 1, }, }, "range": [ + 19, 20, - 21, ], "type": "Numeric", "value": "5", @@ -1529,35 +1535,17 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` { "loc": { "end": { - "column": 22, - "line": 1, - }, - "start": { "column": 21, "line": 1, }, - }, - "range": [ - 21, - 22, - ], - "type": "Punctuator", - "value": ")", - }, - { - "loc": { - "end": { - "column": 23, - "line": 1, - }, "start": { - "column": 22, + "column": 20, "line": 1, }, }, "range": [ - 22, - 23, + 20, + 21, ], "type": "Punctuator", "value": ";", @@ -1574,8 +1562,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 25, - 30, + 23, + 28, ], "type": "Keyword", "value": "class", @@ -1592,8 +1580,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 31, - 34, + 29, + 32, ], "type": "Identifier", "value": "Bar", @@ -1610,8 +1598,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 35, - 36, + 33, + 34, ], "type": "Punctuator", "value": "{", @@ -1628,8 +1616,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 39, - 40, + 37, + 38, ], "type": "Punctuator", "value": "[", @@ -1646,8 +1634,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 40, - 46, + 38, + 44, ], "type": "String", "value": "'test'", @@ -1664,8 +1652,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 46, - 47, + 44, + 45, ], "type": "Punctuator", "value": "]", @@ -1682,8 +1670,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 47, - 48, + 45, + 46, ], "type": "Punctuator", "value": ":", @@ -1700,8 +1688,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 49, - 55, + 47, + 53, ], "type": "Identifier", "value": "string", @@ -1718,8 +1706,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 55, - 56, + 53, + 54, ], "type": "Punctuator", "value": ";", @@ -1736,8 +1724,8 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "range": [ - 57, - 58, + 55, + 56, ], "type": "Punctuator", "value": "}", @@ -1746,5 +1734,3 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` "type": "Program", } `; - -exports[`semanticInfo malformed project file 1`] = `"Compiler option 'compileOnSave' requires a value of type boolean."`; diff --git a/packages/typescript-estree/tests/lib/convert.test.ts b/packages/typescript-estree/tests/lib/convert.test.ts index 7b5cf272252..9988c969b6a 100644 --- a/packages/typescript-estree/tests/lib/convert.test.ts +++ b/packages/typescript-estree/tests/lib/convert.test.ts @@ -1,10 +1,16 @@ +import type { TSESTree } from '@typescript-eslint/types'; import { AST_NODE_TYPES } from '@typescript-eslint/types'; import * as ts from 'typescript'; import type { TSNode } from '../../src'; +import type { ConverterOptions } from '../../src/convert'; import { Converter } from '../../src/convert'; describe('convert', () => { + afterEach(() => { + jest.resetAllMocks(); + }); + function convertCode(code: string): ts.SourceFile { return ts.createSourceFile( 'text.ts', @@ -15,89 +21,77 @@ describe('convert', () => { ); } - it('deeplyCopy should convert node correctly', () => { - const ast = convertCode('type foo = ?foo | ?(() => void)?'); + /* eslint-disable @typescript-eslint/dot-notation */ + describe('deeplyCopy', () => { + it('should convert node correctly', () => { + const ast = convertCode('type foo = ?foo | ?(() => void)?'); - function fakeUnknownKind(node: ts.Node): void { - ts.forEachChild(node, fakeUnknownKind); - // @ts-expect-error -- intentionally writing to a readonly field - // eslint-disable-next-line deprecation/deprecation - node.kind = ts.SyntaxKind.UnparsedPrologue; - } + function fakeUnknownKind(node: ts.Node): void { + ts.forEachChild(node, fakeUnknownKind); + // @ts-expect-error -- intentionally writing to a readonly field + // eslint-disable-next-line deprecation/deprecation + node.kind = ts.SyntaxKind.UnparsedPrologue; + } - ts.forEachChild(ast, fakeUnknownKind); + ts.forEachChild(ast, fakeUnknownKind); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: false, + const instance = new Converter(ast); + expect(instance.convertProgram()).toMatchSnapshot(); }); - expect(instance.convertProgram()).toMatchSnapshot(); - }); - it('deeplyCopy should convert node with decorators correctly', () => { - const ast = convertCode('@test class foo {}'); + it('should convert node with decorators correctly', () => { + const ast = convertCode('@test class foo {}'); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: false, + const instance = new Converter(ast); + + expect( + instance['deeplyCopy'](ast.statements[0] as ts.ClassDeclaration), + ).toMatchSnapshot(); }); - expect( - instance['deeplyCopy'](ast.statements[0] as ts.ClassDeclaration), - ).toMatchSnapshot(); - }); + it('should convert node with type parameters correctly', () => { + const ast = convertCode('class foo {}'); - it('deeplyCopy should convert node with type parameters correctly', () => { - const ast = convertCode('class foo {}'); + const instance = new Converter(ast); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: false, + expect( + instance['deeplyCopy'](ast.statements[0] as ts.ClassDeclaration), + ).toMatchSnapshot(); }); - expect( - instance['deeplyCopy'](ast.statements[0] as ts.ClassDeclaration), - ).toMatchSnapshot(); - }); + it('should convert node with type arguments correctly', () => { + const ast = convertCode('new foo()'); - it('deeplyCopy should convert node with type arguments correctly', () => { - const ast = convertCode('new foo()'); + const instance = new Converter(ast); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: false, + expect( + instance['deeplyCopy']( + (ast.statements[0] as ts.ExpressionStatement) + .expression as ts.NewExpression, + ), + ).toMatchSnapshot(); }); - expect( - instance['deeplyCopy']( - (ast.statements[0] as ts.ExpressionStatement) - .expression as ts.NewExpression, - ), - ).toMatchSnapshot(); - }); - - it('deeplyCopy should convert array of nodes', () => { - const ast = convertCode('new foo()'); + it('should convert array of nodes', () => { + const ast = convertCode('new foo()'); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: false, + const instance = new Converter(ast); + expect(instance['deeplyCopy'](ast)).toMatchSnapshot(); }); - expect(instance['deeplyCopy'](ast)).toMatchSnapshot(); - }); - it('deeplyCopy should fail on unknown node', () => { - const ast = convertCode('type foo = ?foo | ?(() => void)?'); + it('should fail on unknown node', () => { + const ast = convertCode('type foo = ?foo | ?(() => void)?'); - const instance = new Converter(ast, { - errorOnUnknownASTType: true, - shouldPreserveNodeMaps: false, - }); + const instance = new Converter(ast, { + errorOnUnknownASTType: true, + }); - expect(() => instance['deeplyCopy'](ast)).toThrow( - 'Unknown AST_NODE_TYPE: "TSSourceFile"', - ); + expect(() => instance['deeplyCopy'](ast)).toThrow( + 'Unknown AST_NODE_TYPE: "TSSourceFile"', + ); + }); }); + /* eslint-enable @typescript-eslint/dot-notation */ it('nodeMaps should contain basic nodes', () => { const ast = convertCode(` @@ -108,13 +102,12 @@ describe('convert', () => { `); const instance = new Converter(ast, { - errorOnUnknownASTType: false, shouldPreserveNodeMaps: true, }); instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: ts.SourceFile | ts.Node): void { + function checkMaps(child: ts.Node | ts.SourceFile): void { child.forEachChild(node => { if ( node.kind !== ts.SyntaxKind.EndOfFileToken && @@ -141,13 +134,12 @@ describe('convert', () => { const ast = convertCode(``); const instance = new Converter(ast, { - errorOnUnknownASTType: false, shouldPreserveNodeMaps: true, }); instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: ts.SourceFile | ts.Node): void { + function checkMaps(child: ts.Node | ts.SourceFile): void { child.forEachChild(node => { if ( node.kind !== ts.SyntaxKind.EndOfFileToken && @@ -173,13 +165,12 @@ describe('convert', () => { const ast = convertCode(`export function foo () {}`); const instance = new Converter(ast, { - errorOnUnknownASTType: false, shouldPreserveNodeMaps: true, }); const program = instance.convertProgram(); const maps = instance.getASTMaps(); - function checkMaps(child: ts.SourceFile | ts.Node): void { + function checkMaps(child: ts.Node | ts.SourceFile): void { child.forEachChild(node => { if (node.kind !== ts.SyntaxKind.EndOfFileToken) { expect(ast).toBe( @@ -201,47 +192,50 @@ describe('convert', () => { checkMaps(ast); }); - it('should correctly create node with range and loc set', () => { - const ast = convertCode(''); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: true, - }); + /* eslint-disable @typescript-eslint/dot-notation */ + describe('createNode', () => { + it('should correctly create node with range and loc set', () => { + const ast = convertCode(''); + const instance = new Converter(ast, { + shouldPreserveNodeMaps: true, + }); - const tsNode: ts.KeywordToken = { - ...ts.factory.createToken(ts.SyntaxKind.AbstractKeyword), - end: 10, - pos: 0, - }; - const convertedNode = instance['createNode'](tsNode, { - type: AST_NODE_TYPES.TSAbstractKeyword, - range: [0, 20], - loc: { - start: { - line: 10, - column: 20, - }, - end: { - line: 15, - column: 25, + const tsNode: ts.KeywordToken = { + ...ts.factory.createToken(ts.SyntaxKind.AbstractKeyword), + end: 10, + pos: 0, + }; + const convertedNode = instance['createNode'](tsNode, { + type: AST_NODE_TYPES.TSAbstractKeyword, + range: [0, 20], + loc: { + start: { + line: 10, + column: 20, + }, + end: { + line: 15, + column: 25, + }, }, - }, - }); - expect(convertedNode).toEqual({ - type: AST_NODE_TYPES.TSAbstractKeyword, - range: [0, 20], - loc: { - start: { - line: 10, - column: 20, - }, - end: { - line: 15, - column: 25, + }); + expect(convertedNode).toEqual({ + type: AST_NODE_TYPES.TSAbstractKeyword, + range: [0, 20], + loc: { + start: { + line: 10, + column: 20, + }, + end: { + line: 15, + column: 25, + }, }, - }, + }); }); }); + /* eslint-enable @typescript-eslint/dot-notation */ it('should throw error on jsDoc node', () => { const jsDocCode = [ @@ -253,13 +247,118 @@ describe('convert', () => { for (const code of jsDocCode) { const ast = convertCode(code); - const instance = new Converter(ast, { - errorOnUnknownASTType: false, - shouldPreserveNodeMaps: false, - }); + const instance = new Converter(ast); expect(() => instance.convertProgram()).toThrow( 'JSDoc types can only be used inside documentation comments.', ); } }); + + describe('allowInvalidAST', () => { + const code = 'const;'; + + it(`throws an error for an invalid AST when allowInvalidAST is false`, () => { + const ast = convertCode(code); + + const instance = new Converter(ast); + + expect(() => instance.convertProgram()).toThrow( + 'A variable declaration list must have at least one variable declarator.', + ); + }); + + it(`does not throw an error for an invalid AST when allowInvalidAST is true`, () => { + const ast = convertCode(code); + + const instance = new Converter(ast, { + allowInvalidAST: true, + }); + + expect(() => instance.convertProgram()).not.toThrow(); + }); + }); + + describe('suppressDeprecatedPropertyWarnings', () => { + const getEsCallExpression = ( + converterOptions?: ConverterOptions, + ): TSESTree.CallExpression => { + const ast = convertCode(`callee();`); + const tsCallExpression = (ast.statements[0] as ts.ExpressionStatement) + .expression as ts.CallExpression; + const instance = new Converter(ast, { + shouldPreserveNodeMaps: true, + ...converterOptions, + }); + + instance.convertProgram(); + + const maps = instance.getASTMaps(); + + return maps.tsNodeToESTreeNodeMap.get(tsCallExpression); + }; + + it('warns on a deprecated property access when suppressDeprecatedPropertyWarnings is false', () => { + const emitWarning = jest + .spyOn(process, 'emitWarning') + .mockImplementation(); + const esCallExpression = getEsCallExpression({ + suppressDeprecatedPropertyWarnings: false, + }); + + // eslint-disable-next-line deprecation/deprecation + esCallExpression.typeParameters; + + expect(emitWarning).toHaveBeenCalledWith( + `The 'typeParameters' property is deprecated on CallExpression nodes. Use 'typeArguments' instead. See https://typescript-eslint.io/linting/troubleshooting#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.`, + 'DeprecationWarning', + ); + }); + + it('does not warn on a subsequent deprecated property access when suppressDeprecatedPropertyWarnings is false', () => { + const emitWarning = jest + .spyOn(process, 'emitWarning') + .mockImplementation(); + const esCallExpression = getEsCallExpression({ + suppressDeprecatedPropertyWarnings: false, + }); + + /* eslint-disable deprecation/deprecation */ + esCallExpression.typeParameters; + esCallExpression.typeParameters; + /* eslint-enable deprecation/deprecation */ + + expect(emitWarning).toHaveBeenCalledTimes(1); + }); + + it('does not warn on a deprecated property access when suppressDeprecatedPropertyWarnings is true', () => { + const emitWarning = jest + .spyOn(process, 'emitWarning') + .mockImplementation(); + const esCallExpression = getEsCallExpression({ + suppressDeprecatedPropertyWarnings: true, + }); + + // eslint-disable-next-line deprecation/deprecation + esCallExpression.typeParameters; + + expect(emitWarning).not.toHaveBeenCalled(); + }); + + it('does not allow enumeration of deprecated properties', () => { + const esCallExpression = getEsCallExpression(); + + expect(Object.keys(esCallExpression)).not.toContain('typeParameters'); + }); + + it('allows writing to the deprecated property as a new enumerable value', () => { + const esCallExpression = getEsCallExpression(); + + // eslint-disable-next-line deprecation/deprecation + esCallExpression.typeParameters = undefined; + + // eslint-disable-next-line deprecation/deprecation + expect(esCallExpression.typeParameters).toBeUndefined(); + expect(Object.keys(esCallExpression)).toContain('typeParameters'); + }); + }); }); diff --git a/packages/typescript-estree/tests/lib/createProjectService.test.ts b/packages/typescript-estree/tests/lib/createProjectService.test.ts new file mode 100644 index 00000000000..f6f6d117e3b --- /dev/null +++ b/packages/typescript-estree/tests/lib/createProjectService.test.ts @@ -0,0 +1,7 @@ +import { createProjectService } from '../../src/create-program/createProjectService'; + +describe('createProjectService', () => { + it('does not crash', () => { + createProjectService(); + }); +}); diff --git a/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts b/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts index 7378508b001..1ca184e4410 100644 --- a/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts +++ b/packages/typescript-estree/tests/lib/getProjectConfigFiles.test.ts @@ -1,3 +1,5 @@ +import path from 'path'; + import { ExpiringCache } from '../../src/parseSettings/ExpiringCache'; import { getProjectConfigFiles } from '../../src/parseSettings/getProjectConfigFiles'; @@ -41,7 +43,7 @@ describe('getProjectConfigFiles', () => { const actual = getProjectConfigFiles(parseSettings, project); - expect(actual).toEqual(project); + expect(actual).toBeNull(); }); describe('when caching hits', () => { @@ -51,12 +53,16 @@ describe('getProjectConfigFiles', () => { getProjectConfigFiles(parseSettings, true); const actual = getProjectConfigFiles(parseSettings, true); - expect(actual).toEqual(['repos/repo/packages/package/tsconfig.json']); + expect(actual).toEqual([ + path.normalize('repos/repo/packages/package/tsconfig.json'), + ]); expect(mockExistsSync).toHaveBeenCalledTimes(1); }); it('returns a nearby parent tsconfig.json when it was previously cached by a different directory search', () => { - mockExistsSync.mockImplementation(input => input === 'a/tsconfig.json'); + mockExistsSync.mockImplementation( + input => input === path.normalize('a/tsconfig.json'), + ); const tsconfigMatchCache = new ExpiringCache(1); @@ -81,12 +87,14 @@ describe('getProjectConfigFiles', () => { true, ); - expect(actual).toEqual(['a/tsconfig.json']); + expect(actual).toEqual([path.normalize('a/tsconfig.json')]); expect(mockExistsSync).toHaveBeenCalledTimes(4); }); it('returns a distant parent tsconfig.json when it was previously cached by a different directory search', () => { - mockExistsSync.mockImplementation(input => input === 'a/tsconfig.json'); + mockExistsSync.mockImplementation( + input => input === path.normalize('a/tsconfig.json'), + ); const tsconfigMatchCache = new ExpiringCache(1); @@ -111,7 +119,7 @@ describe('getProjectConfigFiles', () => { true, ); - expect(actual).toEqual(['a/tsconfig.json']); + expect(actual).toEqual([path.normalize('a/tsconfig.json')]); expect(mockExistsSync).toHaveBeenCalledTimes(6); }); }); @@ -122,17 +130,19 @@ describe('getProjectConfigFiles', () => { const actual = getProjectConfigFiles(parseSettings, true); - expect(actual).toEqual(['repos/repo/packages/package/tsconfig.json']); + expect(actual).toEqual([ + path.normalize('repos/repo/packages/package/tsconfig.json'), + ]); }); it('returns a parent tsconfig.json when matched', () => { mockExistsSync.mockImplementation( - filePath => filePath === 'repos/repo/tsconfig.json', + filePath => filePath === path.normalize('repos/repo/tsconfig.json'), ); const actual = getProjectConfigFiles(parseSettings, true); - expect(actual).toEqual(['repos/repo/tsconfig.json']); + expect(actual).toEqual([path.normalize('repos/repo/tsconfig.json')]); }); it('throws when searching hits .', () => { diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts deleted file mode 100644 index 25557a24ef5..00000000000 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-error.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import * as parser from '../../src'; -import type { TSESTreeOptions } from '../../src/parser-options'; -import { createAndPrepareParseConfig } from '../../tools/test-utils'; - -beforeEach(() => { - jest.clearAllMocks(); -}); - -describe('parseAndGenerateServices', () => { - describe('moduleResolver', () => { - const { code, config } = createAndPrepareParseConfig(); - - const withDefaultProgramConfig: TSESTreeOptions = { - ...config, - project: './tsconfig.defaultProgram.json', - createDefaultProgram: true, - }; - - describe('when file is not in the project and createDefaultProgram=true', () => { - it('returns error because __PLACEHOLDER__ can not be resolved', () => { - expect( - parser - .parseAndGenerateServices(code, withDefaultProgramConfig) - .services.program.getSemanticDiagnostics(), - ).toHaveProperty( - [0, 'messageText'], - "Cannot find module '__PLACEHOLDER__' or its corresponding type declarations.", - ); - }); - }); - }); -}); diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts deleted file mode 100644 index 9bebf21de1a..00000000000 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.default-program-success.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { resolve } from 'path'; - -import * as parser from '../../src'; -import type { TSESTreeOptions } from '../../src/parser-options'; -import { createAndPrepareParseConfig } from '../../tools/test-utils'; - -beforeEach(() => { - jest.clearAllMocks(); -}); - -describe('parseAndGenerateServices', () => { - describe('moduleResolver', () => { - const { code, config, projectDirectory } = createAndPrepareParseConfig(); - - const withDefaultProgramConfig: TSESTreeOptions = { - ...config, - project: './tsconfig.defaultProgram.json', - createDefaultProgram: true, - }; - - describe('when file is not in the project and createDefaultProgram=true', () => { - it('resolves __PLACEHOLDER__ correctly', () => { - expect( - parser - .parseAndGenerateServices(code, { - ...withDefaultProgramConfig, - moduleResolver: resolve(projectDirectory, './moduleResolver.js'), - }) - .services.program.getSemanticDiagnostics(), - ).toHaveLength(0); - }); - }); - }); -}); diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts deleted file mode 100644 index 699c88f0f23..00000000000 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-error.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { resolve } from 'path'; - -import * as parser from '../../src'; -import { createAndPrepareParseConfig } from '../../tools/test-utils'; - -beforeEach(() => { - jest.clearAllMocks(); -}); - -describe('parseAndGenerateServices', () => { - describe('moduleResolver', () => { - const { code, config, projectDirectory } = createAndPrepareParseConfig(); - - describe('when file is in the project', () => { - it('returns error if __PLACEHOLDER__ can not be resolved', () => { - expect( - parser - .parseAndGenerateServices(code, config) - .services.program.getSemanticDiagnostics(), - ).toHaveProperty( - [0, 'messageText'], - "Cannot find module '__PLACEHOLDER__' or its corresponding type declarations.", - ); - }); - - it('throws error if moduleResolver can not be found', () => { - expect(() => - parser.parseAndGenerateServices(code, { - ...config, - moduleResolver: resolve( - projectDirectory, - './this_moduleResolver_does_not_exist.js', - ), - }), - ).toThrowErrorMatchingInlineSnapshot(` - "Could not find the provided parserOptions.moduleResolver. - Hint: use an absolute path if you are not in control over where the ESLint instance runs." - `); - }); - }); - }); -}); diff --git a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts b/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts deleted file mode 100644 index eebc01b9369..00000000000 --- a/packages/typescript-estree/tests/lib/parse.moduleResolver.placeholder-success.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { resolve } from 'path'; - -import * as parser from '../../src'; -import { createAndPrepareParseConfig } from '../../tools/test-utils'; - -beforeEach(() => { - jest.clearAllMocks(); -}); - -describe('parseAndGenerateServices', () => { - describe('moduleResolver', () => { - const { code, config, projectDirectory } = createAndPrepareParseConfig(); - - describe('when file is in the project', () => { - it('resolves __PLACEHOLDER__ correctly', () => { - expect( - parser - .parseAndGenerateServices(code, { - ...config, - moduleResolver: resolve(projectDirectory, './moduleResolver.js'), - }) - .services.program.getSemanticDiagnostics(), - ).toHaveLength(0); - }); - }); - }); -}); diff --git a/packages/typescript-estree/tests/lib/parse.project-true.test.ts b/packages/typescript-estree/tests/lib/parse.project-true.test.ts index 3e4e47cb2c9..ca81ab99f50 100644 --- a/packages/typescript-estree/tests/lib/parse.project-true.test.ts +++ b/packages/typescript-estree/tests/lib/parse.project-true.test.ts @@ -35,15 +35,17 @@ describe('parseAndGenerateServices', () => { }); }); - it('throws an error when a parent project does not exist', () => { - expect(() => - parser.parseAndGenerateServices('const a = true', { - ...config, - filePath: join(PROJECT_DIR, 'notIncluded.ts'), - }), - ).toThrow( - /project was set to `true` but couldn't find any tsconfig.json relative to '.+\/tests\/fixtures\/projectTrue\/notIncluded.ts' within '.+\/tests\/fixtures\/projectTrue'./, - ); - }); + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it('throws an error when a parent project does not exist', () => { + expect(() => + parser.parseAndGenerateServices('const a = true', { + ...config, + filePath: join(PROJECT_DIR, 'notIncluded.ts'), + }), + ).toThrow( + /project was set to `true` but couldn't find any tsconfig.json relative to '.+[/\\]tests[/\\]fixtures[/\\]projectTrue[/\\]notIncluded.ts' within '.+[/\\]tests[/\\]fixtures[/\\]projectTrue'./, + ); + }); + } }); }); diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index 0f286efdb19..658493c9150 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -5,26 +5,12 @@ import { join, resolve } from 'path'; import type * as typescriptModule from 'typescript'; import * as parser from '../../src'; -import * as astConverterModule from '../../src/ast-converter'; import * as sharedParserUtilsModule from '../../src/create-program/shared'; import type { TSESTreeOptions } from '../../src/parser-options'; import { clearGlobResolutionCache } from '../../src/parseSettings/resolveProjectList'; -import { createSnapshotTestBlock } from '../../tools/test-utils'; const FIXTURES_DIR = join(__dirname, '../fixtures/simpleProject'); -// we can't spy on the exports of an ES module - so we instead have to mock the entire module -jest.mock('../../src/ast-converter', () => { - const astConverterActual = jest.requireActual( - '../../src/ast-converter', - ); - - return { - ...astConverterActual, - __esModule: true, - astConverter: jest.fn(astConverterActual.astConverter), - }; -}); jest.mock('../../src/create-program/shared', () => { const sharedActual = jest.requireActual( '../../src/create-program/shared', @@ -62,7 +48,6 @@ jest.mock('globby', () => { const hrtimeSpy = jest.spyOn(process, 'hrtime'); -const astConverterMock = jest.mocked(astConverterModule.astConverter); const createDefaultCompilerOptionsFromExtra = jest.mocked( sharedParserUtilsModule.createDefaultCompilerOptionsFromExtra, ); @@ -81,170 +66,7 @@ beforeEach(() => { clearGlobResolutionCache(); }); -describe('parseWithNodeMaps()', () => { - describe('basic functionality', () => { - it('should parse an empty string', () => { - expect(parser.parseWithNodeMaps('').ast.body).toEqual([]); - expect(parser.parseWithNodeMaps('', {}).ast.body).toEqual([]); - }); - - it('parse() should be the same as parseWithNodeMaps().ast', () => { - const code = 'const x: number = 1;'; - expect(parser.parseWithNodeMaps(code).ast).toMatchObject( - parser.parse(code), - ); - }); - - it('should simple code', () => { - const result = parser.parseWithNodeMaps('1;'); - expect(result.ast).toMatchInlineSnapshot(` - { - "body": [ - { - "expression": { - "raw": "1", - "type": "Literal", - "value": 1, - }, - "type": "ExpressionStatement", - }, - ], - "sourceType": "script", - "type": "Program", - } - `); - const tsNode = result.esTreeNodeToTSNodeMap.get(result.ast.body[0]); - expect(tsNode).toBeDefined(); - expect(result.tsNodeToESTreeNodeMap.get(tsNode)).toBeDefined(); - }); - }); - - describe('modules', () => { - it('should have correct column number when strict mode error occurs', () => { - try { - parser.parseWithNodeMaps('function fn(a, a) {\n}'); - } catch ( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - err: any - ) { - expect(err.column).toBe(16); - } - }); - }); - - describe('general', () => { - const code = 'let foo = bar;'; - const config: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - }; - - it( - 'output tokens, comments, locs, and ranges when called with those options', - createSnapshotTestBlock(code, config), - ); - - it( - 'output should not contain loc', - createSnapshotTestBlock(code, { - range: true, - loc: false, - }), - ); - - it( - 'output should not contain range', - createSnapshotTestBlock(code, { - range: false, - loc: true, - }), - ); - }); - - describe('non string code', () => { - // testing a non string code.. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const code = 12345 as any as string; - const config: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - }; - - it( - 'should correctly convert code to a string for parse()', - createSnapshotTestBlock(code, config), - ); - - it( - 'should correctly convert code to a string for parseAndGenerateServices()', - createSnapshotTestBlock(code, config, true), - ); - }); - - describe('loggerFn should be propagated to ast-converter', () => { - it('output tokens, comments, locs, and ranges when called with those options', () => { - const loggerFn = jest.fn(() => {}); - - parser.parseWithNodeMaps('let foo = bar;', { - loggerFn, - comment: true, - tokens: true, - range: true, - loc: true, - }); - - expect(astConverterMock).toHaveBeenCalled(); - expect(astConverterMock.mock.calls[0][1]).toMatchObject({ - code: 'let foo = bar;', - comment: true, - comments: [], - loc: true, - log: loggerFn, - range: true, - tokens: expect.any(Array), - }); - }); - }); -}); - describe('parseAndGenerateServices', () => { - describe('errorOnTypeScriptSyntacticAndSemanticIssues', () => { - const code = '@test const foo = 2'; - const options: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - errorOnTypeScriptSyntacticAndSemanticIssues: true, - }; - - it('should throw on invalid option when used in parseWithNodeMaps', () => { - expect(() => { - parser.parseWithNodeMaps(code, options); - }).toThrow( - `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`, - ); - }); - - it('should not throw when used in parseAndGenerateServices', () => { - expect(() => { - parser.parseAndGenerateServices(code, options); - }).not.toThrow( - `"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`, - ); - }); - - it('should error on invalid code', () => { - expect(() => { - parser.parseAndGenerateServices(code, options); - }).toThrow('Decorators are not valid here.'); - }); - }); - describe('preserveNodeMaps', () => { const code = 'var a = true'; const baseConfig: TSESTreeOptions = { @@ -282,31 +104,6 @@ describe('parseAndGenerateServices', () => { ); }); - it('should not impact the use of parseWithNodeMaps()', () => { - const resultWithNoOptionSet = parser.parseWithNodeMaps(code, baseConfig); - const resultWithOptionSetToTrue = parser.parseWithNodeMaps(code, { - ...baseConfig, - preserveNodeMaps: true, - }); - const resultWithOptionSetToFalse = parser.parseWithNodeMaps(code, { - ...baseConfig, - preserveNodeMaps: false, - }); - const resultWithOptionSetExplicitlyToUndefined = parser.parseWithNodeMaps( - code, - { - ...baseConfig, - preserveNodeMaps: undefined, - }, - ); - - expect(resultWithNoOptionSet).toMatchObject(resultWithOptionSetToTrue); - expect(resultWithNoOptionSet).toMatchObject(resultWithOptionSetToFalse); - expect(resultWithNoOptionSet).toMatchObject( - resultWithOptionSetExplicitlyToUndefined, - ); - }); - it('should preserve node maps by default for parseAndGenerateServices()', () => { const noOptionSet = parser.parseAndGenerateServices(code, baseConfig); @@ -337,18 +134,11 @@ describe('parseAndGenerateServices', () => { preserveNodeMaps: setting, }); - expect(parseResult.services.esTreeNodeToTSNodeMap).toBeDefined(); - expect(parseResult.services.tsNodeToESTreeNodeMap).toBeDefined(); expect( - parseResult.services.esTreeNodeToTSNodeMap.has( + parseResult.services.esTreeNodeToTSNodeMap?.has( parseResult.ast.body[0], ), ).toBe(setting); - expect( - parseResult.services.tsNodeToESTreeNodeMap.has( - parseResult.services.program.getSourceFile('estree.ts'), - ), - ).toBe(setting); }); it('with project', () => { @@ -357,20 +147,11 @@ describe('parseAndGenerateServices', () => { preserveNodeMaps: setting, }); - expect(parseResult.services.esTreeNodeToTSNodeMap).toBeDefined(); - expect(parseResult.services.tsNodeToESTreeNodeMap).toBeDefined(); expect( parseResult.services.esTreeNodeToTSNodeMap.has( parseResult.ast.body[0], ), ).toBe(setting); - expect( - parseResult.services.tsNodeToESTreeNodeMap.has( - parseResult.services.program.getSourceFile( - join(FIXTURES_DIR, 'file.ts'), - ), - ), - ).toBe(setting); }); } @@ -385,6 +166,7 @@ describe('parseAndGenerateServices', () => { describe('isolated parsing', () => { const config: TSESTreeOptions = { + EXPERIMENTAL_useProjectService: false, comment: true, tokens: true, range: true, @@ -396,7 +178,7 @@ describe('parseAndGenerateServices', () => { jsxSetting, shouldThrow = false, }: { - ext: '.js' | '.jsx' | '.ts' | '.tsx' | '.vue' | '.json'; + ext: '.js' | '.json' | '.jsx' | '.ts' | '.tsx' | '.vue'; jsxContent: boolean; jsxSetting: boolean; shouldThrow?: boolean; @@ -428,14 +210,16 @@ describe('parseAndGenerateServices', () => { } if (!shouldThrow) { - expect(result?.services.program).toBeDefined(); expect(result?.ast).toBeDefined(); expect({ ...result, services: { ...result?.services, - // Reduce noise in snapshot - program: {}, + // Reduce noise in snapshot by not printing the TS program + program: + result?.services.program == null + ? 'No Program' + : 'With Program', }, }).toMatchSnapshot(); } @@ -556,124 +340,184 @@ describe('parseAndGenerateServices', () => { }); }); - describe('invalid file error messages', () => { - const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); - const code = 'var a = true'; - const config: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - tsconfigRootDir: PROJECT_DIR, - project: './tsconfig.json', - }; - const testParse = - (filePath: string, extraFileExtensions: string[] = ['.vue']) => - (): void => { - try { - parser.parseAndGenerateServices(code, { - ...config, - extraFileExtensions, - filePath: join(PROJECT_DIR, filePath), - }); - } catch (error) { - throw alignErrorPath(error as Error); - } + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + describe('invalid file error messages', () => { + const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); + const code = 'var a = true'; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + tsconfigRootDir: PROJECT_DIR, + project: './tsconfig.json', }; + const testParse = + (filePath: string, extraFileExtensions: string[] = ['.vue']) => + (): void => { + try { + parser.parseAndGenerateServices(code, { + ...config, + extraFileExtensions, + filePath: join(PROJECT_DIR, filePath), + }); + } catch (error) { + throw alignErrorPath(error as Error); + } + }; + + describe('project includes', () => { + it("doesn't error for matched files", () => { + expect(testParse('ts/included01.ts')).not.toThrow(); + expect(testParse('ts/included02.tsx')).not.toThrow(); + expect(testParse('js/included01.js')).not.toThrow(); + expect(testParse('js/included02.jsx')).not.toThrow(); + }); - describe('project includes', () => { - it("doesn't error for matched files", () => { - expect(testParse('ts/included01.ts')).not.toThrow(); - expect(testParse('ts/included02.tsx')).not.toThrow(); - expect(testParse('js/included01.js')).not.toThrow(); - expect(testParse('js/included02.jsx')).not.toThrow(); + it('errors for not included files', () => { + expect(testParse('ts/notIncluded0j1.ts')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/ts/notIncluded0j1.ts\` using \`parserOptions.project\`: /tsconfig.json + However, that TSConfig does not include this file. Either: + - Change ESLint's list of included files to not include this file + - Change that TSConfig to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + expect(testParse('ts/notIncluded02.tsx')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/ts/notIncluded02.tsx\` using \`parserOptions.project\`: /tsconfig.json + However, that TSConfig does not include this file. Either: + - Change ESLint's list of included files to not include this file + - Change that TSConfig to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + expect(testParse('js/notIncluded01.js')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/js/notIncluded01.js\` using \`parserOptions.project\`: /tsconfig.json + However, that TSConfig does not include this file. Either: + - Change ESLint's list of included files to not include this file + - Change that TSConfig to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + expect(testParse('js/notIncluded02.jsx')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/js/notIncluded02.jsx\` using \`parserOptions.project\`: /tsconfig.json + However, that TSConfig does not include this file. Either: + - Change ESLint's list of included files to not include this file + - Change that TSConfig to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + }); }); - it('errors for not included files', () => { - expect( - testParse('ts/notIncluded0j1.ts'), - ).toThrowErrorMatchingSnapshot(); - expect( - testParse('ts/notIncluded02.tsx'), - ).toThrowErrorMatchingSnapshot(); - expect(testParse('js/notIncluded01.js')).toThrowErrorMatchingSnapshot(); - expect( - testParse('js/notIncluded02.jsx'), - ).toThrowErrorMatchingSnapshot(); - }); - }); + describe('"parserOptions.extraFileExtensions" is empty', () => { + it('should not error', () => { + expect(testParse('ts/included01.ts', [])).not.toThrow(); + }); - describe('"parserOptions.extraFileExtensions" is empty', () => { - it('should not error', () => { - expect(testParse('ts/included01.ts', [])).not.toThrow(); + it('the extension does not match', () => { + expect(testParse('other/unknownFileType.unknown', [])) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json + The extension for the file (\`.unknown\`) is non-standard. You should add \`parserOptions.extraFileExtensions\` to your config." + `); + }); }); - it('the extension does not match', () => { - expect( - testParse('other/unknownFileType.unknown', []), - ).toThrowErrorMatchingSnapshot(); - }); - }); + describe('"parserOptions.extraFileExtensions" is non-empty', () => { + describe('the extension matches', () => { + it('the file is included', () => { + expect(testParse('other/included.vue')).not.toThrow(); + }); - describe('"parserOptions.extraFileExtensions" is non-empty', () => { - describe('the extension matches', () => { - it('the file is included', () => { - expect(testParse('other/included.vue')).not.toThrow(); - }); + it("the file isn't included", () => { + expect(testParse('other/notIncluded.vue')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/other/notIncluded.vue\` using \`parserOptions.project\`: /tsconfig.json + However, that TSConfig does not include this file. Either: + - Change ESLint's list of included files to not include this file + - Change that TSConfig to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + }); - it("the file isn't included", () => { - expect( - testParse('other/notIncluded.vue'), - ).toThrowErrorMatchingSnapshot(); + it('duplicate extension', () => { + expect(testParse('ts/notIncluded.ts', ['.ts'])) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/ts/notIncluded.ts\` using \`parserOptions.project\`: /tsconfig.json + You unnecessarily included the extension \`.ts\` with the \`parserOptions.extraFileExtensions\` option. This extension is already handled by the parser by default. + However, that TSConfig does not include this file. Either: + - Change ESLint's list of included files to not include this file + - Change that TSConfig to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + }); }); - it('duplicate extension', () => { - expect( - testParse('ts/notIncluded.ts', ['.ts']), - ).toThrowErrorMatchingSnapshot(); + it('invalid extension', () => { + expect(testParse('other/unknownFileType.unknown', ['unknown'])) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json + Found unexpected extension \`unknown\` specified with the \`parserOptions.extraFileExtensions\` option. Did you mean \`.unknown\`? + The extension for the file (\`.unknown\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`." + `); }); - }); - it('invalid extension', () => { - expect( - testParse('other/unknownFileType.unknown', ['unknown']), - ).toThrowErrorMatchingSnapshot(); - }); - - it('the extension does not match', () => { - expect( - testParse('other/unknownFileType.unknown'), - ).toThrowErrorMatchingSnapshot(); + it('the extension does not match', () => { + expect(testParse('other/unknownFileType.unknown')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/other/unknownFileType.unknown\` using \`parserOptions.project\`: /tsconfig.json + The extension for the file (\`.unknown\`) is non-standard. It should be added to your existing \`parserOptions.extraFileExtensions\`." + `); + }); }); }); - }); - - describe('invalid project error messages', () => { - it('throws when non of multiple projects include the file', () => { - const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); - const code = 'var a = true'; - const config: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - tsconfigRootDir: PROJECT_DIR, - project: ['./**/tsconfig.json', './**/tsconfig.extra.json'], - }; - const testParse = (filePath: string) => (): void => { - try { - parser.parseAndGenerateServices(code, { - ...config, - filePath: join(PROJECT_DIR, filePath), - }); - } catch (error) { - throw alignErrorPath(error as Error); - } - }; - expect(testParse('ts/notIncluded0j1.ts')).toThrowErrorMatchingSnapshot(); + describe('invalid project error messages', () => { + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it('throws when none of multiple projects include the file', () => { + const PROJECT_DIR = resolve(FIXTURES_DIR, '../invalidFileErrors'); + const code = 'var a = true'; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + tsconfigRootDir: PROJECT_DIR, + project: ['./**/tsconfig.json', './**/tsconfig.extra.json'], + }; + const testParse = (filePath: string) => (): void => { + try { + parser.parseAndGenerateServices(code, { + ...config, + filePath: join(PROJECT_DIR, filePath), + }); + } catch (error) { + throw alignErrorPath(error as Error); + } + }; + + expect(testParse('ts/notIncluded0j1.ts')) + .toThrowErrorMatchingInlineSnapshot(` + "ESLint was configured to run on \`/ts/notIncluded0j1.ts\` using \`parserOptions.project\`: + - /tsconfig.json + - /tsconfig.extra.json + However, none of those TSConfigs include this file. Either: + - Change ESLint's list of included files to not include this file + - Change one of those TSConfigs to include this file + - Create a new TSConfig that includes this file and include it in your parserOptions.project + See the typescript-eslint docs for more info: https://typescript-eslint.io/linting/troubleshooting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file" + `); + }); + } }); - }); + } describe('debug options', () => { const debugEnable = jest.fn(); @@ -716,118 +560,127 @@ describe('parseAndGenerateServices', () => { ); }); - it('should turn on typescript debugger', () => { - parser.parseAndGenerateServices('const x = 1;', { - debugLevel: ['typescript'], + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it('should turn on typescript debugger', () => { + expect(() => + parser.parseAndGenerateServices('const x = 1;', { + debugLevel: ['typescript'], + filePath: './path-that-doesnt-exist.ts', + project: ['./tsconfig-that-doesnt-exist.json'], + }), + ) // should throw because the file and tsconfig don't exist + .toThrow(); + expect(createDefaultCompilerOptionsFromExtra).toHaveBeenCalled(); + expect(createDefaultCompilerOptionsFromExtra).toHaveReturnedWith( + expect.objectContaining({ + extendedDiagnostics: true, + }), + ); }); - expect(createDefaultCompilerOptionsFromExtra).toHaveBeenCalled(); - expect(createDefaultCompilerOptionsFromExtra).toHaveReturnedWith( - expect.objectContaining({ - extendedDiagnostics: true, - }), - ); - }); + } }); - describe('projectFolderIgnoreList', () => { - beforeEach(() => { - parser.clearCaches(); - }); - - const PROJECT_DIR = resolve(FIXTURES_DIR, '../projectFolderIgnoreList'); - const code = 'var a = true'; - const config: TSESTreeOptions = { - comment: true, - tokens: true, - range: true, - loc: true, - tsconfigRootDir: PROJECT_DIR, - project: './**/tsconfig.json', - }; + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + describe('projectFolderIgnoreList', () => { + beforeEach(() => { + parser.clearCaches(); + }); - const testParse = - ( - filePath: 'ignoreme' | 'includeme', - projectFolderIgnoreList?: TSESTreeOptions['projectFolderIgnoreList'], - ) => - (): void => { - parser.parseAndGenerateServices(code, { - ...config, - projectFolderIgnoreList, - filePath: join(PROJECT_DIR, filePath, './file.ts'), - }); + const PROJECT_DIR = resolve(FIXTURES_DIR, '../projectFolderIgnoreList'); + const code = 'var a = true'; + const config: TSESTreeOptions = { + comment: true, + tokens: true, + range: true, + loc: true, + tsconfigRootDir: PROJECT_DIR, + project: './**/tsconfig.json', }; - it('ignores nothing when given nothing', () => { - expect(testParse('ignoreme')).not.toThrow(); - expect(testParse('includeme')).not.toThrow(); - }); + const testParse = + ( + filePath: 'ignoreme' | 'includeme', + projectFolderIgnoreList?: TSESTreeOptions['projectFolderIgnoreList'], + ) => + (): void => { + parser.parseAndGenerateServices(code, { + ...config, + projectFolderIgnoreList, + filePath: join(PROJECT_DIR, filePath, './file.ts'), + }); + }; + + it('ignores nothing when given nothing', () => { + expect(testParse('ignoreme')).not.toThrow(); + expect(testParse('includeme')).not.toThrow(); + }); - it('ignores a folder when given a string glob', () => { - const ignore = ['**/ignoreme/**']; - // cspell:disable-next-line - expect(testParse('ignoreme', ignore)).toThrow(); - // cspell:disable-next-line - expect(testParse('includeme', ignore)).not.toThrow(); + it('ignores a folder when given a string glob', () => { + const ignore = ['**/ignoreme/**']; + // cspell:disable-next-line + expect(testParse('ignoreme', ignore)).toThrow(); + // cspell:disable-next-line + expect(testParse('includeme', ignore)).not.toThrow(); + }); }); - }); - describe('cacheLifetime', () => { - describe('glob', () => { - function doParse(lifetime: CacheDurationSeconds): void { - parser.parseAndGenerateServices('const x = 1', { - cacheLifetime: { - glob: lifetime, - }, - filePath: join(FIXTURES_DIR, 'file.ts'), - tsconfigRootDir: FIXTURES_DIR, - project: ['./**/tsconfig.json', './**/tsconfig.extra.json'], - }); - } + describe('cacheLifetime', () => { + describe('glob', () => { + function doParse(lifetime: CacheDurationSeconds): void { + parser.parseAndGenerateServices('const x = 1', { + cacheLifetime: { + glob: lifetime, + }, + filePath: join(FIXTURES_DIR, 'file.ts'), + tsconfigRootDir: FIXTURES_DIR, + project: ['./**/tsconfig.json', './**/tsconfig.extra.json'], + }); + } - it('should cache globs if the lifetime is non-zero', () => { - doParse(30); - expect(globbySyncMock).toHaveBeenCalledTimes(1); - doParse(30); - // shouldn't call globby again due to the caching - expect(globbySyncMock).toHaveBeenCalledTimes(1); - }); + it('should cache globs if the lifetime is non-zero', () => { + doParse(30); + expect(globbySyncMock).toHaveBeenCalledTimes(1); + doParse(30); + // shouldn't call globby again due to the caching + expect(globbySyncMock).toHaveBeenCalledTimes(1); + }); - it('should not cache globs if the lifetime is zero', () => { - doParse(0); - expect(globbySyncMock).toHaveBeenCalledTimes(1); - doParse(0); - // should call globby again because we specified immediate cache expiry - expect(globbySyncMock).toHaveBeenCalledTimes(2); - }); + it('should not cache globs if the lifetime is zero', () => { + doParse(0); + expect(globbySyncMock).toHaveBeenCalledTimes(1); + doParse(0); + // should call globby again because we specified immediate cache expiry + expect(globbySyncMock).toHaveBeenCalledTimes(2); + }); - it('should evict the cache if the entry expires', () => { - hrtimeSpy.mockReturnValueOnce([1, 0]); + it('should evict the cache if the entry expires', () => { + hrtimeSpy.mockReturnValueOnce([1, 0]); - doParse(30); - expect(globbySyncMock).toHaveBeenCalledTimes(1); + doParse(30); + expect(globbySyncMock).toHaveBeenCalledTimes(1); - // wow so much time has passed - hrtimeSpy.mockReturnValueOnce([Number.MAX_VALUE, 0]); + // wow so much time has passed + hrtimeSpy.mockReturnValueOnce([Number.MAX_VALUE, 0]); - doParse(30); - // shouldn't call globby again due to the caching - expect(globbySyncMock).toHaveBeenCalledTimes(2); - }); + doParse(30); + // shouldn't call globby again due to the caching + expect(globbySyncMock).toHaveBeenCalledTimes(2); + }); - it('should infinitely cache if passed Infinity', () => { - hrtimeSpy.mockReturnValueOnce([1, 0]); + it('should infinitely cache if passed Infinity', () => { + hrtimeSpy.mockReturnValueOnce([1, 0]); - doParse('Infinity'); - expect(globbySyncMock).toHaveBeenCalledTimes(1); + doParse('Infinity'); + expect(globbySyncMock).toHaveBeenCalledTimes(1); - // wow so much time has passed - hrtimeSpy.mockReturnValueOnce([Number.MAX_VALUE, 0]); + // wow so much time has passed + hrtimeSpy.mockReturnValueOnce([Number.MAX_VALUE, 0]); - doParse('Infinity'); - // shouldn't call globby again due to the caching - expect(globbySyncMock).toHaveBeenCalledTimes(1); + doParse('Infinity'); + // shouldn't call globby again due to the caching + expect(globbySyncMock).toHaveBeenCalledTimes(1); + }); }); }); - }); + } }); diff --git a/packages/typescript-estree/tests/lib/persistentParse.test.ts b/packages/typescript-estree/tests/lib/persistentParse.test.ts index 63e81d7e260..710b9c54ab5 100644 --- a/packages/typescript-estree/tests/lib/persistentParse.test.ts +++ b/packages/typescript-estree/tests/lib/persistentParse.test.ts @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; import tmp from 'tmp'; +import { clearCaches } from '../../src/clear-caches'; import { clearWatchCaches } from '../../src/create-program/getWatchProgramsForProjects'; import { parseAndGenerateServices } from '../../src/parser'; @@ -86,6 +87,11 @@ function baseTests( tsConfigExcludeBar: Record, tsConfigIncludeAll: Record, ): void { + // The experimental project server creates a default project for files + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER === 'true') { + return; + } + it('parses both files successfully when included', () => { const PROJECT_DIR = setup(tsConfigIncludeAll); @@ -177,6 +183,7 @@ function baseTests( // change the config file so it now includes all files writeTSConfig(PROJECT_DIR, tsConfigIncludeAll); + clearCaches(); expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); @@ -257,43 +264,48 @@ describe('persistent parse', () => { /* If there is no includes, then typescript will ask for a slightly different set of watchers. */ - describe('tsconfig with no includes / files', () => { - const tsConfigExcludeBar = { - exclude: ['./src/bar.ts'], - }; - const tsConfigIncludeAll = {}; - baseTests(tsConfigExcludeBar, tsConfigIncludeAll); + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + describe('tsconfig with no includes / files', () => { + const tsConfigExcludeBar = { + exclude: ['./src/bar.ts'], + }; + const tsConfigIncludeAll = {}; - it('handles tsconfigs with no includes/excludes (single level)', () => { - const PROJECT_DIR = setup({}, false); + baseTests(tsConfigExcludeBar, tsConfigIncludeAll); - // parse once to: assert the config as correct, and to make sure the program is setup - expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); - expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); + it('handles tsconfigs with no includes/excludes (single level)', () => { + const PROJECT_DIR = setup({}, false); - // write a new file and attempt to parse it - writeFile(PROJECT_DIR, 'bar'); + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).toThrow(); - expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); - expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); - }); + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, 'bar'); + clearCaches(); + + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('bar', PROJECT_DIR)).not.toThrow(); + }); - it('handles tsconfigs with no includes/excludes (nested)', () => { - const PROJECT_DIR = setup({}, false); - const bazSlashBar = 'baz/bar' as const; + it('handles tsconfigs with no includes/excludes (nested)', () => { + const PROJECT_DIR = setup({}, false); + const bazSlashBar = 'baz/bar' as const; - // parse once to: assert the config as correct, and to make sure the program is setup - expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); - expect(() => parseFile(bazSlashBar, PROJECT_DIR)).toThrow(); + // parse once to: assert the config as correct, and to make sure the program is setup + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile(bazSlashBar, PROJECT_DIR)).toThrow(); - // write a new file and attempt to parse it - writeFile(PROJECT_DIR, bazSlashBar); + // write a new file and attempt to parse it + writeFile(PROJECT_DIR, bazSlashBar); + clearCaches(); - expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); - expect(() => parseFile(bazSlashBar, PROJECT_DIR)).not.toThrow(); + expect(() => parseFile('foo', PROJECT_DIR)).not.toThrow(); + expect(() => parseFile(bazSlashBar, PROJECT_DIR)).not.toThrow(); + }); }); - }); + } /* If there is no includes, then typescript will ask for a slightly different set of watchers. diff --git a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts index b605dd6ea5f..09daae795d6 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo-singleRun.test.ts @@ -1,4 +1,4 @@ -import glob from 'glob'; +import glob = require('glob'); import * as path from 'path'; import { getCanonicalFileName } from '../../src/create-program/shared'; @@ -135,124 +135,132 @@ describe('semanticInfo - singleRun', () => { process.env.CI = originalEnvCI; }); - it('should lazily create the required program out of the provided "parserOptions.project" one time when TSESTREE_SINGLE_RUN=true', () => { - /** - * Single run because of explicit environment variable TSESTREE_SINGLE_RUN - */ - const originalTSESTreeSingleRun = process.env.TSESTREE_SINGLE_RUN; - process.env.TSESTREE_SINGLE_RUN = 'true'; - - const resultProgram = parseAndGenerateServices(code, options).services - .program; - expect(resultProgram).toEqual(mockProgram); - - // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... - parseAndGenerateServices(code, options); - // ...by asserting this was only called once per project - expect(createProgramFromConfigFile).toHaveBeenCalledTimes(tsconfigs.length); - - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 1, - resolvedProject(tsconfigs[0]), - ); - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 2, - resolvedProject(tsconfigs[1]), - ); - - // Restore process data - process.env.TSESTREE_SINGLE_RUN = originalTSESTreeSingleRun; - }); - - it('should lazily create the required program out of the provided "parserOptions.project" one time when singleRun is inferred from CI=true', () => { - /** - * Single run because of CI=true (we need to make sure we respect the original value - * so that we won't interfere with our own usage of the variable) - */ - const originalEnvCI = process.env.CI; - process.env.CI = 'true'; - - const resultProgram = parseAndGenerateServices(code, options).services - .program; - expect(resultProgram).toEqual(mockProgram); - - // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... - parseAndGenerateServices(code, options); - // ...by asserting this was only called once per project - expect(createProgramFromConfigFile).toHaveBeenCalledTimes(tsconfigs.length); - - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 1, - resolvedProject(tsconfigs[0]), - ); - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 2, - resolvedProject(tsconfigs[1]), - ); - - // Restore process data - process.env.CI = originalEnvCI; - }); - - it('should lazily create the required program out of the provided "parserOptions.project" one time when singleRun is inferred from process.argv', () => { - /** - * Single run because of process.argv - */ - const originalProcessArgv = process.argv; - process.argv = ['', path.normalize('node_modules/.bin/eslint'), '']; - - const resultProgram = parseAndGenerateServices(code, options).services - .program; - expect(resultProgram).toEqual(mockProgram); - - // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... - parseAndGenerateServices(code, options); - // ...by asserting this was only called once per project - expect(createProgramFromConfigFile).toHaveBeenCalledTimes(tsconfigs.length); - - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 1, - resolvedProject(tsconfigs[0]), - ); - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 2, - resolvedProject(tsconfigs[1]), - ); - - // Restore process data - process.argv = originalProcessArgv; - }); - - it('should stop iterating through and lazily creating programs for the given "parserOptions.project" once a matching one has been found', () => { - /** - * Single run because of explicit environment variable TSESTREE_SINGLE_RUN - */ - const originalTSESTreeSingleRun = process.env.TSESTREE_SINGLE_RUN; - process.env.TSESTREE_SINGLE_RUN = 'true'; - - const optionsWithReversedTsconfigs = { - ...options, - // Now the matching tsconfig comes first - project: [...options.project].reverse(), - }; - - const resultProgram = parseAndGenerateServices( - code, - optionsWithReversedTsconfigs, - ).services.program; - expect(resultProgram).toEqual(mockProgram); - - // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... - parseAndGenerateServices(code, options); - // ...by asserting this was only called only once - expect(createProgramFromConfigFile).toHaveBeenCalledTimes(1); - - expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( - 1, - resolvedProject(tsconfigs[1]), - ); - - // Restore process data - process.env.TSESTREE_SINGLE_RUN = originalTSESTreeSingleRun; - }); + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it('should lazily create the required program out of the provided "parserOptions.project" one time when TSESTREE_SINGLE_RUN=true', () => { + /** + * Single run because of explicit environment variable TSESTREE_SINGLE_RUN + */ + const originalTSESTreeSingleRun = process.env.TSESTREE_SINGLE_RUN; + process.env.TSESTREE_SINGLE_RUN = 'true'; + + const resultProgram = parseAndGenerateServices(code, options).services + .program; + expect(resultProgram).toEqual(mockProgram); + + // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... + parseAndGenerateServices(code, options); + // ...by asserting this was only called once per project + expect(createProgramFromConfigFile).toHaveBeenCalledTimes( + tsconfigs.length, + ); + + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 1, + resolvedProject(tsconfigs[0]), + ); + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 2, + resolvedProject(tsconfigs[1]), + ); + + // Restore process data + process.env.TSESTREE_SINGLE_RUN = originalTSESTreeSingleRun; + }); + + it('should lazily create the required program out of the provided "parserOptions.project" one time when singleRun is inferred from CI=true', () => { + /** + * Single run because of CI=true (we need to make sure we respect the original value + * so that we won't interfere with our own usage of the variable) + */ + const originalEnvCI = process.env.CI; + process.env.CI = 'true'; + + const resultProgram = parseAndGenerateServices(code, options).services + .program; + expect(resultProgram).toEqual(mockProgram); + + // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... + parseAndGenerateServices(code, options); + // ...by asserting this was only called once per project + expect(createProgramFromConfigFile).toHaveBeenCalledTimes( + tsconfigs.length, + ); + + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 1, + resolvedProject(tsconfigs[0]), + ); + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 2, + resolvedProject(tsconfigs[1]), + ); + + // Restore process data + process.env.CI = originalEnvCI; + }); + + it('should lazily create the required program out of the provided "parserOptions.project" one time when singleRun is inferred from process.argv', () => { + /** + * Single run because of process.argv + */ + const originalProcessArgv = process.argv; + process.argv = ['', path.normalize('node_modules/.bin/eslint'), '']; + + const resultProgram = parseAndGenerateServices(code, options).services + .program; + expect(resultProgram).toEqual(mockProgram); + + // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... + parseAndGenerateServices(code, options); + // ...by asserting this was only called once per project + expect(createProgramFromConfigFile).toHaveBeenCalledTimes( + tsconfigs.length, + ); + + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 1, + resolvedProject(tsconfigs[0]), + ); + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 2, + resolvedProject(tsconfigs[1]), + ); + + // Restore process data + process.argv = originalProcessArgv; + }); + + it('should stop iterating through and lazily creating programs for the given "parserOptions.project" once a matching one has been found', () => { + /** + * Single run because of explicit environment variable TSESTREE_SINGLE_RUN + */ + const originalTSESTreeSingleRun = process.env.TSESTREE_SINGLE_RUN; + process.env.TSESTREE_SINGLE_RUN = 'true'; + + const optionsWithReversedTsconfigs = { + ...options, + // Now the matching tsconfig comes first + project: [...options.project].reverse(), + }; + + const resultProgram = parseAndGenerateServices( + code, + optionsWithReversedTsconfigs, + ).services.program; + expect(resultProgram).toEqual(mockProgram); + + // Call parseAndGenerateServices() again to ensure caching of Programs is working correctly... + parseAndGenerateServices(code, options); + // ...by asserting this was only called only once + expect(createProgramFromConfigFile).toHaveBeenCalledTimes(1); + + expect(createProgramFromConfigFile).toHaveBeenNthCalledWith( + 1, + resolvedProject(tsconfigs[1]), + ); + + // Restore process data + process.env.TSESTREE_SINGLE_RUN = originalTSESTreeSingleRun; + }); + } }); diff --git a/packages/typescript-estree/tests/lib/semanticInfo.test.ts b/packages/typescript-estree/tests/lib/semanticInfo.test.ts index 9c8aacf6668..83569479085 100644 --- a/packages/typescript-estree/tests/lib/semanticInfo.test.ts +++ b/packages/typescript-estree/tests/lib/semanticInfo.test.ts @@ -1,9 +1,9 @@ import * as fs from 'fs'; -import glob from 'glob'; +import glob = require('glob'); import * as path from 'path'; import * as ts from 'typescript'; -import { clearWatchCaches } from '../../src/create-program/getWatchProgramsForProjects'; +import { clearCaches } from '../../src'; import { createProgramFromConfigFile as createProgram } from '../../src/create-program/useProvidedPrograms'; import type { ParseAndGenerateServicesResult } from '../../src/parser'; import { parseAndGenerateServices } from '../../src/parser'; @@ -14,6 +14,7 @@ import { formatSnapshotName, parseCodeAndGenerateServices, } from '../../tools/test-utils'; +import { expectToHaveParserServices } from './test-utils/expectToHaveParserServices'; const FIXTURES_DIR = './tests/fixtures/semanticInfo'; const testFiles = glob.sync(`**/*.src.ts`, { @@ -36,7 +37,7 @@ function createOptions(fileName: string): TSESTreeOptions & { cwd?: string } { } // ensure tsconfig-parser watch caches are clean for each test -beforeEach(() => clearWatchCaches()); +beforeEach(() => clearCaches()); describe('semanticInfo', () => { // test all AST snapshots @@ -79,8 +80,17 @@ describe('semanticInfo', () => { ...options, project: ['./tsconfig.json'], }; - expect(parseAndGenerateServices(code, optionsProjectString)).toEqual( - parseAndGenerateServices(code, optionsProjectArray), + const fromString = parseAndGenerateServices(code, optionsProjectString); + const fromArray = parseAndGenerateServices(code, optionsProjectArray); + + expect(fromString.services.program).toBe(fromArray.services.program); + + expect(fromString.ast).toEqual(fromArray.ast); + expect(fromString.services.esTreeNodeToTSNodeMap).toEqual( + fromArray.services.esTreeNodeToTSNodeMap, + ); + expect(fromString.services.tsNodeToESTreeNodeMap).toEqual( + fromArray.services.tsNodeToESTreeNodeMap, ); }); @@ -104,9 +114,9 @@ describe('semanticInfo', () => { code, optionsRelativePath, ); - if (absolutePathResult.services.program === undefined) { + if (absolutePathResult.services.program == null) { throw new Error('Unable to create ts.program for absolute tsconfig'); - } else if (relativePathResult.services.program === undefined) { + } else if (relativePathResult.services.program == null) { throw new Error('Unable to create ts.program for relative tsconfig'); } expect( @@ -150,12 +160,13 @@ describe('semanticInfo', () => { createOptions(fileName), ); - expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); + expectToHaveParserServices(parseResult.services); const binaryExpression = ( parseResult.ast.body[0] as TSESTree.VariableDeclaration ).declarations[0].init!; const tsBinaryExpression = parseResult.services.esTreeNodeToTSNodeMap.get(binaryExpression); + expectToBeDefined(tsBinaryExpression); expect(tsBinaryExpression.kind).toEqual(ts.SyntaxKind.BinaryExpression); const computedPropertyString = ( @@ -164,6 +175,7 @@ describe('semanticInfo', () => { ).key; const tsComputedPropertyString = parseResult.services.esTreeNodeToTSNodeMap.get(computedPropertyString); + expectToBeDefined(tsComputedPropertyString); expect(tsComputedPropertyString.kind).toEqual(ts.SyntaxKind.StringLiteral); }); @@ -176,7 +188,8 @@ describe('semanticInfo', () => { // get type checker expect(parseResult).toHaveProperty('services.program.getTypeChecker'); - const checker = parseResult.services.program.getTypeChecker(); + const checker = parseResult.services.program?.getTypeChecker(); + expectToBeDefined(checker); // get array node (ast shape validated by snapshot) // node is defined in other file than the parsed one @@ -188,10 +201,10 @@ describe('semanticInfo', () => { ).object as TSESTree.Identifier; expect(arrayBoundName.name).toBe('arr'); - expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); + expectToHaveParserServices(parseResult.services); const tsArrayBoundName = parseResult.services.esTreeNodeToTSNodeMap.get(arrayBoundName); - expect(tsArrayBoundName).toBeDefined(); + expectToBeDefined(tsArrayBoundName); checkNumberArrayType(checker, tsArrayBoundName); expect( @@ -209,18 +222,17 @@ describe('semanticInfo', () => { }, ); - expect(parseResult.services.program).toBeDefined(); - // get bound name const boundName = (parseResult.ast.body[0] as TSESTree.VariableDeclaration) .declarations[0].id as TSESTree.Identifier; expect(boundName.name).toBe('x'); const tsBoundName = - parseResult.services.esTreeNodeToTSNodeMap.get(boundName); + parseResult.services.esTreeNodeToTSNodeMap?.get(boundName); + expectToBeDefined(tsBoundName); expect(tsBoundName).toBeDefined(); - expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsBoundName)).toBe( + expect(parseResult.services.tsNodeToESTreeNodeMap?.get(tsBoundName)).toBe( boundName, ); }); @@ -234,63 +246,69 @@ describe('semanticInfo', () => { expect(parseResult.services.program).toBeDefined(); }); - it(`non-existent file should throw error when project provided`, () => { - expect(() => - parseCodeAndGenerateServices( - `function M() { return Base }`, - createOptions(''), - ), - ).toThrow( - /ESLint was configured to run on `\/estree\.ts` using/, - ); - }); - - it('non-existent project file', () => { - const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); - const badConfig = createOptions(fileName); - badConfig.project = './tsconfigs.json'; - expect(() => - parseCodeAndGenerateServices( - fs.readFileSync(fileName, 'utf8'), - badConfig, - ), - ).toThrow(/Cannot read file .+tsconfigs\.json'/); - }); + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it(`non-existent file should throw error when project provided`, () => { + expect(() => + parseCodeAndGenerateServices( + `function M() { return Base }`, + createOptions(''), + ), + ).toThrow( + /ESLint was configured to run on `\/estree\.ts` using/, + ); + }); + } + + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it('non-existent project file', () => { + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const badConfig = createOptions(fileName); + badConfig.project = './tsconfigs.json'; + expect(() => + parseCodeAndGenerateServices( + fs.readFileSync(fileName, 'utf8'), + badConfig, + ), + ).toThrow(/Cannot read file .+tsconfigs\.json'/); + }); - it('fail to read project file', () => { - const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); - const badConfig = createOptions(fileName); - badConfig.project = '.'; - expect(() => - parseCodeAndGenerateServices( - fs.readFileSync(fileName, 'utf8'), - badConfig, - ), - ).toThrow( - // case insensitive because unix based systems are case insensitive - /Cannot read file .+semanticInfo'./i, - ); - }); + it('fail to read project file', () => { + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const badConfig = createOptions(fileName); + badConfig.project = '.'; + expect(() => + parseCodeAndGenerateServices( + fs.readFileSync(fileName, 'utf8'), + badConfig, + ), + ).toThrow( + // case insensitive because unix based systems are case insensitive + /Cannot read file .+semanticInfo'/i, + ); + }); - it('malformed project file', () => { - const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); - const badConfig = createOptions(fileName); - badConfig.project = './badTSConfig/tsconfig.json'; - expect(() => - parseCodeAndGenerateServices( - fs.readFileSync(fileName, 'utf8'), - badConfig, - ), - ).toThrowErrorMatchingSnapshot(); - }); + it('malformed project file', () => { + const fileName = path.resolve(FIXTURES_DIR, 'isolated-file.src.ts'); + const badConfig = createOptions(fileName); + badConfig.project = './badTSConfig/tsconfig.json'; + expect(() => + parseCodeAndGenerateServices( + fs.readFileSync(fileName, 'utf8'), + badConfig, + ), + ).toThrowErrorMatchingInlineSnapshot( + `"Compiler option 'compileOnSave' requires a value of type boolean."`, + ); + }); + } it('default program produced with option', () => { const parseResult = parseCodeAndGenerateServices('var foo = 5;', { ...createOptions(''), - createDefaultProgram: true, + DEPRECATED__createDefaultProgram: true, }); - expect(parseResult.services.program).toBeDefined(); + expectToHaveParserServices(parseResult.services); }); it('empty programs array should throw', () => { @@ -302,20 +320,22 @@ describe('semanticInfo', () => { ); }); - it(`first matching provided program instance is returned in result`, () => { - const filename = testFiles[0]; - const program1 = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); - const program2 = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); - const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); - const options = createOptions(filename); - const optionsProjectString = { - ...options, - programs: [program1, program2], - project: './tsconfig.json', - }; - const parseResult = parseAndGenerateServices(code, optionsProjectString); - expect(parseResult.services.program).toBe(program1); - }); + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER !== 'true') { + it(`first matching provided program instance is returned in result`, () => { + const filename = testFiles[0]; + const program1 = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); + const program2 = createProgram(path.join(FIXTURES_DIR, 'tsconfig.json')); + const code = fs.readFileSync(path.join(FIXTURES_DIR, filename), 'utf8'); + const options = createOptions(filename); + const optionsProjectString = { + ...options, + programs: [program1, program2], + project: './tsconfig.json', + }; + const parseResult = parseAndGenerateServices(code, optionsProjectString); + expect(parseResult.services.program).toBe(program1); + }); + } it('file not in provided program instance(s)', () => { const filename = 'non-existent-file.ts'; @@ -357,21 +377,25 @@ describe('semanticInfo', () => { function testIsolatedFile( parseResult: ParseAndGenerateServicesResult, ): void { + if (process.env.TYPESCRIPT_ESLINT_EXPERIMENTAL_TSSERVER === 'true') { + return; + } + // get type checker - expect(parseResult).toHaveProperty('services.program.getTypeChecker'); + expectToHaveParserServices(parseResult.services); const checker = parseResult.services.program.getTypeChecker(); + expectToBeDefined(checker); // get number node (ast shape validated by snapshot) const declaration = (parseResult.ast.body[0] as TSESTree.VariableDeclaration) .declarations[0]; const arrayMember = (declaration.init! as TSESTree.ArrayExpression) .elements[0]!; - expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap'); // get corresponding TS node const tsArrayMember = parseResult.services.esTreeNodeToTSNodeMap.get(arrayMember); - expect(tsArrayMember).toBeDefined(); + expectToBeDefined(tsArrayMember); expect(tsArrayMember.kind).toBe(ts.SyntaxKind.NumericLiteral); expect((tsArrayMember as ts.NumericLiteral).text).toBe('3'); @@ -383,7 +407,6 @@ function testIsolatedFile( expect((arrayMemberType as any).value).toBe(3); // make sure it maps back to original ESTree node - expect(parseResult).toHaveProperty('services.tsNodeToESTreeNodeMap'); expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsArrayMember)).toBe( arrayMember, ); @@ -392,7 +415,7 @@ function testIsolatedFile( const boundName = declaration.id as TSESTree.Identifier; expect(boundName.name).toBe('x'); const tsBoundName = parseResult.services.esTreeNodeToTSNodeMap.get(boundName); - expect(tsBoundName).toBeDefined(); + expectToBeDefined(tsBoundName); checkNumberArrayType(checker, tsBoundName); expect(parseResult.services.tsNodeToESTreeNodeMap.get(tsBoundName)).toBe( boundName, @@ -414,3 +437,7 @@ function checkNumberArrayType(checker: ts.TypeChecker, tsNode: ts.Node): void { expect(typeArguments).toHaveLength(1); expect(typeArguments[0].flags).toBe(ts.TypeFlags.Number); } + +function expectToBeDefined(thing: unknown): asserts thing { + expect(thing).toBeDefined(); +} diff --git a/packages/typescript-estree/tests/lib/source-files.test.ts b/packages/typescript-estree/tests/lib/source-files.test.ts new file mode 100644 index 00000000000..e6edb1c9c65 --- /dev/null +++ b/packages/typescript-estree/tests/lib/source-files.test.ts @@ -0,0 +1,37 @@ +import * as ts from 'typescript'; + +import { getCodeText, isSourceFile } from '../../src/source-files'; + +describe('isSourceFile', () => { + it.each([null, undefined, {}, { getFullText: (): string => '', text: '' }])( + `returns false when given %j`, + input => { + expect(isSourceFile(input)).toBe(false); + }, + ); + + it('returns true when given a real source file', () => { + const input = ts.createSourceFile('test.ts', '', ts.ScriptTarget.ESNext); + + expect(isSourceFile(input)).toBe(true); + }); +}); + +describe('getCodeText', () => { + it('returns the code when code is provided as a string', () => { + const code = '// Hello world'; + + expect(getCodeText(code)).toBe(code); + }); + + it('returns the code when code is provided as a source file', () => { + const code = '// Hello world'; + const sourceFile = ts.createSourceFile( + 'test.ts', + code, + ts.ScriptTarget.ESNext, + ); + + expect(getCodeText(sourceFile)).toBe(code); + }); +}); diff --git a/packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts b/packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts new file mode 100644 index 00000000000..d087dd3c54b --- /dev/null +++ b/packages/typescript-estree/tests/lib/test-utils/expectToHaveParserServices.ts @@ -0,0 +1,12 @@ +import type { + ParserServices, + ParserServicesWithTypeInformation, +} from '../../../src'; + +export function expectToHaveParserServices( + services: ParserServices | null | undefined, +): asserts services is ParserServicesWithTypeInformation { + expect(services?.program).toBeDefined(); + expect(services?.esTreeNodeToTSNodeMap).toBeDefined(); + expect(services?.tsNodeToESTreeNodeMap).toBeDefined(); +} diff --git a/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot index c308a872193..79f98905243 100644 --- a/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +22,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { 9, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot index 01ef8ebde72..e8d9e1190da 100644 --- a/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot @@ -38,6 +38,7 @@ Object { 30, ], "test": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -49,11 +50,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "IfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot index dbeef2b24f9..f53fbf24d7b 100644 --- a/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot @@ -5,11 +5,15 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -21,11 +25,13 @@ Object { }, }, "name": "method1", + "optional": false, "range": Array [ 103, 110, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,6 +44,7 @@ Object { "line": 8, }, }, + "optional": false, "override": false, "range": Array [ 103, @@ -45,6 +52,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -65,6 +73,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -83,7 +92,9 @@ Object { 110, 119, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -103,7 +114,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -119,7 +133,9 @@ Object { 121, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot index b23e2d9faa0..89327f903b6 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +21,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 130, 133, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,9 +62,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -73,11 +78,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 108, 111, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -91,6 +98,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -102,18 +110,22 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 112, 115, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 99, 136, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot index 0313f535de1..0dd1ca45457 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "link", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -207,6 +211,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot index 851f8980ab5..76bf409f37b 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "pure", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -248,7 +252,9 @@ Object { 13, 97, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -267,6 +273,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot index 3d15f9abd76..1976fe78dcb 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "pure", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -171,7 +175,9 @@ Object { 13, 69, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -190,6 +196,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot index d60cb362824..72fdcdbea63 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "pure", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -137,7 +141,9 @@ Object { 13, 65, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -156,6 +162,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot index cbf278f9ee7..ea6c181c416 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "comp", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -1587,6 +1591,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot index d603a3fcee3..9cc61ef5262 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "pure", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -263,7 +267,9 @@ Object { 13, 125, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -282,6 +288,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot index 177f12a1662..7f900cacc43 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "pure", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -193,7 +197,9 @@ Object { 13, 127, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -212,6 +218,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot index 34ae0afe27e..39839405cec 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "pure", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -199,7 +203,9 @@ Object { 13, 93, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -218,6 +224,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot index b51fc4edf9c..cf4fda8c7c8 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -18,11 +20,13 @@ Object { }, }, "name": "first", + "optional": false, "range": Array [ 6, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -152,6 +156,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -172,7 +177,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -184,11 +191,13 @@ Object { }, }, "name": "second", + "optional": false, "range": Array [ 52, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -279,6 +288,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -299,7 +309,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -311,11 +323,13 @@ Object { }, }, "name": "third", + "optional": false, "range": Array [ 93, 98, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -502,6 +516,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -522,7 +537,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -534,11 +551,13 @@ Object { }, }, "name": "fourth", + "optional": false, "range": Array [ 145, 151, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -759,6 +778,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -779,7 +799,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -791,11 +813,13 @@ Object { }, }, "name": "fifth", + "optional": false, "range": Array [ 205, 210, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -959,6 +983,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot index 308c14521e5..5259bfe57ae 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot @@ -8,6 +8,7 @@ Object { "consequent": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -68,6 +69,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -79,11 +81,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 24, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -101,6 +105,7 @@ Object { 37, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -121,7 +126,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -133,11 +140,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -267,6 +276,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot index 2d5c27d4fe0..450afc1e806 100644 --- a/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot @@ -8,6 +8,7 @@ Object { "consequent": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -68,6 +69,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -79,11 +81,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 24, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -101,6 +105,7 @@ Object { 37, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -121,7 +126,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -133,11 +140,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "children": Array [ @@ -267,6 +276,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/line-comment-with-block-syntax.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/line-comment-with-block-syntax.src.js.shot deleted file mode 100644 index a1734c99955..00000000000 --- a/packages/typescript-estree/tests/snapshots/comments/line-comment-with-block-syntax.src.js.shot +++ /dev/null @@ -1,44 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`comments line-comment-with-block-syntax.src 1`] = ` -Object { - "body": Array [], - "comments": Array [ - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 11, - ], - "type": "Line", - "value": " /*test*/", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 12, - 12, - ], - "sourceType": "script", - "tokens": Array [], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot index af451f23528..5966397a09f 100644 --- a/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "zzz", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot index 9ecb5409c47..140681a1d94 100644 --- a/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -18,11 +20,13 @@ Object { }, }, "name": "regex", + "optional": false, "range": Array [ 6, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot index 605981ef3f0..5f56111360c 100644 --- a/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,15 +20,18 @@ Object { }, }, "name": "str", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -38,11 +43,13 @@ Object { }, }, "name": "__dirname", + "optional": false, "range": Array [ 15, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -124,6 +131,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot index 0d0bd7170a1..4bc091f11c9 100644 --- a/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot @@ -8,9 +8,11 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -22,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 36, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -44,6 +48,7 @@ Object { 41, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -78,9 +83,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -92,11 +99,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,7 +122,9 @@ Object { 0, 60, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot index 7e018cbb0bc..b4a4fd0d2eb 100644 --- a/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot @@ -41,9 +41,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -55,11 +57,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -76,7 +80,9 @@ Object { 0, 63, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot index 2f78d3e8fc8..2b489829d21 100644 --- a/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot @@ -42,9 +42,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -56,11 +58,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -77,7 +81,9 @@ Object { 0, 61, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot index 9a82fbf916c..4c7ece7aa12 100644 --- a/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot @@ -60,9 +60,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -74,11 +76,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -95,7 +99,9 @@ Object { 0, 63, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot index f420f8e9477..37f5b7aa1f8 100644 --- a/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot @@ -64,7 +64,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 65, @@ -76,11 +78,13 @@ Object { }, }, "name": "each", + "optional": false, "range": Array [ 61, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -100,6 +104,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,9 +139,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -148,11 +155,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -169,7 +178,9 @@ Object { 0, 68, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot index 0adf07336f0..18abdc0cf22 100644 --- a/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot @@ -49,9 +49,11 @@ Object { Object { "consequent": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -63,11 +65,13 @@ Object { }, }, "name": "doIt", + "optional": false, "range": Array [ 126, 130, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +89,7 @@ Object { 132, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -140,6 +145,7 @@ Object { }, ], "discriminant": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -151,11 +157,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 31, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -190,9 +198,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -204,11 +214,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -222,6 +234,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -233,18 +246,22 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 141, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot index 389db77efbe..b24e17d0447 100644 --- a/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot @@ -45,9 +45,11 @@ Object { Object { "consequent": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -59,11 +61,13 @@ Object { }, }, "name": "doIt", + "optional": false, "range": Array [ 82, 86, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -81,6 +85,7 @@ Object { 88, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -136,6 +141,7 @@ Object { }, ], "discriminant": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -147,11 +153,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot index f86bee97a62..87d736c4f0e 100644 --- a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot @@ -123,6 +123,7 @@ Object { }, ], "discriminant": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -134,11 +135,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -173,9 +176,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -187,11 +192,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -205,6 +212,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -216,18 +224,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 133, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot index 42139bf5b63..9614231c22c 100644 --- a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot @@ -4,6 +4,7 @@ exports[`comments switch-no-default-comment-in-nested-functions.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -18,6 +19,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -29,14 +31,17 @@ Object { }, }, "name": "module", + "optional": false, "range": Array [ 0, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -48,11 +53,13 @@ Object { }, }, "name": "exports", + "optional": false, "range": Array [ 7, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, @@ -115,6 +122,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -126,14 +134,17 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 172, 176, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 50, @@ -145,11 +156,13 @@ Object { }, }, "name": "expressions", + "optional": false, "range": Array [ 177, 188, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 172, @@ -184,6 +197,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -195,14 +209,17 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 189, 193, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 67, @@ -214,11 +231,13 @@ Object { }, }, "name": "expressions", + "optional": false, "range": Array [ 194, 205, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 189, @@ -228,6 +247,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 74, @@ -239,11 +259,13 @@ Object { }, }, "name": "length", + "optional": false, "range": Array [ 206, 212, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 189, @@ -295,6 +317,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -306,11 +329,13 @@ Object { }, }, "name": "isConstant", + "optional": false, "range": Array [ 161, 171, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -328,6 +353,7 @@ Object { 218, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -395,6 +421,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -406,14 +433,17 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 86, 90, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -425,11 +455,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 91, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 86, @@ -506,9 +538,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -520,11 +554,13 @@ Object { }, }, "name": "isConstant", + "optional": false, "range": Array [ 51, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -538,6 +574,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -549,18 +586,22 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 62, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 42, 283, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "loc": Object { @@ -579,6 +620,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -594,6 +636,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -605,18 +648,22 @@ Object { }, }, "name": "context", + "optional": false, "range": Array [ 26, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 286, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot index 7080fcb47ac..53613d3d8d9 100644 --- a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot @@ -63,6 +63,7 @@ Object { }, ], "discriminant": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -74,11 +75,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot index 7bf2391791b..7239d1f6e53 100644 --- a/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot @@ -4,9 +4,11 @@ exports[`comments template-string-block.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 3, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -106,6 +110,7 @@ Object { Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot b/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot index d341354418b..f3145c864a8 100644 --- a/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,14 +20,17 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -37,11 +42,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 28, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +82,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -86,11 +94,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -112,6 +122,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot index c3ec8e725e3..554c83a56e0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrayLiteral array-literal-in-lhs.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -39,6 +40,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -50,11 +52,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 0, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,9 +76,11 @@ Object { 6, ], "type": "CallExpression", + "typeParameters": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -86,11 +92,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, @@ -114,6 +122,7 @@ Object { 14, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -125,11 +134,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot index 989d13f56f2..d88642ceb62 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrayLiteral array-literals-in-binary-expr.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "elements": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot index 81e612e0eab..998c55131cc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions as-param-with-params.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -41,6 +42,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -52,13 +54,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -70,21 +75,26 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 4, 16, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -96,11 +106,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -118,6 +130,7 @@ Object { 17, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot index be5d3b9325e..a56eab70461 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions as-param.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -44,10 +45,13 @@ Object { 4, 12, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -59,11 +63,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -81,6 +87,7 @@ Object { 13, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot index 4335f87c535..2b28216e207 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions basic-in-binary-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "async": false, @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -51,18 +53,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 1, 10, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -117,6 +123,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "left": Object { "async": false, @@ -153,6 +160,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -164,18 +172,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 19, 28, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot index 5cf67b877aa..9fd9ec3be16 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions basic.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -43,7 +44,9 @@ Object { 0, 12, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot index 1fdda7f5b3f..f2188951eca 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot @@ -4,12 +4,14 @@ exports[`javascript arrowFunctions block-body-not-object.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { "body": Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -46,6 +48,7 @@ Object { "type": "ExpressionStatement", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -57,11 +60,13 @@ Object { }, }, "name": "label", + "optional": false, "range": Array [ 7, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -111,6 +116,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -122,18 +128,22 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 18, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot index a4355b71837..34082fc3d30 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript arrowFunctions block-body.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -76,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -87,18 +90,22 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 12, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot index 2f01ca49fcf..fa7ac3476f0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions error-dup-params.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -51,13 +53,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -69,18 +74,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 12, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot deleted file mode 100644 index 0ac39c77fa9..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-missing-paren.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript arrowFunctions error-missing-paren.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot deleted file mode 100644 index ccca762cfac..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-not-arrow.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript arrowFunctions error-not-arrow.src 1`] = ` -TSError { - "column": 26, - "index": 26, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot deleted file mode 100644 index a6309f29f7a..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param-multi.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript arrowFunctions error-numeric-param-multi.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot deleted file mode 100644 index 00a6318c84e..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-numeric-param.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript arrowFunctions error-numeric-param.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot deleted file mode 100644 index 2b010cb8480..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-reverse-arrow.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript arrowFunctions error-reverse-arrow.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot index 572e4d58fcb..442810635e0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,7 +78,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -89,11 +92,13 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 15, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -105,6 +110,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 24, @@ -129,13 +135,16 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 31, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot index b70d21a53dc..c49d8c299ba 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -88,13 +90,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -106,18 +111,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 26, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot index 86770eb2a90..ec2906450b0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -88,18 +90,22 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 15, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 26, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot index 29bae3b9246..f268b518cad 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions error-strict-eval.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -46,6 +47,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -113,6 +115,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -124,18 +127,22 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 1, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 30, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot index 6ea38c2de2d..ece03a5396a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -88,18 +90,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 23, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot index 02b62b5f60e..159a3d7feed 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -88,13 +90,16 @@ Object { }, }, "name": "arguments", + "optional": false, "range": Array [ 15, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -106,18 +111,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 34, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot index 41b0004c5bd..07d22363882 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -88,13 +90,16 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 15, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -106,18 +111,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 29, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot index df2b0492f13..b772330ff8c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -88,13 +90,16 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 15, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -106,18 +111,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 29, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot index b35cd58c7f8..94626ddb831 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -88,18 +90,22 @@ Object { }, }, "name": "arguments", + "optional": false, "range": Array [ 14, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 29, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot index a47984c8372..31062099d02 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -77,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -88,18 +90,22 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 14, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 14, 24, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot index c61b5eb26bc..e3aefbf0a54 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -63,7 +67,9 @@ Object { 8, 16, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -82,6 +88,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot deleted file mode 100644 index 921faeae08b..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-wrapped-param.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript arrowFunctions error-wrapped-param.src 1`] = ` -TSError { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot index 1c68a4620ba..5c8f0d5dbf9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript arrowFunctions expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -50,18 +55,22 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 1, 7, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot index fb08fd1465b..b519469a410 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions iife.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -21,6 +22,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -32,11 +34,13 @@ Object { }, }, "name": "property", + "optional": false, "range": Array [ 8, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +54,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 8, 20, @@ -98,6 +103,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -109,18 +115,22 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 23, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot index 938ad60939f..6a4970cd86d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions multiple-params.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -51,13 +53,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -69,18 +74,22 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 16, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot index 76386e3eb3e..ca557bc8091 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript arrowFunctions no-auto-return.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -76,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -87,13 +90,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -105,18 +111,22 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 17, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot index 8a223f8c59a..6c2ed960a1a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions not-strict-arguments.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -51,18 +53,22 @@ Object { }, }, "name": "arguments", + "optional": false, "range": Array [ 0, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 15, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot index e91159c2d92..5212878a716 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions not-strict-eval-params.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -51,13 +53,16 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 1, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -69,18 +74,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 15, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot index 05b2c6343f8..1e3c66af393 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions not-strict-eval.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -51,18 +53,22 @@ Object { }, }, "name": "eval", + "optional": false, "range": Array [ 0, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 10, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot index f34db200393..3a7aef2a4ca 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions not-strict-octal.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -51,18 +53,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 10, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot index 916b2d0b87d..013339c5ed1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions return-arrow-function.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -42,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -53,18 +55,22 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 5, 12, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "expression": true, "generator": false, @@ -81,6 +87,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -92,18 +99,22 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 12, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot index 9a52ff378ab..6a0e5199bed 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions return-sequence.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -11,6 +12,7 @@ Object { "body": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -22,13 +24,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -40,13 +45,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -58,11 +66,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -96,6 +106,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -107,13 +118,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -125,18 +139,22 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 8, 27, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "expression": true, "generator": false, @@ -153,6 +171,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -164,18 +183,22 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 28, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot index 26aaf540516..1ca178a95e6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions single-param-parens.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -51,18 +53,22 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 13, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot index 580bc8663a2..b91941a024a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript arrowFunctions single-param-return-identifier.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -18,11 +20,13 @@ Object { }, }, "name": "earth", + "optional": false, "range": Array [ 9, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -50,18 +55,22 @@ Object { }, }, "name": "sun", + "optional": false, "range": Array [ 1, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 14, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot index 9b88982aebf..787c7e574f8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript arrowFunctions single-param.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -40,6 +41,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -51,18 +53,22 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 11, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot index c119d31556c..24c3a2164a6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -241,6 +245,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -261,7 +266,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -273,11 +280,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 48, 49, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -496,6 +505,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -516,7 +526,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -528,11 +540,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 92, 93, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -605,6 +619,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -625,7 +640,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -637,11 +654,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 110, 111, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -714,6 +733,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot index 8f05ddeb3a7..ea33bcb2b13 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript basics delete-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { "computed": false, @@ -18,6 +19,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -29,14 +31,17 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -48,11 +53,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot index 0da42f60630..9ca5eda169a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot @@ -59,7 +59,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -71,11 +73,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -113,6 +117,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,8 +139,10 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -147,11 +154,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 34, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -238,6 +247,7 @@ Object { ], "test": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -249,11 +259,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 51, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot index 9ceeaf3b4df..cd84ca3b20b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "__test", + "optional": false, "range": Array [ 4, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -78,6 +83,7 @@ Object { "type": "VariableDeclaration", }, Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -96,7 +102,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -108,12 +117,15 @@ Object { }, }, "name": "__Foo", + "optional": false, "range": Array [ 26, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -129,7 +141,9 @@ Object { 36, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "async": false, @@ -151,9 +165,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -165,11 +181,13 @@ Object { }, }, "name": "__Bar", + "optional": false, "range": Array [ 47, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -186,7 +204,9 @@ Object { 38, 59, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot index ad8045b6619..9f636d412f1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript basics instanceof.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "loc": Object { @@ -40,6 +41,7 @@ Object { 17, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -51,11 +53,13 @@ Object { }, }, "name": "Set", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot index bc0dcb86119..d540f39388a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript basics new-with-member-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -19,6 +20,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -30,14 +32,17 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -49,11 +54,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 4, @@ -76,6 +83,7 @@ Object { 13, ], "type": "NewExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot index 3c932c1e6c4..a136fbdfdc9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,12 +62,16 @@ Object { 0, 16, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -75,11 +83,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -96,6 +106,7 @@ Object { 22, ], "type": "NewExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot index 93a6e76b94b..d880e34edf5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -241,6 +245,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -261,7 +266,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -273,11 +280,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 48, 49, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -496,6 +505,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -516,7 +526,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -528,11 +540,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 92, 93, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -605,6 +619,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -625,7 +640,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -637,11 +654,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 110, 111, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -714,6 +733,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot index 8adff11923d..7478955678e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript basics typeof-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot index 148f69323ff..38f46f64918 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -82,8 +87,10 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -95,11 +102,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -152,9 +161,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -166,11 +177,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -187,12 +200,16 @@ Object { 11, 34, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -204,11 +221,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -226,6 +245,7 @@ Object { 38, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot index 3eb83ba3441..bd4a10bb061 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript basics void-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { "loc": Object { @@ -59,6 +60,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "argument": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot index edafc1a0bf7..4a8d4f331be 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript bigIntLiterals binary.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "bigint": "1", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot index 648b69dde96..bf56f2d96eb 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript bigIntLiterals decimal.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "bigint": "1", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot index 7a64e5d3015..75125bb184e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript bigIntLiterals hex.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "bigint": "1", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot index 4697f202586..3cd9533db4a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript bigIntLiterals numeric-separator.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "bigint": "123", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot index e81eaea4b78..52786883897 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript bigIntLiterals octal.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "bigint": "1", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot deleted file mode 100644 index a65dcc90f69..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/invalid.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript binaryLiterals invalid.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot index bc09e142ce7..124bdb4cd05 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript binaryLiterals lowercase.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot index 100dd4d404c..3fa0b872adb 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript binaryLiterals uppercase.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot index 939c699d4fb..0e996dde2f1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,13 +20,16 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -36,11 +41,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot index 56f8c6b6695..12070dc88d6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot @@ -10,7 +10,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -22,11 +24,13 @@ Object { }, }, "name": "t", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -137,6 +142,7 @@ Object { }, ], "discriminant": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -148,11 +154,13 @@ Object { }, }, "name": "answer", + "optional": false, "range": Array [ 8, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot index 53576d7145a..bc446c5e3d1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,13 +20,16 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -36,11 +41,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot index 78d5678d526..3dddfc56a21 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript callExpression call-expression-with-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -26,6 +27,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,6 +63,7 @@ Object { 7, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot index 6483ae5d3c2..9089a7c7a3a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript callExpression call-expression-with-object.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -26,6 +27,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,6 +63,7 @@ Object { 7, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot index cb035b8a2cd..fb023683793 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript callExpression mixed-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -30,6 +31,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -56,6 +58,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -126,6 +129,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -137,11 +141,13 @@ Object { }, }, "name": "call", + "optional": false, "range": Array [ 41, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 36, @@ -165,6 +171,7 @@ Object { 53, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -199,6 +206,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -217,7 +225,9 @@ Object { 18, 57, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -235,6 +245,7 @@ Object { 62, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -269,6 +280,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -287,7 +299,9 @@ Object { 1, 65, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -305,6 +319,7 @@ Object { 70, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot index 705206bd863..30fb7745a51 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript callExpression new-expression-with-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -26,6 +27,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -37,11 +39,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 11, ], "type": "NewExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -76,6 +81,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -136,6 +142,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -147,11 +154,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -168,6 +177,7 @@ Object { 28, ], "type": "NewExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot index 4bdbd1be761..3b615a44ca9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript callExpression new-expression-with-object.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -26,6 +27,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -37,11 +39,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 11, ], "type": "NewExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot index 62aadc15acb..7eab8102766 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-accessor-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 14, 18, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -99,11 +113,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 19, @@ -123,6 +140,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -158,6 +177,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -169,18 +189,22 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 24, 29, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -200,7 +224,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -212,12 +239,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 31, @@ -233,7 +263,9 @@ Object { 31, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot index 5871d6c60c9..11524816612 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-computed-static-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 19, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 25, @@ -135,7 +152,9 @@ Object { 25, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot index 196727426a4..d30272154a9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot @@ -4,7 +4,9 @@ exports[`javascript classes class-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 9, @@ -39,7 +44,9 @@ Object { 9, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot index c1ee0b82f95..432b691a259 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-method-named-prototype.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -20,11 +24,13 @@ Object { }, }, "name": "prototype", + "optional": false, "range": Array [ 9, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 18, 22, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -135,7 +152,9 @@ Object { 23, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot index 9b70760930b..9eb3670aaa6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-method-named-static.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "static", + "optional": false, "range": Array [ 9, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 15, 19, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 21, @@ -135,7 +152,9 @@ Object { 21, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot index 9e9a41ba326..fa4567a5191 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-method-named-with-space.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -20,11 +24,13 @@ Object { }, }, "name": "withSpace", + "optional": false, "range": Array [ 9, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 19, 24, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 25, @@ -135,7 +152,9 @@ Object { 25, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot index 1f39c557998..434983b524c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-one-method-super.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,11 +51,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -84,6 +93,7 @@ Object { 34, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -118,6 +128,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -136,7 +147,9 @@ Object { 15, 41, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -156,7 +169,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -168,12 +184,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -189,7 +208,9 @@ Object { 43, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot index ed28bce4faa..bcaecd13509 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-one-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 15, 19, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -135,7 +152,9 @@ Object { 21, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot index 07249d71dc9..32d60d23aef 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript classes class-private-identifier-accessor.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -37,6 +40,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +48,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -101,6 +106,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -119,11 +125,15 @@ Object { 24, 39, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -153,6 +163,7 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 42, @@ -160,6 +171,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -180,6 +192,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -195,6 +208,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -206,23 +220,30 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 53, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 52, 63, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -234,11 +255,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 67, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -251,6 +274,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 67, @@ -258,11 +282,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -387,6 +413,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -405,7 +432,9 @@ Object { 78, 107, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -425,7 +454,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -437,12 +469,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -458,7 +493,9 @@ Object { 109, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot index 63586a9fa6d..9d71835526e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-private-identifier-field.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -37,19 +41,24 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 21, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -78,14 +87,16 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 24, 35, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -107,8 +118,11 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -120,11 +134,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 39, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -137,6 +153,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 39, @@ -144,11 +161,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -273,6 +292,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -291,7 +311,9 @@ Object { 50, 79, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -311,7 +333,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -323,12 +348,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -344,7 +372,9 @@ Object { 81, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot index 099a48f546c..3420e9af1dd 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript classes class-private-identifier-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -37,6 +40,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +48,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +69,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +88,17 @@ Object { 18, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -99,11 +110,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 27, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -116,6 +129,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 27, @@ -123,11 +137,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -200,6 +216,7 @@ Object { 58, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -234,6 +251,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -252,7 +270,9 @@ Object { 38, 63, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -272,7 +292,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -284,12 +307,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -305,7 +331,9 @@ Object { 65, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot index 4f725a4e536..ba4b263d757 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript classes class-static-method-named-prototype.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -38,6 +41,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -45,6 +49,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -65,6 +70,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -83,7 +89,9 @@ Object { 29, 33, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -103,7 +111,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -115,12 +126,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 34, @@ -136,7 +150,9 @@ Object { 34, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot index b1756b4818d..782fe911f00 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-static-method-named-static.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -20,11 +24,13 @@ Object { }, }, "name": "static", + "optional": false, "range": Array [ 16, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 22, 26, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 28, @@ -135,7 +152,9 @@ Object { 28, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot index 1cf9872e589..60f3ee16eaa 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-static-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 17, 21, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -135,7 +152,9 @@ Object { 23, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot index 0dda0b03089..fef551f8f4e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-static-methods-and-accessor-properties.src 1`] Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 17, 21, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -99,11 +113,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 33, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 22, @@ -123,6 +140,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,12 +180,17 @@ Object { 34, 38, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 51, @@ -178,11 +202,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 50, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -195,6 +221,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 39, @@ -202,6 +229,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -222,6 +250,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -237,6 +266,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 53, @@ -248,18 +278,22 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 52, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 51, 56, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -279,7 +313,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -291,12 +328,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 58, @@ -312,7 +352,9 @@ Object { 58, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot index f99bd40eb6c..83bc9569d22 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-computed-static-methods.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 18, 22, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -99,11 +113,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 24, @@ -123,6 +140,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,7 +180,9 @@ Object { 33, 37, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -181,7 +202,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -193,12 +217,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 38, @@ -214,7 +241,9 @@ Object { 38, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot index e104bce8c44..544d2ce7fdf 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-methods-computed-constructor.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 9, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,11 +91,15 @@ Object { 22, 26, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -117,6 +130,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 27, @@ -124,6 +138,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -144,6 +159,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -162,7 +178,9 @@ Object { 42, 46, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -182,7 +200,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -194,12 +215,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 47, @@ -215,7 +239,9 @@ Object { 47, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot index 6c78f574166..fbb874c69f1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-methods-semi.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 10, 14, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -99,11 +113,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 15, @@ -123,6 +140,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,7 +180,9 @@ Object { 16, 20, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -181,7 +202,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -193,12 +217,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 21, @@ -214,7 +241,9 @@ Object { 21, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot index 5060c0584f9..25e751448fa 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-methods-three-semi.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 10, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 11, 15, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -99,11 +113,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 16, @@ -123,6 +140,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,7 +180,9 @@ Object { 17, 21, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -181,7 +202,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -193,12 +217,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -214,7 +241,9 @@ Object { 23, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot index aeb53db1865..9aa250dce24 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-methods-two-semi.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 10, 14, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -99,11 +113,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 15, @@ -123,6 +140,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,7 +180,9 @@ Object { 16, 20, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -181,7 +202,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -193,12 +217,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 22, @@ -214,7 +241,9 @@ Object { 22, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot index b8be5d7f17c..0e7540aea81 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-methods.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 10, 14, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -99,11 +113,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -123,6 +140,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,7 +180,9 @@ Object { 15, 19, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -181,7 +202,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -193,12 +217,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 20, @@ -214,7 +241,9 @@ Object { 20, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot index 9b9e4330f1b..31d2a1296b6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-two-static-methods-named-constructor.src 1`] = Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 16, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,12 +91,17 @@ Object { 27, 31, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 50, @@ -99,11 +113,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 39, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -116,6 +132,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 32, @@ -123,6 +140,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -143,6 +161,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -161,7 +180,9 @@ Object { 50, 54, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -181,7 +202,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -193,12 +217,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 55, @@ -214,7 +241,9 @@ Object { 55, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot index e736c7d3cc9..81d79860a13 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-with-constructor-parameters.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 9, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,6 +88,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -90,13 +100,16 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -108,18 +121,22 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 20, 32, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -139,7 +156,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -151,12 +171,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 33, @@ -172,7 +195,9 @@ Object { 33, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot index 1356638c862..ae4dd655a61 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-with-constructor-with-space.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 9, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 21, 25, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 26, @@ -135,7 +152,9 @@ Object { 26, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot index 150efc9e0ac..1db42bd6d31 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes class-with-constructor.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 9, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 9, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 20, 24, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 25, @@ -135,7 +152,9 @@ Object { 25, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot deleted file mode 100644 index b92aba616eb..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-no-body.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript classes class-with-no-body.src 1`] = ` -TSError { - "column": 0, - "index": 10, - "lineNumber": 2, - "message": "'{' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot index 989ff0f33f2..3afca67d128 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,13 +20,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -43,7 +48,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -55,12 +63,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 27, @@ -94,7 +105,9 @@ Object { "type": "Literal", "value": 0, }, + "superTypeParameters": undefined, "type": "ClassExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -113,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot index 2b1313a267c..6e214373bd0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot @@ -4,7 +4,9 @@ exports[`javascript classes derived-class-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 18, @@ -57,7 +62,9 @@ Object { "type": "Literal", "value": 0, }, + "superTypeParameters": undefined, "type": "ClassExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot index 98ef359c106..bbe50c630e6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript classes empty-class-double-semi.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -34,12 +38,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -55,7 +62,9 @@ Object { 10, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot index ab1d37c0797..a91651fb18c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript classes empty-class-semi.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -34,12 +38,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 11, @@ -55,7 +62,9 @@ Object { 11, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot index 109ce40729e..07d6f1f4d68 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript classes empty-class.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -34,12 +38,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -55,7 +62,9 @@ Object { 10, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot index d9d3534a4e3..35302c18682 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript classes empty-literal-derived-class.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -34,12 +38,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 20, @@ -73,7 +80,9 @@ Object { "type": "Literal", "value": 0, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot index 36421b25e80..45ab2064e11 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript classes invalid-class-declaration.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 8, @@ -38,7 +42,9 @@ Object { 8, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot index 8b505ede615..d4f9e8a6db6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript classes invalid-class-setter-declaration.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "override": false, "range": Array [ 10, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 17, 22, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -114,12 +128,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -135,7 +152,9 @@ Object { 23, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot deleted file mode 100644 index 71e4b3acbbb..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-two-super-classes.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript classes invalid-class-two-super-classes.src 1`] = ` -TSError { - "column": 18, - "index": 18, - "lineNumber": 1, - "message": "Classes can only extend a single class.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot index 1d6158ac7f7..991a1291497 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot @@ -4,7 +4,9 @@ exports[`javascript classes named-class-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -35,12 +40,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 11, @@ -56,7 +64,9 @@ Object { 11, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot index 14b06887a7e..0f4a18c27e7 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot @@ -4,7 +4,9 @@ exports[`javascript classes named-derived-class-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -35,12 +40,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 20, @@ -74,7 +82,9 @@ Object { "type": "Literal", "value": 0, }, + "superTypeParameters": undefined, "type": "ClassExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot index 1dc6e744c8b..59249c85038 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -18,11 +20,13 @@ Object { }, }, "name": "xx", + "optional": false, "range": Array [ 4, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [ @@ -48,6 +52,7 @@ Object { }, "consequent": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -59,11 +64,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -98,6 +105,7 @@ Object { 22, ], "test": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -109,11 +117,13 @@ Object { }, }, "name": "xx", + "optional": false, "range": Array [ 10, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ConditionalExpression", }, @@ -170,6 +180,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot index c1b49d054d4..3e50b7b5813 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -18,11 +20,13 @@ Object { }, }, "name": "v1", + "optional": false, "range": Array [ 4, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [ @@ -193,6 +197,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot index a2e9bff57c7..8a71d3fafb8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -18,11 +20,13 @@ Object { }, }, "name": "v1", + "optional": false, "range": Array [ 4, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [ @@ -231,6 +235,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot index 93490af1237..6a4387cf635 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot @@ -10,7 +10,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -22,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -85,6 +90,7 @@ Object { "argument": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -96,13 +102,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -114,13 +123,16 @@ Object { }, }, "name": "v1", + "optional": false, "range": Array [ 41, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -132,11 +144,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 45, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -188,9 +202,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -202,11 +218,13 @@ Object { }, }, "name": "f1", + "optional": false, "range": Array [ 9, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -223,7 +241,9 @@ Object { 0, 49, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot index c98475bf6de..e1bfdf3c2d1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [ @@ -98,6 +102,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot index 0b631ee0433..d7f1c274092 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot index a0f0e8f243e..3569cb9eb84 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript defaultParams class-constructor.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,7 +88,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -91,11 +102,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -107,6 +120,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 26, 35, @@ -131,13 +145,16 @@ Object { "value": "bar", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 25, 44, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -157,7 +174,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -169,12 +189,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -190,7 +213,9 @@ Object { 46, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot index e826cfb92f9..57fcb198f6f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript defaultParams class-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,7 +88,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -91,11 +102,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 18, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -107,6 +120,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 18, 27, @@ -131,13 +145,16 @@ Object { "value": "baz", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 36, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -157,7 +174,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -169,12 +189,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -190,7 +213,9 @@ Object { 38, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot index d1c4c3c493e..8e72eeee0c5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,7 +59,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -67,11 +73,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -83,6 +91,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 16, @@ -107,13 +116,16 @@ Object { "value": 1, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 20, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot index 85368a32a1e..a36ce0253ea 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript defaultParams expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -73,7 +78,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -85,11 +92,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -101,6 +110,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 18, @@ -125,13 +135,16 @@ Object { "value": 1, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 4, 22, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot index da24615c5b0..ad60d4f5c4a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript defaultParams method.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -53,6 +57,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -64,11 +69,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +89,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 6, 25, @@ -108,6 +116,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -123,7 +132,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -135,11 +146,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -151,6 +164,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 18, 21, @@ -175,13 +189,16 @@ Object { "value": 1, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 9, 25, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot index 6a6b9ad1510..a8eac5b333d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -44,6 +48,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -59,6 +64,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -70,14 +76,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -89,11 +99,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -105,6 +117,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 22, 28, @@ -129,8 +142,10 @@ Object { "value": 42, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -142,18 +157,22 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 10, 35, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -172,6 +191,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot index 405c25df931..b5870a1cbee 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions arrow-param-array.src 1`] = Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,8 +43,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -52,11 +58,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -69,18 +77,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 4, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 10, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot index 84976000f5e..715917e932c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions arrow-param-nested-array.sr Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,8 +43,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -52,15 +58,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -72,11 +82,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -89,11 +101,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 8, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -106,18 +120,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 9, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 15, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot index 3516ca2e262..ad26763f052 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions arrow-param-nested-object-n Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -49,10 +54,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -64,11 +71,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 2, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +91,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 8, @@ -89,6 +99,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -100,16 +111,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -121,11 +135,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -139,6 +155,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 10, 20, @@ -146,6 +163,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -156,10 +174,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -171,11 +191,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -189,6 +211,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 19, @@ -196,6 +219,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -207,11 +231,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -220,6 +246,7 @@ Object { 20, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -228,13 +255,16 @@ Object { 21, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 27, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot index 1d6d3b3bd21..d34a19fcefd 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions arrow-param-nested-object.s Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -49,10 +54,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -64,11 +71,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +91,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 3, @@ -89,6 +99,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -100,16 +111,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -121,11 +135,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -139,6 +155,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 10, @@ -146,6 +163,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -156,10 +174,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -171,11 +191,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -189,6 +211,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 8, 9, @@ -196,6 +219,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -207,11 +231,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -220,6 +246,7 @@ Object { 10, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -228,13 +255,16 @@ Object { 11, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 17, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot index 4bf994371b6..e3302567feb 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions arrow-param-object.src 1`] Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -49,10 +54,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -64,11 +71,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +91,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 3, @@ -89,6 +99,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -100,11 +111,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -113,13 +126,16 @@ Object { 4, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 10, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot index 5bd16903c83..1aa480a1b1d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions param-defaults-array.src 1` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,9 +43,12 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -53,11 +60,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -69,6 +78,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 2, 8, @@ -93,6 +103,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -105,18 +116,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 9, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 15, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot index 1b911d613b4..1c000de2ad3 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript destructuring-and-arrowFunctions param-defaults-object-neste Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -20,13 +22,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -38,11 +43,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 33, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -76,6 +83,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -86,10 +94,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -101,11 +111,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -119,6 +131,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 8, @@ -126,7 +139,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -138,11 +153,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -154,6 +171,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 2, 8, @@ -178,11 +196,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -194,11 +214,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -212,6 +234,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 10, 23, @@ -219,6 +242,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -229,10 +253,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -244,11 +270,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -262,6 +290,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 15, 21, @@ -269,7 +298,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -281,11 +312,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -297,6 +330,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 21, @@ -321,6 +355,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -329,6 +364,7 @@ Object { 23, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -337,13 +373,16 @@ Object { 24, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 35, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot index 7cc4c1de4bf..f60c58a80fb 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript destructuring-and-arrowFunctions param-defaults-object.src 1 Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -39,6 +43,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -49,10 +54,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -64,11 +71,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +91,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 8, @@ -89,7 +99,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -101,11 +113,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -117,6 +131,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 2, 8, @@ -141,6 +156,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -149,13 +165,16 @@ Object { 9, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 15, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot index 452ffb3e780..15d77d2373a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -20,11 +23,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -37,11 +42,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 6, 9, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { "elements": Array [], @@ -78,6 +85,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot index d318cf63e3e..fb391ec1034 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,11 +23,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -37,11 +42,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 7, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { "elements": Array [], @@ -78,6 +85,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot index 14d94b2cc1b..3ae7f324881 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -32,11 +36,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 7, 10, @@ -57,6 +64,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -68,11 +76,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -81,6 +91,7 @@ Object { 11, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot index e5cd331f1d4..8a35c324221 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -32,11 +36,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 7, 8, @@ -57,6 +64,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -68,11 +76,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -81,6 +91,7 @@ Object { 9, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot index cc0dd13d2ea..7b1922e8ff4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 8, @@ -57,6 +64,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -68,11 +76,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -81,6 +91,7 @@ Object { 9, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot index 27ff03194b1..0be2c7d8a08 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 6, @@ -57,6 +64,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -68,11 +76,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -81,6 +91,7 @@ Object { 7, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot index b903de9883d..1c22d9dab39 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,9 +59,12 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -69,11 +76,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -86,11 +95,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 14, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -102,6 +113,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 20, @@ -145,13 +157,16 @@ Object { "type": "ArrayExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 24, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot index 87bf9790bb4..99d9795d417 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring-and-defaultParams param-object-short.src 1`] = Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -30,11 +32,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 2, 21, @@ -74,6 +79,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -89,7 +95,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -100,10 +108,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -115,11 +125,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -133,6 +145,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 6, @@ -140,6 +153,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -151,11 +165,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -164,6 +180,7 @@ Object { 7, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -175,6 +192,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 17, @@ -194,6 +212,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -205,11 +224,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -223,6 +244,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 11, 16, @@ -257,13 +279,16 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 3, 21, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot index e2839e63889..af7a2368808 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring-and-defaultParams param-object-wrapped.src 1`] Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -30,11 +32,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 31, @@ -74,6 +79,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -89,7 +95,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -100,10 +108,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -115,11 +125,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -133,6 +145,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 15, 16, @@ -140,6 +153,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -151,11 +165,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -164,6 +180,7 @@ Object { 17, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -175,6 +192,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 27, @@ -194,6 +212,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -205,11 +224,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -223,6 +244,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 21, 26, @@ -257,13 +279,16 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 5, 31, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot index 9662e108e5a..d3b0511fe86 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript destructuring-and-defaultParams param-object.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -73,7 +78,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -84,10 +91,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -99,11 +108,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -117,6 +128,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 15, @@ -124,6 +136,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -135,11 +148,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -148,6 +163,7 @@ Object { 16, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -159,6 +175,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 26, @@ -178,6 +195,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -189,11 +207,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -207,6 +227,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 20, 25, @@ -241,13 +262,16 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 4, 30, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot index e7d0d5be18a..9035479de39 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot @@ -23,8 +23,10 @@ Object { "type": "EmptyStatement", }, "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -36,11 +38,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -53,11 +57,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 8, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,6 +80,7 @@ Object { 17, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -85,11 +92,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot index 64cf4bdaad8..fe9333adb32 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript destructuring-and-spread complex-destructured.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,10 +21,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -33,11 +38,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -51,6 +58,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 4, @@ -58,6 +66,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -69,16 +78,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -90,11 +102,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -108,6 +122,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 6, 7, @@ -115,6 +130,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -126,11 +142,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -139,9 +157,11 @@ Object { 9, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -153,12 +173,15 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -169,11 +192,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 15, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -186,11 +212,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 16, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -208,6 +236,7 @@ Object { 20, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -219,11 +248,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot index e2fffc3b1c3..f87059bfb1a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript destructuring-and-spread destructured-array-literal.src 1`] Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -19,16 +22,20 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -40,13 +47,16 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -58,11 +68,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -75,12 +87,15 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 7, 13, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -91,11 +106,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 13, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -108,11 +126,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 14, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -130,6 +150,7 @@ Object { 18, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -141,11 +162,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot index 0d322901e40..e7c4c0e8a6c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,8 +59,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -68,13 +74,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -86,16 +95,20 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -107,11 +120,13 @@ Object { }, }, "name": "ok", + "optional": false, "range": Array [ 22, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -124,12 +139,15 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 21, 25, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -140,11 +158,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 18, 25, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -157,18 +178,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 26, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 30, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot index ab822275394..f5983c69db4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot @@ -4,11 +4,14 @@ exports[`javascript destructuring-and-spread error-complex-destructured-spread-f Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,12 +23,15 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -36,13 +42,17 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 5, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -53,10 +63,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -68,11 +80,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -86,6 +100,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 9, 10, @@ -93,6 +108,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -104,16 +120,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -125,11 +144,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -143,6 +164,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 13, @@ -150,6 +172,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +184,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -174,6 +199,7 @@ Object { 15, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -186,11 +212,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 16, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -208,6 +236,7 @@ Object { 20, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -219,11 +248,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot index 82b11730af3..ac972ba6538 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot @@ -4,11 +4,14 @@ exports[`javascript destructuring-and-spread invalid-not-final-array-empty.src 1 Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,12 +23,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -36,11 +42,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 5, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -53,11 +62,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 8, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +86,7 @@ Object { 12, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -86,11 +98,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot index 111fb7b6e87..099813077c4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript destructuring-and-spread multi-destructured.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -19,14 +22,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -38,12 +44,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -54,11 +63,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 8, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -71,11 +83,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 9, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -93,6 +107,7 @@ Object { 13, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -104,11 +119,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot index b3f465972b9..91a7755e6e9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot @@ -4,11 +4,14 @@ exports[`javascript destructuring-and-spread not-final-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,12 +23,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -36,13 +42,17 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 5, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -54,11 +64,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -71,11 +83,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 9, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -93,6 +107,7 @@ Object { 13, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -104,11 +119,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot index 4dba8ec3f65..c84486fea60 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot @@ -4,11 +4,14 @@ exports[`javascript destructuring-and-spread single-destructured.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,12 +23,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -36,11 +42,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 5, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -53,11 +62,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +86,7 @@ Object { 10, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -86,11 +98,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot index 8ab620c6f48..8fdea157a80 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -19,10 +22,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -34,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -52,6 +59,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 7, 8, @@ -59,6 +67,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -70,16 +79,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -91,11 +103,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -109,6 +123,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 10, 11, @@ -116,6 +131,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -127,11 +143,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -140,9 +158,11 @@ Object { 13, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -154,12 +174,15 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -170,11 +193,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 19, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -187,13 +213,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 20, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -205,11 +234,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -228,6 +259,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot index c3ea37a02c8..82a555745aa 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,16 +23,20 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -41,13 +48,16 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -59,11 +69,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -76,12 +88,15 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 17, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -92,11 +107,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 8, 17, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -109,13 +127,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 18, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -127,11 +148,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -150,6 +173,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot index 2ce8cb857f6..3784815c474 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,14 +23,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -39,12 +45,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -55,11 +64,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 8, 12, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -72,13 +84,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 13, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -90,11 +105,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,6 +130,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot index 014d983b100..cfe2fe744c8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot @@ -6,10 +6,13 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -21,12 +24,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -37,11 +43,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 9, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -54,13 +63,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 10, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -72,11 +84,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -95,6 +109,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot index 848973a3401..11880e217c0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript destructuring array-member.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { "computed": false, @@ -20,6 +22,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -31,14 +34,17 @@ Object { }, }, "name": "ok", + "optional": false, "range": Array [ 1, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -50,11 +56,13 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 1, @@ -73,11 +81,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot index 190b44a9f5d..2b27d36e315 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript destructuring array-to-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -19,13 +22,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -37,11 +43,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -54,11 +62,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -78,6 +88,7 @@ Object { "right": Object { "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -89,13 +100,16 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -107,11 +121,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot index 9109714b711..e00d1424175 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,11 +23,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -37,11 +42,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 7, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { "elements": Array [], @@ -78,6 +85,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot index c621e3871b7..e1b236b05d2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring call-expression-destruction-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -43,6 +44,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -54,11 +56,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -76,6 +80,7 @@ Object { 10, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot index 9329bf4be94..0ef44c61653 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring call-expression-destruction-object.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -43,6 +44,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -54,11 +56,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -76,6 +80,7 @@ Object { 10, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot index 1ce60cf6afe..3494762e712 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-constructor-params-array.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "consturctor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,8 +88,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -92,13 +103,16 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -110,11 +124,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -127,18 +143,22 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 26, 36, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 25, 45, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -158,7 +178,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -170,12 +193,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -191,7 +217,9 @@ Object { 47, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot index 31e9b9c678e..1e48387e524 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-constructor-params-defaults-array.src 1` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "consturctor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,9 +88,12 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -93,11 +105,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -109,6 +123,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 27, 32, @@ -133,9 +148,12 @@ Object { "value": 3, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -147,11 +165,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -163,6 +183,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 34, 39, @@ -187,6 +208,7 @@ Object { "value": 4, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -199,18 +221,22 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 26, 40, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 25, 49, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -230,7 +256,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -242,12 +271,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -263,7 +295,9 @@ Object { 51, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot index 2fac40a2301..89d7bec8ca1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-constructor-params-defaults-object.src 1 Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "consturctor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,6 +88,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -89,10 +99,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -104,11 +116,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -122,6 +136,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 27, 32, @@ -129,7 +144,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -141,11 +158,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -157,6 +176,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 27, 32, @@ -181,11 +201,13 @@ Object { "value": 3, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -197,11 +219,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -215,6 +239,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 34, 39, @@ -222,7 +247,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -234,11 +261,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -250,6 +279,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 34, 39, @@ -274,6 +304,7 @@ Object { "value": 4, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -282,13 +313,16 @@ Object { 40, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 25, 49, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -308,7 +342,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -320,12 +357,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -341,7 +381,9 @@ Object { 51, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot index 2ce4b20aef5..99ce9fb349b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-constructor-params-object.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "consturctor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,6 +88,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -89,10 +99,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -104,11 +116,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -122,6 +136,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 27, 30, @@ -129,6 +144,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -140,16 +156,19 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -161,11 +180,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -179,6 +200,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 32, 35, @@ -186,6 +208,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -197,11 +220,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -210,13 +235,16 @@ Object { 36, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 25, 45, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -236,7 +264,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -248,12 +279,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -269,7 +303,9 @@ Object { 47, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot index 0788bd3e590..a5727b567b5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-method-params-array.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,8 +88,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -92,13 +103,16 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -110,11 +124,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -127,18 +143,22 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 18, 28, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 37, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -158,7 +178,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -170,12 +193,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -191,7 +217,9 @@ Object { 39, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot index 09a9336e202..d0bed90500b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-method-params-defaults-array.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,9 +88,12 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -93,11 +105,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -109,6 +123,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 24, @@ -133,9 +148,12 @@ Object { "value": 3, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -147,11 +165,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -163,6 +183,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 26, 31, @@ -187,6 +208,7 @@ Object { "value": 4, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -199,18 +221,22 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 18, 32, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 41, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -230,7 +256,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -242,12 +271,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -263,7 +295,9 @@ Object { 43, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot index bc5f1596e9b..381638adf40 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-method-params-defaults-object.src 1`] = Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,6 +88,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -89,10 +99,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -104,11 +116,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -122,6 +136,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 19, 24, @@ -129,7 +144,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -141,11 +158,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -157,6 +176,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 19, 24, @@ -181,11 +201,13 @@ Object { "value": 3, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -197,11 +219,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -215,6 +239,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 26, 31, @@ -222,7 +247,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -234,11 +261,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -250,6 +279,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 26, 31, @@ -274,6 +304,7 @@ Object { "value": 3, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -282,13 +313,16 @@ Object { 32, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 41, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -308,7 +342,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -320,12 +357,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -341,7 +381,9 @@ Object { 43, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot index 3916e252351..f48e895e4c4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring class-method-params-object.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -79,6 +88,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -89,10 +99,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -104,11 +116,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -122,6 +136,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 19, 22, @@ -129,6 +144,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -140,16 +156,19 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -161,11 +180,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -179,6 +200,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 24, 27, @@ -186,6 +208,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -197,11 +220,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -210,13 +235,16 @@ Object { 28, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 37, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -236,7 +264,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -248,12 +279,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -269,7 +303,9 @@ Object { 39, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot index aac83a96955..2f0a156c13e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot @@ -6,10 +6,14 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -21,11 +25,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -61,9 +68,12 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -75,11 +85,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -91,6 +103,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 18, @@ -115,9 +128,12 @@ Object { "value": 5, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -129,11 +145,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -145,6 +163,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 20, 25, @@ -169,6 +188,7 @@ Object { "value": 1, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -181,13 +201,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 26, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -199,11 +222,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -222,6 +247,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot index 0353642185a..a07485a07c6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 9, @@ -57,6 +64,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -68,16 +76,19 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -89,11 +100,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -107,6 +120,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 11, 15, @@ -114,6 +128,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -125,16 +140,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -146,11 +164,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -164,6 +184,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 17, 32, @@ -171,6 +192,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -181,10 +203,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -196,11 +220,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -214,6 +240,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 22, 31, @@ -221,7 +248,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -233,11 +262,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -249,6 +280,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 25, 31, @@ -273,6 +305,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -281,6 +314,7 @@ Object { 32, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -289,8 +323,10 @@ Object { 34, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -302,11 +338,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 37, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -325,6 +363,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot index f72b227a692..324a1a13603 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot @@ -6,10 +6,14 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -21,11 +25,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -61,8 +68,10 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -74,13 +83,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -92,11 +104,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -109,13 +123,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 18, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -127,11 +144,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -150,6 +169,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot index 22ae1d09861..755ecabd3e8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot @@ -6,10 +6,14 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -21,11 +25,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -61,11 +68,15 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -77,11 +88,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -93,6 +106,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 21, @@ -117,6 +131,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -129,11 +144,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 22, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -146,13 +163,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 23, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -164,11 +184,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -187,6 +209,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot index 1685236290e..0959f81fd93 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot @@ -6,10 +6,14 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -21,11 +25,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,6 +43,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -61,10 +68,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -76,11 +86,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -93,11 +105,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 18, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -110,13 +124,16 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 19, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -128,11 +145,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -151,6 +170,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot index 1e2f06544aa..eefedac7104 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript destructuring defaults-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -20,11 +24,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -36,6 +42,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 1, 5, @@ -60,6 +67,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -72,11 +80,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -94,6 +104,7 @@ Object { 10, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -105,11 +116,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot index 6cfa4a4b352..d645ed370b2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 11, @@ -57,7 +64,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -109,11 +121,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -125,11 +139,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -143,6 +159,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 18, @@ -150,7 +167,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -162,11 +181,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -178,6 +199,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 18, @@ -202,11 +224,13 @@ Object { "value": 5, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -218,11 +242,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -236,6 +262,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 20, 25, @@ -243,7 +270,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -255,11 +284,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -271,6 +302,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 20, 25, @@ -295,6 +327,7 @@ Object { "value": 1, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -303,8 +336,10 @@ Object { 26, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -316,11 +351,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -339,6 +376,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot index 362957bb745..ea08a63ea0b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript destructuring defaults-object-assign.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -31,11 +35,13 @@ Object { }, }, "name": "Object", + "optional": false, "range": Array [ 3, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 11, @@ -56,7 +63,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -68,11 +77,13 @@ Object { }, }, "name": "Object", + "optional": false, "range": Array [ 3, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -84,6 +95,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 3, 11, @@ -108,11 +120,13 @@ Object { "value": 0, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -124,11 +138,13 @@ Object { }, }, "name": "String", + "optional": false, "range": Array [ 13, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -142,6 +158,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 21, @@ -149,7 +166,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -161,11 +180,13 @@ Object { }, }, "name": "String", + "optional": false, "range": Array [ 13, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -177,6 +198,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 21, @@ -201,6 +223,7 @@ Object { "value": 0, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -209,6 +232,7 @@ Object { 23, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot index 68f717f659b..62fddc0d7d9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 14, @@ -57,7 +64,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 8, 14, @@ -109,11 +121,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -125,11 +139,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -143,6 +159,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 25, @@ -150,7 +167,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -162,11 +181,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -178,6 +199,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 19, 25, @@ -202,11 +224,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -218,11 +242,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -236,6 +262,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 27, 36, @@ -243,7 +270,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -255,11 +284,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -271,6 +302,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 30, 36, @@ -295,6 +327,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -303,8 +336,10 @@ Object { 37, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -316,11 +351,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 40, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -339,6 +376,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot index f6a2d40937f..ff2664d772a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 9, @@ -57,6 +64,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -68,16 +76,19 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -89,11 +100,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -107,6 +120,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 11, 20, @@ -114,7 +128,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -126,11 +142,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -142,6 +160,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 20, @@ -166,11 +185,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -182,11 +203,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -200,6 +223,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 22, 26, @@ -207,6 +231,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -218,11 +243,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -231,8 +258,10 @@ Object { 27, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -244,11 +273,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -267,6 +298,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot index 1f002a3fe71..09bad9cf65d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 6, 15, @@ -57,7 +64,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 9, 15, @@ -109,6 +121,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -117,8 +130,10 @@ Object { 17, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -130,11 +145,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -153,6 +170,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot index b91fd36716a..29554cdc9cc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 6, @@ -57,6 +64,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -68,16 +76,19 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -89,11 +100,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -107,6 +120,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 8, 17, @@ -114,7 +128,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -126,11 +142,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -142,6 +160,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 17, @@ -166,11 +185,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -182,11 +203,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -200,6 +223,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 19, 20, @@ -207,6 +231,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -218,11 +243,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -231,8 +258,10 @@ Object { 21, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -244,11 +273,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -267,6 +298,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot index a7731280ca4..d943686cc18 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 11, @@ -57,7 +64,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -109,11 +121,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -125,11 +139,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -143,6 +159,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 14, @@ -150,6 +167,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -161,16 +179,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -182,11 +203,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -200,6 +223,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 17, @@ -207,6 +231,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -218,11 +243,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -231,8 +258,10 @@ Object { 18, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -244,11 +273,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -267,6 +298,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot index 5fb2a374edb..9792670e0ad 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 11, @@ -57,7 +64,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -109,11 +121,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -125,11 +139,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -143,6 +159,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 25, @@ -150,6 +167,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -160,10 +178,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -175,11 +195,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -193,6 +215,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 18, 24, @@ -200,7 +223,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -212,11 +237,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -228,6 +255,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 18, 24, @@ -252,6 +280,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -260,6 +289,7 @@ Object { 25, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -268,8 +298,10 @@ Object { 26, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -281,11 +313,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -304,6 +338,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot index ba0e9ac1cb8..b6257ee5a44 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 11, @@ -57,7 +64,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -109,11 +121,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -125,11 +139,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -143,6 +159,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 21, @@ -150,6 +167,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -160,10 +178,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -175,11 +195,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -193,6 +215,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 18, 19, @@ -200,6 +223,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -211,11 +235,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -224,6 +250,7 @@ Object { 21, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -232,8 +259,10 @@ Object { 22, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -245,11 +274,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -268,6 +299,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot index c6ae07ae051..5d59d252a3a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 11, @@ -57,7 +64,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -69,11 +78,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +96,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 11, @@ -109,6 +121,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -117,8 +130,10 @@ Object { 12, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -130,11 +145,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -153,6 +170,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot index aa37a16a8ad..f0d9beb6ffa 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot @@ -13,7 +13,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -24,10 +26,12 @@ Object { "line": 3, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -39,11 +43,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -57,6 +63,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 35, 36, @@ -64,6 +71,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -75,11 +83,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -88,8 +98,10 @@ Object { 37, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -101,11 +113,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 40, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -124,6 +138,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -189,8 +204,10 @@ Object { }, }, "param": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -202,11 +219,13 @@ Object { }, }, "name": "stack", + "optional": false, "range": Array [ 56, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -219,11 +238,13 @@ Object { "line": 5, }, }, + "optional": false, "range": Array [ 55, 62, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "range": Array [ 49, @@ -264,9 +285,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -278,11 +301,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -296,6 +321,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -306,10 +332,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -321,11 +349,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -339,6 +369,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 13, @@ -346,6 +377,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -357,11 +389,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -370,13 +404,16 @@ Object { 14, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 71, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot index e06b085bd83..99f124469b6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot @@ -13,7 +13,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -24,10 +26,12 @@ Object { "line": 3, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -39,11 +43,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -57,6 +63,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 35, 36, @@ -64,6 +71,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -75,11 +83,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -88,8 +98,10 @@ Object { 37, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -101,11 +113,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 40, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -124,6 +138,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -189,6 +204,7 @@ Object { }, }, "param": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -199,10 +215,12 @@ Object { "line": 5, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -214,11 +232,13 @@ Object { }, }, "name": "stack", + "optional": false, "range": Array [ 56, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -232,6 +252,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 56, 61, @@ -239,6 +260,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -250,11 +272,13 @@ Object { }, }, "name": "stack", + "optional": false, "range": Array [ 56, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -263,6 +287,7 @@ Object { 62, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "range": Array [ 49, @@ -303,9 +328,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -317,11 +344,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -335,6 +364,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -345,10 +375,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -360,11 +392,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -378,6 +412,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 13, @@ -385,6 +420,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -396,11 +432,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -409,13 +447,16 @@ Object { 14, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 71, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot index bf9fe990f40..f23ecdeefb5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring invalid-defaults-object-assign.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "loc": Object { @@ -20,6 +21,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -31,11 +33,13 @@ Object { }, }, "name": "Object", + "optional": false, "range": Array [ 3, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +53,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 11, @@ -56,7 +61,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -68,11 +75,13 @@ Object { }, }, "name": "Object", + "optional": false, "range": Array [ 3, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -84,6 +93,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 3, 11, @@ -108,11 +118,13 @@ Object { "value": 0, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -124,11 +136,13 @@ Object { }, }, "name": "String", + "optional": false, "range": Array [ 13, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -142,6 +156,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 21, @@ -149,7 +164,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -161,11 +178,13 @@ Object { }, }, "name": "String", + "optional": false, "range": Array [ 13, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -177,6 +196,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 21, @@ -201,6 +221,7 @@ Object { "value": 0, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot index 6e8599440da..873f710042d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript destructuring named-param.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -31,11 +35,13 @@ Object { }, }, "name": "responseText", + "optional": false, "range": Array [ 3, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 21, @@ -56,6 +63,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -67,11 +75,13 @@ Object { }, }, "name": "text", + "optional": false, "range": Array [ 17, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -80,6 +90,7 @@ Object { 23, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -97,6 +108,7 @@ Object { 29, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -108,11 +120,13 @@ Object { }, }, "name": "res", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot index e00a6beaf35..c970f3dbf8d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot @@ -6,9 +6,12 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,17 +23,21 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, null, Object { + "decorators": Array [], "elements": Array [ null, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -42,11 +49,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -59,11 +68,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 10, 15, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -76,11 +87,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 4, 16, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": Object { "elements": Array [ @@ -213,6 +226,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot index 1c1951aa9d3..2b2864dce2e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 9, @@ -57,6 +64,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -68,16 +76,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -89,11 +100,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -107,6 +120,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 11, 22, @@ -114,6 +128,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -124,10 +139,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -139,11 +156,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -157,6 +176,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 20, @@ -164,6 +184,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -175,11 +196,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -188,6 +211,7 @@ Object { 22, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -196,6 +220,7 @@ Object { 24, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -212,6 +237,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -223,11 +249,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -241,6 +269,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 29, 35, @@ -270,6 +299,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -281,11 +311,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 37, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -299,6 +331,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 37, 50, @@ -320,6 +353,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -331,11 +365,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 42, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -349,6 +385,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 42, 48, @@ -407,6 +444,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot index 316f7ab4beb..1570468dbf0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 8, @@ -57,6 +64,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -68,11 +76,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -81,6 +91,7 @@ Object { 9, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot index a5efaea684b..4ca1b8678f1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -32,11 +36,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 5, 6, @@ -57,6 +64,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -68,11 +76,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -81,6 +91,7 @@ Object { 7, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot index 58fc94bcbf0..79f9a2d3f75 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,9 +59,12 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -69,11 +76,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,6 +94,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 18, @@ -109,6 +119,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -121,18 +132,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 19, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 23, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot index 59556c231d5..b624bab2286 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -80,11 +87,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 18, @@ -105,7 +115,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -117,11 +129,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -133,6 +147,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 18, @@ -157,11 +172,13 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -173,11 +190,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -191,6 +210,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 20, 33, @@ -198,6 +218,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -208,10 +229,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -223,11 +246,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -241,6 +266,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 25, 31, @@ -248,7 +274,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -260,11 +288,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -276,6 +306,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 25, 31, @@ -300,6 +331,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -308,6 +340,7 @@ Object { 33, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -316,13 +349,16 @@ Object { 34, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 38, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot index 09960faeb99..27805974e8f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -80,11 +87,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 18, @@ -105,7 +115,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -117,11 +129,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -133,6 +147,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 18, @@ -157,6 +172,7 @@ Object { "value": 10, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -165,13 +181,16 @@ Object { 19, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 23, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot index 77100966b2f..95477c0b142 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring params-array-wrapped.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -24,9 +25,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -38,11 +41,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,8 +61,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -69,13 +76,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -87,11 +97,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -104,18 +116,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 20, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 1, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot index d4c75e01a5d..b1464adf09d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,8 +59,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -68,13 +74,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -86,11 +95,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -103,18 +114,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 19, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 22, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot index d331c2deea8..e99c0eacc7b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -66,13 +71,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -83,10 +91,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -98,11 +108,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -116,6 +128,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 17, @@ -123,6 +136,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -134,11 +148,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -147,13 +163,16 @@ Object { 19, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 22, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot index ae76ac0fc77..497ac3b53f4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,8 +59,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -68,17 +74,21 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, null, Object { + "decorators": Array [], "elements": Array [ null, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -90,11 +100,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -107,11 +119,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 17, 22, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -124,18 +138,22 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 23, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 27, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot index 171f65e0783..d2f8056302b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -80,11 +87,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 16, @@ -105,6 +115,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -116,16 +127,19 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -137,11 +151,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -155,6 +171,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 18, 29, @@ -162,6 +179,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -172,10 +190,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -187,11 +207,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -205,6 +227,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 23, 27, @@ -212,6 +235,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -223,11 +247,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -236,6 +262,7 @@ Object { 29, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, ], @@ -244,13 +271,16 @@ Object { 31, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 35, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot index ff10cae4202..18a48d95ed3 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript destructuring params-object-wrapped.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { @@ -24,9 +25,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -38,11 +41,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,6 +61,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -66,10 +72,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -81,11 +89,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -99,6 +109,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 15, @@ -106,6 +117,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -117,16 +129,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -138,11 +153,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -156,6 +173,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 17, 18, @@ -163,6 +181,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -174,11 +193,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -187,13 +208,16 @@ Object { 20, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 1, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot index 46718c85841..5095e7ab7af 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -80,11 +87,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 14, @@ -105,6 +115,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -116,16 +127,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -137,11 +151,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -155,6 +171,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 17, @@ -162,6 +179,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -173,11 +191,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -186,13 +206,16 @@ Object { 19, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 22, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot index ef1b769effd..105e58db45b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot @@ -4,10 +4,13 @@ exports[`javascript destructuring sparse-array.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -19,14 +22,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, null, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -38,11 +44,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -55,11 +63,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 0, 6, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -77,6 +87,7 @@ Object { 14, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -88,11 +99,13 @@ Object { }, }, "name": "array", + "optional": false, "range": Array [ 9, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot index 51827cec393..845f8bffb2a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot @@ -47,7 +47,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -59,11 +61,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 39, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -101,6 +105,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -119,6 +124,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -171,9 +177,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -185,11 +193,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -206,7 +216,9 @@ Object { 0, 63, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot index 65f9143603d..bf1268df26e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot @@ -41,11 +41,15 @@ Object { "type": "ExpressionStatement", }, Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -57,11 +61,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 31, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -74,6 +80,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 31, @@ -81,6 +88,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -139,6 +147,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -157,12 +166,17 @@ Object { 43, 75, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -174,11 +188,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 85, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -191,6 +207,7 @@ Object { "line": 8, }, }, + "optional": false, "override": false, "range": Array [ 81, @@ -198,6 +215,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -256,6 +274,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -274,12 +293,17 @@ Object { 89, 121, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -291,11 +315,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 131, 134, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -308,6 +334,7 @@ Object { "line": 12, }, }, + "optional": false, "override": false, "range": Array [ 127, @@ -315,6 +342,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -373,6 +401,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -388,6 +417,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -399,23 +429,30 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 136, 141, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 135, 172, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -427,11 +464,13 @@ Object { }, }, "name": "method", + "optional": false, "range": Array [ 178, 184, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -444,6 +483,7 @@ Object { "line": 16, }, }, + "optional": false, "override": false, "range": Array [ 178, @@ -451,6 +491,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -509,6 +550,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -527,7 +569,9 @@ Object { 185, 217, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -547,7 +591,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -559,12 +606,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -580,7 +630,9 @@ Object { 219, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot index af1be7214fc..578bf631b6b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript directives first-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -40,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot index 6412b4454ea..f4f477bd5e5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot @@ -45,6 +45,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "left": Object { "loc": Object { @@ -134,9 +135,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -148,11 +151,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -169,7 +174,9 @@ Object { 0, 39, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot index bc7cfcd4a95..7d58ddf9398 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot @@ -8,6 +8,7 @@ Object { "consequent": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -102,6 +103,7 @@ Object { Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -195,6 +197,7 @@ Object { Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -305,6 +308,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/non-unique-directive.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/non-unique-directive.src.js.shot deleted file mode 100644 index edd8c30339e..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/non-unique-directive.src.js.shot +++ /dev/null @@ -1,246 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript directives non-unique-directive.src 1`] = ` -Object { - "body": Array [ - Object { - "directive": "use strict", - "expression": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "type": "ExpressionStatement", - }, - Object { - "directive": "use strict", - "expression": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 14, - 26, - ], - "raw": "\\"use strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 14, - 27, - ], - "type": "ExpressionStatement", - }, - Object { - "directive": "test", - "expression": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 28, - 34, - ], - "raw": "\\"test\\"", - "type": "Literal", - "value": "test", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 28, - 35, - ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 4, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 36, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "type": "String", - "value": "\\"use strict\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 2, - }, - }, - "range": Array [ - 14, - 26, - ], - "type": "String", - "value": "\\"use strict\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 2, - }, - "start": Object { - "column": 12, - "line": 2, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 3, - }, - "start": Object { - "column": 0, - "line": 3, - }, - }, - "range": Array [ - 28, - 34, - ], - "type": "String", - "value": "\\"test\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 3, - }, - "start": Object { - "column": 6, - "line": 3, - }, - }, - "range": Array [ - 34, - 35, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot index 5b499799395..f4f8b529b14 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot @@ -80,7 +80,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -92,11 +94,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -116,6 +120,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot index dc0839bc47c..24d4eb22e3c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot @@ -43,7 +43,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -55,11 +57,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -97,6 +101,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -115,6 +120,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/raw.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/raw.src.js.shot deleted file mode 100644 index ba66aba3452..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/directives/raw.src.js.shot +++ /dev/null @@ -1,100 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript directives raw.src 1`] = ` -Object { - "body": Array [ - Object { - "directive": "use\\\\x20strict", - "expression": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 15, - ], - "raw": "\\"use\\\\x20strict\\"", - "type": "Literal", - "value": "use strict", - }, - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 16, - ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 17, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 15, - ], - "type": "String", - "value": "\\"use\\\\x20strict\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot index cefbdc750e6..6b1ac11e719 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,7 +62,9 @@ Object { 0, 26, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot index e66f0e0c022..6d84f246347 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot @@ -30,7 +30,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -42,11 +44,13 @@ Object { }, }, "name": "item", + "optional": false, "range": Array [ 44, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -66,6 +70,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -98,6 +103,7 @@ Object { 67, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -109,11 +115,13 @@ Object { }, }, "name": "items", + "optional": false, "range": Array [ 52, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, @@ -134,9 +142,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -148,11 +158,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -169,7 +181,9 @@ Object { 0, 69, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot index 14fa1e6f786..d1f1d8e7012 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript experimentalDynamicImport dynamic-import.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -18,11 +20,13 @@ Object { }, }, "name": "main", + "optional": false, "range": Array [ 19, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { @@ -76,6 +80,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -87,11 +92,13 @@ Object { }, }, "name": "then", + "optional": false, "range": Array [ 14, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, @@ -115,6 +122,7 @@ Object { 24, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot deleted file mode 100644 index ac792b26e67..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/error-dynamic-import-params.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript experimentalDynamicImport error-dynamic-import-params.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Dynamic import requires exactly one or two arguments.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot index 1cc404faaa5..819144e9ae4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -80,11 +87,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 12, 13, @@ -105,6 +115,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -116,15 +127,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -136,12 +150,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -152,11 +169,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 19, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -164,13 +184,16 @@ Object { 20, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 24, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot index a659770cfb6..760d46c20a0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript experimentalObjectRestSpread destructuring-assign-mirror.src Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -31,11 +35,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 3, @@ -56,6 +63,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -67,15 +75,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -87,12 +98,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -103,11 +117,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 9, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -115,6 +132,7 @@ Object { 10, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -146,6 +164,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -157,11 +176,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -175,6 +196,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 15, @@ -182,6 +204,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -193,15 +216,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -213,11 +239,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot index d187a99bb5a..88f212e3820 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -65,9 +70,11 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -79,12 +86,15 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -95,11 +105,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 20, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -107,13 +120,16 @@ Object { 21, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 26, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot index 1d53fc3080d..8c9bdda99a5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 6, 7, @@ -57,6 +64,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -68,16 +76,19 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -89,11 +100,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -107,6 +120,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 9, 10, @@ -114,6 +128,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -125,15 +140,18 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -145,12 +163,15 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -161,11 +182,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 16, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -173,8 +197,10 @@ Object { 19, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -186,11 +212,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -209,6 +237,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot deleted file mode 100644 index 79ebf6dc533..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript experimentalObjectRestSpread invalid-rest.src 1`] = ` -TSError { - "column": 18, - "index": 18, - "lineNumber": 1, - "message": "',' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot index e8a006bc876..415f333aa84 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -17,10 +19,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -32,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -50,6 +56,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 6, 7, @@ -57,6 +64,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -68,16 +76,19 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -89,11 +100,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -107,6 +120,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 9, 10, @@ -114,6 +128,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -125,15 +140,18 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -145,12 +163,15 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -161,11 +182,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 16, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -173,6 +197,7 @@ Object { 18, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -189,6 +214,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -200,11 +226,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -218,6 +246,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 23, 27, @@ -247,6 +276,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -258,11 +288,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -276,6 +308,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 29, 33, @@ -305,6 +338,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -316,11 +350,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -334,6 +370,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 35, 39, @@ -363,6 +400,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -374,11 +412,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 41, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -392,6 +432,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 41, 45, @@ -442,6 +483,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot index d415e4b0664..776903479cd 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -42,7 +46,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -54,11 +60,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -78,7 +86,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -90,11 +100,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -114,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,7 +147,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -146,11 +161,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -167,6 +184,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -178,11 +196,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -196,6 +216,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 42, 50, @@ -203,6 +224,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -214,16 +236,19 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -235,11 +260,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 56, 59, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -253,6 +280,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 56, 64, @@ -260,6 +288,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -271,11 +300,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 61, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { @@ -292,6 +323,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -303,14 +335,17 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 73, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -322,11 +357,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 77, 80, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 73, @@ -374,6 +411,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot index c815fa11f2b..ca5b4583ef5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript experimentalObjectRestSpread shorthand-method-args.src 1`] = Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -30,11 +32,13 @@ Object { }, }, "name": "initialize", + "optional": false, "range": Array [ 7, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 7, 104, @@ -74,6 +79,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -89,6 +95,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -99,10 +106,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -114,11 +123,13 @@ Object { }, }, "name": "someVar", + "optional": false, "range": Array [ 19, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -132,6 +143,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 19, 26, @@ -139,6 +151,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -150,16 +163,19 @@ Object { }, }, "name": "someVar", + "optional": false, "range": Array [ 19, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -171,11 +187,13 @@ Object { }, }, "name": "otherVar", + "optional": false, "range": Array [ 28, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -189,6 +207,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 28, 36, @@ -196,6 +215,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -207,15 +227,18 @@ Object { }, }, "name": "otherVar", + "optional": false, "range": Array [ 28, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -227,12 +250,15 @@ Object { }, }, "name": "options", + "optional": false, "range": Array [ 41, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -243,11 +269,14 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 38, 48, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -255,13 +284,16 @@ Object { 49, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 17, 104, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot index 9acdf82f334..13fa0d20e05 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -39,6 +43,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -50,11 +55,13 @@ Object { }, }, "name": "initialize", + "optional": false, "range": Array [ 14, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -68,6 +75,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 14, 111, @@ -94,6 +102,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -109,6 +118,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -119,10 +129,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -134,11 +146,13 @@ Object { }, }, "name": "someVar", + "optional": false, "range": Array [ 26, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -152,6 +166,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 26, 33, @@ -159,6 +174,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -170,16 +186,19 @@ Object { }, }, "name": "someVar", + "optional": false, "range": Array [ 26, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -191,11 +210,13 @@ Object { }, }, "name": "otherVar", + "optional": false, "range": Array [ 35, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -209,6 +230,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 35, 43, @@ -216,6 +238,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -227,15 +250,18 @@ Object { }, }, "name": "otherVar", + "optional": false, "range": Array [ 35, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -247,12 +273,15 @@ Object { }, }, "name": "options", + "optional": false, "range": Array [ 48, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -263,11 +292,14 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 45, 55, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -275,13 +307,16 @@ Object { 56, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 24, 111, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -308,6 +343,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot index 91228d7682c..750f593f3f5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -42,7 +46,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -54,11 +60,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -78,7 +86,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -90,11 +100,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -114,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,7 +147,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -146,11 +161,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -167,6 +184,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -178,11 +196,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -196,6 +216,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 42, 45, @@ -203,6 +224,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -214,16 +236,19 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -235,11 +260,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 51, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -253,6 +280,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 51, 54, @@ -260,6 +288,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -271,15 +300,18 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 51, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -291,11 +323,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 63, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -337,6 +371,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot index 5cfc79c2735..8d485633566 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -42,7 +46,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -54,11 +60,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -78,7 +86,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -90,11 +100,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -114,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,7 +147,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -146,11 +161,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -167,6 +184,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -178,11 +196,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -196,6 +216,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 42, 50, @@ -203,6 +224,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -214,16 +236,19 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -235,11 +260,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 56, 59, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -253,6 +280,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 56, 64, @@ -260,6 +288,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -271,15 +300,18 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 61, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -291,11 +323,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 73, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -337,6 +371,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot index bebb447a087..1db33326199 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript experimentalObjectRestSpread spread-trailing-comma.src 1`] = Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -30,11 +32,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 4, @@ -55,6 +60,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -66,16 +72,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -87,11 +96,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -105,6 +116,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 6, 7, @@ -112,6 +124,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -123,15 +136,18 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -143,11 +159,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot index e6bb9702157..e5a7e057f22 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -42,7 +46,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -54,11 +60,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -78,7 +86,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -90,11 +100,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -114,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,7 +147,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -146,11 +161,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -167,6 +184,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -178,11 +196,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -196,6 +216,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 42, 50, @@ -203,6 +224,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -214,15 +236,18 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -234,11 +259,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 59, 62, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -258,6 +285,7 @@ Object { }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -269,11 +297,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 71, 74, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -315,6 +345,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js.shot deleted file mode 100644 index d1c392fae50..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalOptionalCatchBinding/optional-catch-binding-finally.src.js.shot +++ /dev/null @@ -1,278 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript experimentalOptionalCatchBinding optional-catch-binding-finally.src 1`] = ` -Object { - "body": Array [ - Object { - "block": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 6, - ], - "type": "BlockStatement", - }, - "finalizer": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 26, - ], - "type": "BlockStatement", - }, - "handler": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 15, - ], - "type": "BlockStatement", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "param": null, - "range": Array [ - 7, - 15, - ], - "type": "CatchClause", - }, - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "type": "TryStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 3, - ], - "type": "Keyword", - "value": "try", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 6, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 12, - ], - "type": "Keyword", - "value": "catch", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 23, - ], - "type": "Keyword", - "value": "finally", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 25, - "line": 1, - }, - }, - "range": Array [ - 25, - 26, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js.shot deleted file mode 100644 index 0ea57cb3010..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/experimentalOptionalCatchBinding/optional-catch-binding.src.js.shot +++ /dev/null @@ -1,207 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript experimentalOptionalCatchBinding optional-catch-binding.src 1`] = ` -Object { - "body": Array [ - Object { - "block": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 6, - ], - "type": "BlockStatement", - }, - "finalizer": null, - "handler": Object { - "body": Object { - "body": Array [], - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 15, - ], - "type": "BlockStatement", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "param": null, - "range": Array [ - 7, - 15, - ], - "type": "CatchClause", - }, - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 15, - ], - "type": "TryStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 16, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 3, - ], - "type": "Keyword", - "value": "try", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 6, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 12, - ], - "type": "Keyword", - "value": "catch", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "range": Array [ - 13, - 14, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 15, - ], - "type": "Punctuator", - "value": "}", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot index 8c0309ebbe5..96a8280ac8c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { @@ -97,6 +101,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -115,8 +120,10 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -128,11 +135,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-empty.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-empty.src.js.shot deleted file mode 100644 index 308066fa3aa..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/for/for-empty.src.js.shot +++ /dev/null @@ -1,172 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript for for-empty.src 1`] = ` -Object { - "body": Array [ - Object { - "body": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "EmptyStatement", - }, - "init": null, - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 9, - ], - "test": null, - "type": "ForStatement", - "update": null, - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 10, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 3, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 3, - ], - "type": "Keyword", - "value": "for", - }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 1, - }, - "start": Object { - "column": 4, - "line": 1, - }, - }, - "range": Array [ - 4, - 5, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "range": Array [ - 5, - 6, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Punctuator", - "value": ";", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot index b5220544789..6176a65ea4a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot @@ -25,7 +25,9 @@ Object { "init": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -37,11 +39,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -79,6 +83,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -112,6 +117,7 @@ Object { ], "test": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -123,11 +129,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -168,6 +176,7 @@ Object { "type": "ForStatement", "update": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -179,11 +188,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot index 59d47b3c3a7..5e628265a04 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot @@ -25,7 +25,9 @@ Object { "init": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -79,7 +83,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -91,11 +97,13 @@ Object { }, }, "name": "j", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -133,6 +141,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -166,6 +175,7 @@ Object { ], "test": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -177,11 +187,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -199,6 +211,7 @@ Object { 29, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -210,11 +223,13 @@ Object { }, }, "name": "j", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, @@ -223,6 +238,7 @@ Object { "expressions": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -234,11 +250,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -260,6 +278,7 @@ Object { }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -271,11 +290,13 @@ Object { }, }, "name": "j", + "optional": false, "range": Array [ 36, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot index d6604a94d08..a401f8c5240 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot @@ -25,7 +25,9 @@ Object { "init": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -37,11 +39,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -79,6 +83,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -112,6 +117,7 @@ Object { ], "test": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -123,11 +129,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -145,6 +153,7 @@ Object { 23, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -156,11 +165,13 @@ Object { }, }, "name": "j", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot index 02314403052..8048d407b66 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot @@ -23,6 +23,7 @@ Object { }, "init": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -34,11 +35,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -92,6 +95,7 @@ Object { ], "test": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -103,11 +107,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -139,6 +145,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -150,14 +157,17 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -169,11 +179,13 @@ Object { }, }, "name": "toExponential", + "optional": false, "range": Array [ 18, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 16, @@ -197,12 +209,14 @@ Object { 33, ], "type": "CallExpression", + "typeParameters": undefined, }, "type": "AssignmentExpression", }, "type": "ForStatement", "update": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -214,11 +228,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot index 9f69b0334f7..ab5c97cf978 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot @@ -25,7 +25,9 @@ Object { "init": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -37,11 +39,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -79,6 +83,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -112,6 +117,7 @@ Object { ], "test": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -123,11 +129,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -145,6 +153,7 @@ Object { 23, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -156,11 +165,13 @@ Object { }, }, "name": "j", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot index b05dc1c559f..3a127f9866d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot @@ -23,6 +23,7 @@ Object { "type": "BlockStatement", }, "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -34,11 +35,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot index e94137b6a6f..10b3380c144 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -18,11 +20,13 @@ Object { }, }, "name": "effects", + "optional": false, "range": Array [ 4, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -80,7 +85,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -92,11 +99,13 @@ Object { }, }, "name": "iterations", + "optional": false, "range": Array [ 21, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -134,6 +143,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -154,7 +164,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -166,11 +178,13 @@ Object { }, }, "name": "stored", + "optional": false, "range": Array [ 41, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -190,6 +204,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -211,8 +226,10 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -224,11 +241,13 @@ Object { }, }, "name": "iterations", + "optional": false, "range": Array [ 119, 129, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -284,7 +303,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -296,16 +317,19 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 58, 59, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -317,11 +341,13 @@ Object { }, }, "name": "effects", + "optional": false, "range": Array [ 65, 72, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -413,6 +439,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -448,6 +475,7 @@ Object { "expressions": Array [ Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -459,11 +487,13 @@ Object { }, }, "name": "stored", + "optional": false, "range": Array [ 81, 87, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -481,6 +511,7 @@ Object { 91, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -492,11 +523,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 90, 91, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, @@ -515,6 +548,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -526,11 +560,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 94, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -544,6 +580,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 94, 98, @@ -573,6 +610,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 52, @@ -584,11 +622,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 100, 101, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -602,6 +642,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 100, 104, @@ -631,6 +672,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 58, @@ -642,11 +684,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 106, 107, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -660,6 +704,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 106, 110, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot index c70af2c332d..ec228929e7f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot @@ -25,7 +25,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -36,10 +38,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -51,11 +55,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -69,6 +75,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 10, 14, @@ -76,6 +83,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -87,16 +95,19 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -108,11 +119,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 16, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -126,6 +139,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 21, @@ -133,6 +147,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -144,11 +159,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 16, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -157,6 +174,7 @@ Object { 22, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -176,6 +194,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -208,6 +227,7 @@ Object { 33, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -219,11 +239,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot index 59b179fd789..5ca5941cc03 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot @@ -25,9 +25,12 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -39,13 +42,16 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -57,11 +63,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 16, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -74,11 +82,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 9, 22, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -98,6 +108,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -130,6 +141,7 @@ Object { 33, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -141,11 +153,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot index f61e4c6756a..e274135285c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot @@ -23,6 +23,7 @@ Object { "type": "BlockStatement", }, "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -34,11 +35,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot deleted file mode 100644 index f1d2b3dbc4a..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript forIn for-in-object.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot index 82912047821..2c96724ca6f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot @@ -5,9 +5,11 @@ Object { "body": Array [ Object { "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -19,14 +21,17 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 33, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -38,11 +43,13 @@ Object { }, }, "name": "process", + "optional": false, "range": Array [ 25, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -60,6 +67,7 @@ Object { 35, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -80,7 +88,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -92,11 +102,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -134,6 +146,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -166,6 +179,7 @@ Object { 36, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -177,11 +191,13 @@ Object { }, }, "name": "list", + "optional": false, "range": Array [ 19, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot index eb4a5c2c77f..58e34531661 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot @@ -22,7 +22,9 @@ Object { "type": "EmptyStatement", }, "left": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -34,11 +36,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 5, 10, @@ -74,6 +79,7 @@ Object { "value": 0, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -90,6 +96,7 @@ Object { 19, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -101,11 +108,13 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot index 63881798e46..9ee132c790e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot @@ -5,9 +5,11 @@ Object { "body": Array [ Object { "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -19,14 +21,17 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -38,11 +43,13 @@ Object { }, }, "name": "process", + "optional": false, "range": Array [ 22, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -60,6 +67,7 @@ Object { 32, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -80,7 +88,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -92,11 +102,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -116,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -148,6 +161,7 @@ Object { 33, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -159,11 +173,13 @@ Object { }, }, "name": "list", + "optional": false, "range": Array [ 16, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot index ddb8aa41b06..d9f49369727 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot @@ -24,7 +24,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -36,14 +38,17 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -55,11 +60,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -77,6 +84,7 @@ Object { 18, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -88,11 +96,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, @@ -113,6 +123,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -145,6 +156,7 @@ Object { 25, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -156,11 +168,13 @@ Object { }, }, "name": "q", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot index e93b5d22cd4..19bad50a51c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot @@ -23,6 +23,7 @@ Object { "type": "BlockStatement", }, "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -33,10 +34,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -48,11 +51,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -66,6 +71,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 7, 12, @@ -73,6 +79,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -84,15 +91,18 @@ Object { }, }, "name": "xx", + "optional": false, "range": Array [ 10, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -104,12 +114,15 @@ Object { }, }, "name": "rrestOff", + "optional": false, "range": Array [ 17, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -120,11 +133,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 25, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -132,6 +148,7 @@ Object { 27, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -148,6 +165,7 @@ Object { 41, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -159,11 +177,13 @@ Object { }, }, "name": "array", + "optional": false, "range": Array [ 31, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot index 9a9af4bd30c..cd027ffe1b5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot @@ -5,9 +5,11 @@ Object { "body": Array [ Object { "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -19,14 +21,17 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -38,11 +43,13 @@ Object { }, }, "name": "process", + "optional": false, "range": Array [ 20, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -60,6 +67,7 @@ Object { 30, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -80,7 +88,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -92,11 +102,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -116,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -148,6 +161,7 @@ Object { 31, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -159,11 +173,13 @@ Object { }, }, "name": "list", + "optional": false, "range": Array [ 14, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForInStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot index 078868fc47f..74c75ca0a0d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "await": false, "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +22,13 @@ Object { }, }, "name": "doSomething", + "optional": false, "range": Array [ 22, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { 35, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -62,7 +67,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -74,11 +81,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -98,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot index 8a93c095a94..99ac29fb8ad 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot @@ -26,7 +26,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -37,10 +39,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -52,11 +56,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -70,6 +76,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 10, 14, @@ -77,6 +84,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -88,16 +96,19 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -109,11 +120,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 16, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -127,6 +140,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 21, @@ -134,6 +148,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -145,11 +160,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 16, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -158,6 +175,7 @@ Object { 22, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -177,6 +195,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -209,6 +228,7 @@ Object { 33, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -220,11 +240,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot index 1999a0f984d..2b4a1754bd5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot @@ -26,9 +26,12 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -40,13 +43,16 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -58,11 +64,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 16, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -75,11 +83,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 9, 22, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -99,6 +109,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -131,6 +142,7 @@ Object { 33, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -142,11 +154,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot index 41ee9ffb250..a5f1c5aeb05 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "await": false, "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +22,13 @@ Object { }, }, "name": "doSomething", + "optional": false, "range": Array [ 22, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { 35, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -62,7 +67,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -74,11 +81,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -98,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot index d509e43fcef..cbaf9bb3a10 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "await": false, "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 62, @@ -20,14 +22,17 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 61, 62, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 60, @@ -39,11 +44,13 @@ Object { }, }, "name": "process", + "optional": false, "range": Array [ 53, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -61,6 +68,7 @@ Object { 63, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -81,7 +89,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -93,11 +103,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -192,6 +204,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -210,7 +223,9 @@ Object { 13, 43, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -229,6 +244,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -261,6 +277,7 @@ Object { 64, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 51, @@ -272,11 +289,13 @@ Object { }, }, "name": "list", + "optional": false, "range": Array [ 47, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot index 36515bf7fe9..519f3a57053 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot @@ -24,6 +24,7 @@ Object { "type": "BlockStatement", }, "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -34,10 +35,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -49,11 +52,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -67,6 +72,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 7, 12, @@ -74,6 +80,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -85,15 +92,18 @@ Object { }, }, "name": "xx", + "optional": false, "range": Array [ 10, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -105,12 +115,15 @@ Object { }, }, "name": "rrestOff", + "optional": false, "range": Array [ 17, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -121,11 +134,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 25, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -133,6 +149,7 @@ Object { 27, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -149,6 +166,7 @@ Object { 41, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -160,11 +178,13 @@ Object { }, }, "name": "array", + "optional": false, "range": Array [ 31, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot index f9f2c6f861f..07b52f769da 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot @@ -8,9 +8,11 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -22,11 +24,13 @@ Object { }, }, "name": "doSomething", + "optional": false, "range": Array [ 25, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -44,6 +48,7 @@ Object { 38, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -81,7 +86,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -93,11 +100,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -117,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -149,6 +159,7 @@ Object { 41, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -160,11 +171,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot index ec0a900057d..6f07f5aae40 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "await": false, "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +22,13 @@ Object { }, }, "name": "doSomething", + "optional": false, "range": Array [ 23, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { 36, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -62,7 +67,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -74,11 +81,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -98,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -130,6 +140,7 @@ Object { 37, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -141,11 +152,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot index 20eb4330221..a7da09419e4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "await": false, "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +22,13 @@ Object { }, }, "name": "doSomething", + "optional": false, "range": Array [ 25, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { 38, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -62,7 +67,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -74,11 +81,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -98,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -130,6 +140,7 @@ Object { 39, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -141,11 +152,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot index 214a32f34c8..82a3ee19470 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "await": false, "body": Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +22,13 @@ Object { }, }, "name": "doSomething", + "optional": false, "range": Array [ 23, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { 36, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -62,7 +67,9 @@ Object { "left": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -74,11 +81,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -98,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -130,6 +140,7 @@ Object { 37, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -141,11 +152,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ForOfStatement", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot index 753ee38c8d7..b4d0437e1ec 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot @@ -11,6 +11,7 @@ Object { "argument": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -22,13 +23,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 40, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -40,13 +44,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 47, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -58,11 +65,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 54, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -114,9 +123,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -128,11 +139,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -146,6 +159,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -157,13 +171,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -175,13 +192,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -193,18 +213,22 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 62, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot index b88c784a3fe..c21961a3880 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot @@ -11,6 +11,7 @@ Object { "argument": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -22,13 +23,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -40,13 +44,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -58,11 +65,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 41, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -114,9 +123,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -128,11 +139,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -146,6 +159,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -157,13 +171,16 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -175,13 +192,16 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -193,18 +213,22 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 46, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot index 203e0d50458..d4e84ee7c6e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot @@ -4,13 +4,16 @@ exports[`javascript generators anonymous-generator.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -22,11 +25,13 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "delegate": false, "loc": Object { @@ -78,6 +83,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -96,7 +102,9 @@ Object { 1, 25, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot index 46555ad899d..b6be040201e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,7 +62,9 @@ Object { 1, 27, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot index 9789490921d..3ed979807f5 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript generators async-generator-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": true, "body": Object { @@ -51,7 +59,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -63,16 +73,19 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 42, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "argument": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -84,11 +97,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 53, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -106,6 +121,7 @@ Object { 56, ], "type": "CallExpression", + "typeParameters": undefined, }, "delegate": true, "loc": Object { @@ -141,6 +157,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -175,6 +192,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -193,7 +211,9 @@ Object { 23, 63, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -213,7 +233,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -225,12 +248,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -246,7 +272,9 @@ Object { 65, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot index 14477902865..70f7e605cf6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript generators double-yield.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { "argument": Object { @@ -97,6 +99,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -115,7 +118,9 @@ Object { 1, 32, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot index 5b3b9bfeb8f..17e49d51c0a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +39,13 @@ Object { }, }, "name": "t", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,7 +62,9 @@ Object { 0, 16, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot index c9047554e77..736526fa8d4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot @@ -8,8 +8,10 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -21,11 +23,13 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "delegate": true, "loc": Object { @@ -77,9 +81,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -91,11 +97,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -112,7 +120,9 @@ Object { 0, 30, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot index a6e5140b5a9..158c5c87e33 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot @@ -4,13 +4,16 @@ exports[`javascript generators yield-delegation.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -22,11 +25,13 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "delegate": true, "loc": Object { @@ -78,6 +83,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -96,7 +102,9 @@ Object { 1, 26, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot index 0ed21b5aba8..c0675208885 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript generators yield-without-value-in-call.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -32,6 +34,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -43,11 +46,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 16, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -65,6 +70,7 @@ Object { 25, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -99,6 +105,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -117,7 +124,9 @@ Object { 1, 28, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot index 912093d1f07..ee157115e5c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript generators yield-without-value-no-semi.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": null, "delegate": false, @@ -61,6 +63,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -79,7 +82,9 @@ Object { 1, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot index c3bd2e2edbb..4e7e917ea77 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot @@ -4,11 +4,13 @@ exports[`javascript generators yield-without-value.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": null, "delegate": false, @@ -61,6 +63,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -79,7 +82,9 @@ Object { 1, 24, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot index 0c753ec5412..9fd7c11f50b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -16,11 +17,13 @@ Object { }, }, "name": "fooz", + "optional": false, "range": Array [ 7, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-no-arg.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-no-arg.src.js.shot deleted file mode 100644 index 885aa5921a2..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-no-arg.src.js.shot +++ /dev/null @@ -1,81 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript globalReturn return-no-arg.src 1`] = ` -Object { - "body": Array [ - Object { - "argument": null, - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 7, - ], - "type": "ReturnStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 8, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 7, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-true.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-true.src.js.shot deleted file mode 100644 index 1590c741004..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-true.src.js.shot +++ /dev/null @@ -1,117 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript globalReturn return-true.src 1`] = ` -Object { - "body": Array [ - Object { - "argument": Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "raw": "true", - "type": "Literal", - "value": true, - }, - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 12, - ], - "type": "ReturnStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "return", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "type": "Boolean", - "value": "true", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 12, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot deleted file mode 100644 index 1095e6d6c8e..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/invalid.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript hexLiterals invalid.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot index 864fbdc1c6c..e91d302d0bc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript hexLiterals lowercase.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot index 4db16dc8984..360ccd1bfb4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript hexLiterals uppercase.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot index 4da100af091..528b9d9652c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript importMeta simple-import-meta.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -28,6 +29,7 @@ Object { }, }, "meta": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -39,13 +41,16 @@ Object { }, }, "name": "import", + "optional": false, "range": Array [ 0, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -57,11 +62,13 @@ Object { }, }, "name": "meta", + "optional": false, "range": Array [ 7, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, @@ -71,6 +78,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -82,11 +90,13 @@ Object { }, }, "name": "url", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, diff --git a/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot index 4cb277d09c0..e341b8a49f3 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +21,13 @@ Object { }, }, "name": "loop1", + "optional": false, "range": Array [ 33, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,6 +116,7 @@ Object { "type": "WhileStatement", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -124,11 +128,13 @@ Object { }, }, "name": "loop1", + "optional": false, "range": Array [ 0, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot index f945612a698..94452ddccd2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -20,11 +21,13 @@ Object { }, }, "name": "loop1", + "optional": false, "range": Array [ 36, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,6 +116,7 @@ Object { "type": "WhileStatement", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -124,11 +128,13 @@ Object { }, }, "name": "loop1", + "optional": false, "range": Array [ 0, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot index e687911b8d2..05f6591d9f2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -63,11 +64,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, @@ -79,8 +82,10 @@ Object { "type": "ImportDeclaration", }, Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -92,11 +97,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot index 7741900e0d2..b679d5c3db1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "declaration": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -20,11 +21,13 @@ Object { }, }, "name": "friends", + "optional": false, "range": Array [ 31, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "exportKind": "value", "loc": Object { @@ -60,9 +63,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -74,11 +79,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -95,7 +102,9 @@ Object { 0, 41, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot index 8f7cd2fee8a..7d16a340d5a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -63,11 +64,13 @@ Object { }, }, "name": "house", + "optional": false, "range": Array [ 7, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, @@ -82,9 +85,11 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -96,11 +101,13 @@ Object { }, }, "name": "roof", + "optional": false, "range": Array [ 56, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { @@ -116,6 +123,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -127,14 +135,17 @@ Object { }, }, "name": "console", + "optional": false, "range": Array [ 44, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -146,11 +157,13 @@ Object { }, }, "name": "log", + "optional": false, "range": Array [ 52, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 44, @@ -174,6 +187,7 @@ Object { 61, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -219,6 +233,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -230,11 +245,13 @@ Object { }, }, "name": "house", + "optional": false, "range": Array [ 34, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 28, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot index 8f0fc7a1773..a8e1ef5fe2f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot @@ -25,9 +25,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -39,11 +41,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -60,7 +64,9 @@ Object { 7, 30, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot index 6ff96e199e5..0a95bfa68eb 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot @@ -8,7 +8,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -20,11 +22,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -62,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-array.src.js.shot deleted file mode 100644 index ace2ffd4de8..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-array.src.js.shot +++ /dev/null @@ -1,153 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules export-default-array.src 1`] = ` -Object { - "body": Array [ - Object { - "declaration": Object { - "elements": Array [], - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 17, - ], - "type": "ArrayExpression", - }, - "exportKind": "value", - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "type": "ExportDefaultDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 14, - ], - "type": "Keyword", - "value": "default", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": "[", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Punctuator", - "value": "]", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot index 50621456a07..db890c144b8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot @@ -24,9 +24,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -38,11 +40,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 30, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,7 +63,9 @@ Object { 15, 38, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot index 562d3e967bc..b5981d8975f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +24,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -39,7 +43,9 @@ Object { 25, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-expression.src.js.shot deleted file mode 100644 index 51355c2061e..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-expression.src.js.shot +++ /dev/null @@ -1,245 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules export-default-expression.src 1`] = ` -Object { - "body": Array [ - Object { - "declaration": Object { - "left": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "raw": "1", - "type": "Literal", - "value": 1, - }, - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "operator": "+", - "range": Array [ - 16, - 21, - ], - "right": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "raw": "2", - "type": "Literal", - "value": 2, - }, - "type": "BinaryExpression", - }, - "exportKind": "value", - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 23, - ], - "type": "ExportDefaultDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 24, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 14, - ], - "type": "Keyword", - "value": "default", - }, - Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 16, - ], - "type": "Punctuator", - "value": "(", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "Numeric", - "value": "1", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": "+", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Numeric", - "value": "2", - }, - Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 22, - ], - "type": "Punctuator", - "value": ")", - }, - Object { - "loc": Object { - "end": Object { - "column": 23, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 23, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot index 426100f69bf..45714a2fc63 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot @@ -24,6 +24,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -42,7 +43,9 @@ Object { 15, 29, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot index d04d401153a..023f6a95744 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +24,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -35,12 +39,15 @@ Object { }, }, "name": "Test", + "optional": false, "range": Array [ 21, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -56,7 +63,9 @@ Object { 30, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot index 3c216b759a3..2c546347ec2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot @@ -24,9 +24,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -38,11 +40,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,7 +63,9 @@ Object { 15, 32, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-number.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-number.src.js.shot deleted file mode 100644 index 7926a382883..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-number.src.js.shot +++ /dev/null @@ -1,136 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules export-default-number.src 1`] = ` -Object { - "body": Array [ - Object { - "declaration": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 17, - ], - "raw": "42", - "type": "Literal", - "value": 42, - }, - "exportKind": "value", - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "type": "ExportDefaultDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 14, - ], - "type": "Keyword", - "value": "default", - }, - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 17, - ], - "type": "Numeric", - "value": "42", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "range": Array [ - 17, - 18, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot index b05558097ba..096ea12c532 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot @@ -19,6 +19,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -30,11 +31,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +51,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 17, 23, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot index be67c110592..b740c7a1e51 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -16,11 +17,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-batch.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-batch.src.js.shot deleted file mode 100644 index e18c65b71f9..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-batch.src.js.shot +++ /dev/null @@ -1,156 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules export-from-batch.src 1`] = ` -Object { - "body": Array [ - Object { - "assertions": Array [], - "exportKind": "value", - "exported": null, - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 20, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 19, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "type": "ExportAllDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 21, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 13, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 19, - ], - "type": "String", - "value": "\\"foo\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 20, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot index 186421f2add..50e668ba1b9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -55,11 +56,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 8, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -83,11 +87,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 8, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot index c030e763d83..cb86e42ad9e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -55,11 +56,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 15, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -83,11 +87,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot index bd5f17a08b3..b6ea0ea5fd1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -55,11 +56,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -83,11 +87,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot index 208b5ca9729..000d3159b7c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -55,11 +56,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 15, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -83,11 +87,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -98,6 +104,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -109,11 +116,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -126,6 +135,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -137,11 +147,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 24, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot index f379dc950aa..916b81714ee 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -55,11 +56,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -83,11 +87,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot index 0da197f4efd..3bf874bb4b0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -55,11 +56,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -83,11 +87,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -98,6 +104,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -109,11 +116,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -126,6 +135,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -137,11 +147,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 13, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot index e42c3ad9fc8..1dc5377d498 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot @@ -25,9 +25,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -39,11 +41,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -60,7 +64,9 @@ Object { 7, 25, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot index 91e7001d203..a4710809ff3 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot @@ -8,7 +8,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +22,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -62,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot index 931546cf321..475f0cc95b7 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -37,11 +38,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 15, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot index 86812726b72..0c1dc2f7845 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -37,11 +38,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot index 8493747edd2..0eafa54619c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -37,11 +38,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 15, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -80,6 +86,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -91,11 +98,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -108,6 +117,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -119,11 +129,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 24, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot index a791c892e87..ac9079f7fb6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot @@ -6,6 +6,7 @@ Object { Object { "assertions": Array [], "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -24,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -36,12 +40,15 @@ Object { }, }, "name": "Test", + "optional": false, "range": Array [ 13, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -57,7 +64,9 @@ Object { 22, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-empty.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-empty.src.js.shot deleted file mode 100644 index 19f6e016af3..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-empty.src.js.shot +++ /dev/null @@ -1,121 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules export-named-empty.src 1`] = ` -Object { - "body": Array [ - Object { - "assertions": Array [], - "declaration": null, - "exportKind": "value", - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 10, - ], - "source": null, - "specifiers": Array [], - "type": "ExportNamedDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 11, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "range": Array [ - 9, - 10, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot index bfc996c3993..c8e5a2f8046 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +38,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot index 3485ec9b694..eaef4de89e8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +38,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -80,6 +86,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -91,11 +98,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -108,6 +117,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -119,11 +129,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 13, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot index 066e7d2ce09..d46f4a043c9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +38,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -80,6 +86,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -91,11 +98,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -108,6 +117,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -119,11 +129,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 13, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot index fdd2c4ee13d..5567c75a632 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot @@ -8,7 +8,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +22,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -46,6 +50,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -64,7 +69,9 @@ Object { 17, 31, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -83,6 +90,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot index 82fd63084fd..d9df301c497 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot @@ -8,7 +8,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +22,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -62,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot index 2ff0cbfb063..aea42111a45 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot @@ -8,7 +8,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +22,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -44,6 +48,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot index 21914b01b27..6cb4421767f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, @@ -78,6 +81,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -89,11 +93,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -106,6 +112,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -117,11 +124,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 13, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot index fe0e67372ba..0772f12cae1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, @@ -87,6 +90,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -98,11 +102,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 12, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot index 5f099a83058..9ddd682c0ef 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -54,11 +55,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 8, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -82,11 +86,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot index 71aef0d5432..730de4c6433 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot index 01a85b43bbd..108e2b959ce 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -63,11 +64,13 @@ Object { }, }, "name": "$", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-module.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-module.src.js.shot deleted file mode 100644 index 06702d2a693..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-module.src.js.shot +++ /dev/null @@ -1,120 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules import-module.src 1`] = ` -Object { - "body": Array [ - Object { - "assertions": Array [], - "importKind": "value", - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 13, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 12, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [], - "type": "ImportDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 14, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "import", - }, - Object { - "loc": Object { - "end": Object { - "column": 12, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 12, - ], - "type": "String", - "value": "\\"foo\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot index e73f0ab64de..8ddcdd19ccc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -54,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -82,11 +86,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot index 751ffab1a34..ce8ce411d48 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -54,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -82,11 +86,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -97,6 +103,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -108,11 +115,13 @@ Object { }, }, "name": "xyz", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -125,6 +134,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -136,11 +146,13 @@ Object { }, }, "name": "xyz", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 20, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-empty.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-empty.src.js.shot deleted file mode 100644 index 7b16fa59231..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-empty.src.js.shot +++ /dev/null @@ -1,174 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules import-named-empty.src 1`] = ` -Object { - "body": Array [ - Object { - "assertions": Array [], - "importKind": "value", - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 21, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 20, - ], - "raw": "\\"foo\\"", - "type": "Literal", - "value": "foo", - }, - "specifiers": Array [], - "type": "ImportDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 22, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "import", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 8, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 1, - }, - "start": Object { - "column": 8, - "line": 1, - }, - }, - "range": Array [ - 8, - 9, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 10, - "line": 1, - }, - }, - "range": Array [ - 10, - 14, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 20, - ], - "type": "String", - "value": "\\"foo\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 20, - "line": 1, - }, - }, - "range": Array [ - 20, - 21, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot index 4b8922b9fec..a0964248ed9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -54,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -82,11 +86,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot index aa6633bf9d3..9d3eea95559 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -54,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -82,11 +86,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -97,6 +103,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -108,11 +115,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -125,6 +134,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -136,11 +146,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 13, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot index 532f37b1218..a9fc1aaa2ac 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -54,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -82,11 +86,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -97,6 +103,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -108,11 +115,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -125,6 +134,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -136,11 +146,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 13, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot index 4939af93a05..3885bff0653 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot index 1148db2db0b..6b390b59d10 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -54,11 +55,13 @@ Object { }, }, "name": "null", + "optional": false, "range": Array [ 9, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -82,11 +86,13 @@ Object { }, }, "name": "nil", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 9, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot index 900e9de8014..96d37663dc8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot @@ -8,7 +8,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -20,11 +22,13 @@ Object { }, }, "name": "await", + "optional": false, "range": Array [ 11, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -44,6 +48,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot index ebb4c9daf5f..2f7c0444039 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +24,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -39,7 +43,9 @@ Object { 23, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot deleted file mode 100644 index ae346cd3c57..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-missing-from-clause.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-batch-missing-from-clause.src 1`] = ` -TSError { - "column": 0, - "index": 9, - "lineNumber": 2, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot deleted file mode 100644 index 5a05ea68acb..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-batch-token.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-batch-token.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot deleted file mode 100644 index ee8455cff2e..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-equal.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-default-equal.src 1`] = ` -TSError { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot deleted file mode 100644 index 68613dac12a..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default-token.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-default-token.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot deleted file mode 100644 index aa02d1b56fc..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-default.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-default.src 1`] = ` -TSError { - "column": 20, - "index": 20, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-module-specifier.src.js.shot deleted file mode 100644 index 5467f678c18..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-module-specifier.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-module-specifier.src 1`] = ` -TSError { - "column": 19, - "index": 19, - "lineNumber": 1, - "message": "Module specifier must be a string literal.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot index ed00ad396dd..973ec845d90 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -37,11 +38,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 8, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -65,11 +69,13 @@ Object { }, }, "name": "default", + "optional": false, "range": Array [ 8, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot deleted file mode 100644 index 143a7bd5494..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-extra-comma.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-named-extra-comma.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot deleted file mode 100644 index b4f8f3d9872..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-middle-comma.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-export-named-middle-comma.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot deleted file mode 100644 index fdb5bd5d6bd..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named-after-default.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-default-after-named-after-default.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot deleted file mode 100644 index 756a15c8851..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-after-named.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-default-after-named.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot deleted file mode 100644 index 95e60f66c12..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-missing-module-specifier.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-default-missing-module-specifier.src 1`] = ` -TSError { - "column": 0, - "index": 11, - "lineNumber": 2, - "message": "'=' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-module-specifier.src.js.shot deleted file mode 100644 index 0754b716ae5..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default-module-specifier.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-default-module-specifier.src 1`] = ` -TSError { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "Module specifier must be a string literal.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot deleted file mode 100644 index a15834eebdc..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-default.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-default.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot deleted file mode 100644 index adeb29427a9..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-missing-module-specifier.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-missing-module-specifier.src 1`] = ` -TSError { - "column": 0, - "index": 20, - "lineNumber": 2, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-module-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-module-specifier.src.js.shot deleted file mode 100644 index d456d2e4679..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-module-specifier.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-module-specifier.src 1`] = ` -TSError { - "column": 17, - "index": 17, - "lineNumber": 1, - "message": "Module specifier must be a string literal.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot deleted file mode 100644 index 2205d06adcb..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-named.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-named-after-named.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot deleted file mode 100644 index a6adaddba9e..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-after-namespace.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-named-after-namespace.src 1`] = ` -TSError { - "column": 15, - "index": 15, - "lineNumber": 1, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot deleted file mode 100644 index e49ff4b519d..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-as-missing-from.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-named-as-missing-from.src 1`] = ` -TSError { - "column": 0, - "index": 24, - "lineNumber": 2, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot deleted file mode 100644 index 602373b73e6..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-extra-comma.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-named-extra-comma.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot deleted file mode 100644 index cac59c05280..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-named-middle-comma.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-named-middle-comma.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot deleted file mode 100644 index b5b5e09f82b..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-after-named.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-namespace-after-named.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "'from' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot deleted file mode 100644 index ccd1659afe4..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-import-namespace-missing-as.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript modules invalid-import-namespace-missing-as.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'as' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot index e9170a853ad..4967cdc601c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -36,6 +40,7 @@ Object { }, }, "meta": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -47,13 +52,16 @@ Object { }, }, "name": "new", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -65,11 +73,13 @@ Object { }, }, "name": "target", + "optional": false, "range": Array [ 12, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 8, @@ -94,6 +104,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot index 3141472974b..ebe6c8183ee 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,17 +20,20 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -41,6 +46,7 @@ Object { }, }, "meta": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -52,13 +58,16 @@ Object { }, }, "name": "new", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -70,11 +79,13 @@ Object { }, }, "name": "unknown_property", + "optional": false, "range": Array [ 25, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 21, @@ -115,6 +126,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -133,7 +145,9 @@ Object { 8, 44, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -152,6 +166,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot index 1b0c2865fa4..fa677626c02 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot @@ -10,7 +10,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -22,11 +24,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -40,6 +44,7 @@ Object { }, }, "meta": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -51,13 +56,16 @@ Object { }, }, "name": "new", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -69,11 +77,13 @@ Object { }, }, "name": "target", + "optional": false, "range": Array [ 31, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 27, @@ -98,6 +108,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -132,9 +143,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -146,11 +159,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -167,7 +182,9 @@ Object { 0, 40, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot index 43f6b12136e..61801e02fb7 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript objectLiteral object-literal-in-lhs.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -39,6 +40,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -50,11 +52,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 0, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,9 +76,11 @@ Object { 6, ], "type": "CallExpression", + "typeParameters": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -86,11 +92,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, @@ -114,6 +122,7 @@ Object { 14, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -125,11 +134,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot index 0aa89f00f69..c47f0ad24b4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -106,6 +110,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 26, @@ -113,6 +118,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -124,11 +130,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 23, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -155,6 +163,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot index 3bd317475f7..54c3293f26f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript objectLiteralComputedProperties computed-and-identifier.src Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -30,11 +32,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 9, @@ -77,6 +82,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -88,11 +94,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -106,6 +114,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 11, 16, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot index fb4501fd426..0d6c9eeb70c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript objectLiteralComputedProperties computed-getter-and-setter.s Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -30,11 +32,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 14, @@ -74,6 +79,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -92,12 +98,15 @@ Object { 9, 14, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "computed": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -109,11 +118,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -127,6 +138,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 29, @@ -153,6 +165,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -168,6 +181,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -179,18 +193,22 @@ Object { }, }, "name": "v", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 23, 29, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot index c4bdd3765a1..9a5d4eb3996 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -69,6 +73,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 26, @@ -76,6 +81,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -87,11 +93,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 23, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -118,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot index 693734693d8..7c627afaf31 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -39,6 +43,7 @@ Object { Object { "computed": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -50,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -68,6 +75,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 24, @@ -75,6 +83,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -86,11 +95,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -117,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot deleted file mode 100644 index b70c46baf0a..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-computed-variable-property.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript objectLiteralComputedProperties invalid-computed-variable-property.src 1`] = ` -TSError { - "column": 0, - "index": 20, - "lineNumber": 3, - "message": "':' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot deleted file mode 100644 index 3431838086b..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/invalid-standalone-computed-variable-property.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript objectLiteralComputedProperties invalid-standalone-computed-variable-property.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "':' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot index 2cd53191abe..53c49f1bc19 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript objectLiteralComputedProperties standalone-expression-with-a Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -86,6 +87,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 17, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot index 6a652f6862b..6581e09d016 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript objectLiteralComputedProperties standalone-expression-with-m Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -30,11 +32,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 20, @@ -74,6 +79,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -92,7 +98,9 @@ Object { 7, 20, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot index 35093c1c72e..ee112a09ec2 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript objectLiteralComputedProperties standalone-expression.src 1` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -19,6 +20,7 @@ Object { Object { "computed": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -30,11 +32,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 3, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -48,6 +52,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 9, diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot index 094f900c48f..de9baf959f3 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot @@ -43,7 +43,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -55,11 +57,13 @@ Object { }, }, "name": "proto", + "optional": false, "range": Array [ 19, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -96,6 +100,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -116,7 +121,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -128,11 +135,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 36, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -149,6 +158,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -160,11 +170,13 @@ Object { }, }, "name": "__proto__", + "optional": false, "range": Array [ 43, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -178,6 +190,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 43, 59, @@ -185,6 +198,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -196,16 +210,19 @@ Object { }, }, "name": "proto", + "optional": false, "range": Array [ 54, 59, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -217,11 +234,13 @@ Object { }, }, "name": "__proto__", + "optional": false, "range": Array [ 62, 71, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -235,6 +254,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 62, 78, @@ -242,6 +262,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -253,11 +274,13 @@ Object { }, }, "name": "proto", + "optional": false, "range": Array [ 73, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -284,6 +307,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot index 14248de00b0..d9c3b6ab645 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot @@ -43,7 +43,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -55,11 +57,13 @@ Object { }, }, "name": "proto", + "optional": false, "range": Array [ 19, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -96,6 +100,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -116,7 +121,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -128,11 +135,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 36, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -179,6 +188,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 43, 61, @@ -186,6 +196,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -197,11 +208,13 @@ Object { }, }, "name": "proto", + "optional": false, "range": Array [ 56, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { @@ -237,6 +250,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 64, 82, @@ -244,6 +258,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -255,11 +270,13 @@ Object { }, }, "name": "proto", + "optional": false, "range": Array [ 77, 82, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -286,6 +303,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot index f4418a62155..920a5e9de72 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot @@ -43,7 +43,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -55,11 +57,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -76,6 +80,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -87,11 +92,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -105,6 +112,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 26, 36, @@ -134,6 +142,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -145,11 +154,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 39, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -163,6 +174,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 39, 50, @@ -213,6 +225,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot index ba29108abbe..317b960150f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot @@ -43,7 +43,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -55,11 +57,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -106,6 +110,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 26, 38, @@ -165,6 +170,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 41, 54, @@ -215,6 +221,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot deleted file mode 100644 index 14d3993f83b..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/invalid-method-no-braces.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript objectLiteralShorthandMethods invalid-method-no-braces.src 1`] = ` -TSError { - "column": 13, - "index": 19, - "lineNumber": 2, - "message": "'{' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot index a25be332cb0..ac8abefcf16 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -39,6 +43,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -50,11 +55,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -68,6 +75,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 14, 47, @@ -80,6 +88,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -91,11 +100,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 37, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -130,6 +141,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -148,7 +160,9 @@ Object { 17, 47, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -175,6 +189,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot index aacc20cd6bf..b51e058983a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript objectLiteralShorthandMethods simple-method-named-get.src 1` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -53,6 +57,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -64,11 +69,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +89,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 10, 23, @@ -108,6 +116,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -126,7 +135,9 @@ Object { 13, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot index ad2a85bab60..acd890e7ed1 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript objectLiteralShorthandMethods simple-method-named-set.src 1` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -53,6 +57,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -64,11 +69,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +89,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 10, 23, @@ -108,6 +116,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -126,7 +135,9 @@ Object { 13, 23, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot index c972f567b44..91e5ad3aece 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript objectLiteralShorthandMethods simple-method-with-argument.sr Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -53,6 +57,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -64,11 +69,13 @@ Object { }, }, "name": "method", + "optional": false, "range": Array [ 10, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +89,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 10, 31, @@ -108,6 +116,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -123,6 +132,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -134,18 +144,22 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 17, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 16, 31, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot index 26a0c63d8ad..8f207cc58c7 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript objectLiteralShorthandMethods simple-method-with-string-name Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -83,6 +87,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 10, 28, @@ -109,6 +114,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -127,7 +133,9 @@ Object { 18, 28, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot index 496c69184fb..c56f1df59d0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript objectLiteralShorthandMethods simple-method.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -53,6 +57,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -64,11 +69,13 @@ Object { }, }, "name": "method", + "optional": false, "range": Array [ 10, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -82,6 +89,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 10, 26, @@ -108,6 +116,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -126,7 +135,9 @@ Object { 16, 26, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot index 539f46e43be..04671139283 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -69,6 +73,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 14, 49, @@ -81,6 +86,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -92,11 +98,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 39, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -131,6 +139,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -149,7 +158,9 @@ Object { 19, 49, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -176,6 +187,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot index e7865f68128..7c826870297 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -42,7 +46,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -54,11 +60,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -78,7 +86,9 @@ Object { "type": "VariableDeclarator", }, Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -90,11 +100,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": null, "loc": Object { @@ -114,6 +126,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -134,7 +147,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -146,11 +161,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -167,6 +184,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -178,11 +196,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -196,6 +216,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 42, 45, @@ -203,6 +224,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -214,16 +236,19 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 42, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -235,11 +260,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 51, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -253,6 +280,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 51, 54, @@ -260,6 +288,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -271,16 +300,19 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 51, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -292,11 +324,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 60, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -310,6 +344,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 60, 63, @@ -317,6 +352,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -328,11 +364,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 60, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -359,6 +397,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot deleted file mode 100644 index 40818b0aef6..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/invalid.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript octalLiterals invalid.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "';' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot index d29cdf5a315..d9a01d35b84 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript octalLiterals legacy.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot index 939439e4300..13e2d73d019 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript octalLiterals lowercase.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot index ecbdcbe0e2d..100aec417a9 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot @@ -41,6 +41,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot index 7bf9a073c99..add712ad5ca 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript octalLiterals uppercase.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot index 60890ad82c1..3a74ee35b2c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot index 8c3368e55d2..2e40921f14f 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot index c9dd41e76a7..947b615da57 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot index c9278fb0e05..981db5e3138 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot index 402d703edb0..b08d9329097 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot index 742dfb81cd1..39322db7325 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -66,14 +71,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -85,12 +93,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -101,18 +112,23 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 18, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 0, 22, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot index 6a702c70065..2901e45bc45 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript restParams class-constructor.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,6 +89,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -91,12 +101,15 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 29, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -107,18 +120,23 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 26, 32, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 25, 41, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -138,7 +156,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -150,12 +171,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -171,7 +195,9 @@ Object { 43, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot index 9a269121cc6..249307c64cd 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot @@ -4,11 +4,15 @@ exports[`javascript restParams class-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,6 +89,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -91,12 +101,15 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -107,18 +120,23 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 18, 24, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 17, 33, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -138,7 +156,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -150,12 +171,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -171,7 +195,9 @@ Object { 35, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot index 9fe80f80f04..6e86567b8cd 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "async": false, "body": undefined, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +22,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,6 +42,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -49,14 +54,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -68,12 +76,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -84,18 +95,23 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 22, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 0, 24, ], + "returnType": undefined, "type": "TSDeclareFunction", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot index bc677b493e5..0c78d497d6e 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot @@ -6,9 +6,11 @@ Object { Object { "async": false, "body": undefined, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +22,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,6 +42,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -49,14 +54,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -68,12 +76,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -84,13 +95,17 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 14, 18, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -102,18 +117,22 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 23, ], + "returnType": undefined, "type": "TSDeclareFunction", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot index f25ab92c851..f261603beb4 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -44,6 +48,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -59,6 +64,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -70,14 +76,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -89,12 +98,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -105,18 +117,23 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 20, 24, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 8, 28, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -135,6 +152,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot index 75bf60296cf..1a51980f118 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -44,6 +48,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -60,6 +65,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -71,12 +77,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -87,18 +96,23 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 18, 22, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 8, 26, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -117,6 +131,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot index 2d7783f85ba..ba57015fedb 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,6 +60,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -66,10 +71,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -81,11 +88,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -99,6 +108,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 17, @@ -106,6 +116,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -117,11 +128,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -130,7 +143,9 @@ Object { 19, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -141,18 +156,23 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 19, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 0, 22, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot index 0c6874834c6..6b61e28e0f0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,6 +60,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -67,12 +72,15 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -83,18 +91,23 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 15, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ 0, 19, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot index af16271112d..1dab848b1c8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "argument": Object { @@ -79,6 +83,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot index cee8e09edbe..321bd41c275 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot index e574c539f5f..d3158faf630 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot index 7f9bbbcdae0..91d536ffc5c 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "argument": Object { @@ -79,6 +83,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot index 7a05b658180..a7d510f263b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot index 8f6d7065880..9571bcdd0a8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot index 22d72a386e6..0c399b54fe0 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,13 +20,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -36,11 +41,13 @@ Object { }, }, "name": "undefined", + "optional": false, "range": Array [ 10, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot index 26dfb7cccce..253a15279e6 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot @@ -4,8 +4,10 @@ exports[`javascript spread complex-spread.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 102, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -31,11 +35,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 22, @@ -56,6 +63,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -66,10 +74,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -81,11 +91,13 @@ Object { }, }, "name": "ka", + "optional": false, "range": Array [ 7, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -99,6 +111,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 7, 9, @@ -106,6 +119,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -117,15 +131,18 @@ Object { }, }, "name": "ka", + "optional": false, "range": Array [ 7, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -137,12 +154,15 @@ Object { }, }, "name": "nested", + "optional": false, "range": Array [ 14, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -153,11 +173,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 11, 20, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -165,11 +188,13 @@ Object { 22, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -181,11 +206,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -199,6 +226,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 24, 32, @@ -206,6 +234,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -217,16 +246,19 @@ Object { }, }, "name": "other", + "optional": false, "range": Array [ 27, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -238,11 +270,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 34, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -256,6 +290,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 34, 92, @@ -263,6 +298,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 92, @@ -273,10 +309,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -288,11 +326,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 39, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -306,6 +346,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 39, 64, @@ -313,8 +354,10 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 57, @@ -325,9 +368,11 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -339,12 +384,15 @@ Object { }, }, "name": "nested2", + "optional": false, "range": Array [ 48, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -355,11 +403,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 45, 55, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -367,9 +418,11 @@ Object { 57, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 63, @@ -381,12 +434,15 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 62, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 63, @@ -397,11 +453,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 59, 63, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "loc": Object { @@ -414,16 +473,19 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 42, 64, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 67, @@ -435,11 +497,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 66, 67, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -453,6 +517,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 66, 80, @@ -460,6 +525,7 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 80, @@ -470,10 +536,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 72, @@ -485,11 +553,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 71, 72, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -503,6 +573,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 71, 72, @@ -510,6 +581,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 72, @@ -521,15 +593,18 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 71, 72, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 78, @@ -541,12 +616,15 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 77, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 78, @@ -557,11 +635,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 74, 78, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -569,10 +650,12 @@ Object { 80, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 90, @@ -584,12 +667,15 @@ Object { }, }, "name": "rest2", + "optional": false, "range": Array [ 85, 90, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 90, @@ -600,11 +686,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 82, 90, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -612,10 +701,12 @@ Object { 92, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 101, @@ -627,12 +718,15 @@ Object { }, }, "name": "rest", + "optional": false, "range": Array [ 97, 101, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 101, @@ -643,11 +737,14 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 94, 101, ], "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, }, ], "range": Array [ @@ -655,6 +752,7 @@ Object { 102, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -672,6 +770,7 @@ Object { 112, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 112, @@ -683,11 +782,13 @@ Object { }, }, "name": "complex", + "optional": false, "range": Array [ 105, 112, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot deleted file mode 100644 index f80801010e1..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-if.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript spread error-invalid-if.src 1`] = ` -TSError { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot deleted file mode 100644 index 2606eea3403..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/error-invalid-sequence.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript spread error-invalid-sequence.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot index 34ecef99b6e..f0166dcd049 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot @@ -4,9 +4,11 @@ exports[`javascript spread multi-function-call.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,14 +20,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +42,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -61,6 +68,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -72,11 +80,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -94,6 +104,7 @@ Object { 12, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot index 53414b1bf51..e8b0a543bbf 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot @@ -4,10 +4,12 @@ exports[`javascript spread not-final-param.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -19,11 +21,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -42,6 +46,7 @@ Object { "type": "SpreadElement", }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -53,14 +58,17 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -72,11 +80,13 @@ Object { }, }, "name": "func", + "optional": false, "range": Array [ 0, 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -94,6 +104,7 @@ Object { 13, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot index f446eb1c8dc..5d200dab46b 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot @@ -4,10 +4,12 @@ exports[`javascript spread simple-function-call.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -19,11 +21,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -43,6 +47,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -54,11 +59,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -76,6 +83,7 @@ Object { 9, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot index 0fda53e60b5..1dca3524497 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript templateStrings deeply-nested.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -228,6 +229,7 @@ Object { 44, ], "tag": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -239,11 +241,13 @@ Object { }, }, "name": "raw", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TaggedTemplateExpression", "typeParameters": undefined, diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot index 1108acb90fa..c0bdaa76c24 100644 Binary files a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot and b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot differ diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot index 8c783e6b6d0..a381e89f5c3 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -18,11 +20,13 @@ Object { }, }, "name": "ts", + "optional": false, "range": Array [ 4, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [], @@ -85,6 +89,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot index 134a3a7c8aa..4743997f153 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -80,7 +85,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -92,11 +99,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -134,6 +143,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -152,9 +162,11 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -166,14 +178,17 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 37, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -185,11 +200,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 51, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot index 4f3026c6894..9a30e51cc75 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript templateStrings multi-line-template-string.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expressions": Array [], "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot index e795938a5fc..a1bda1978fc 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript templateStrings simple-template-string.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expressions": Array [], "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot index 9fd8251e454..ce91f2b68e8 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -18,11 +20,13 @@ Object { }, }, "name": "ts", + "optional": false, "range": Array [ 4, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expressions": Array [], @@ -83,6 +87,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot index ddb0bc6e03f..8e394cf8b1a 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot @@ -4,6 +4,7 @@ exports[`javascript templateStrings tagged-no-placeholders.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -62,6 +63,7 @@ Object { 8, ], "tag": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -73,11 +75,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TaggedTemplateExpression", "typeParameters": undefined, diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot index d929755df48..4e7c500f305 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot @@ -8,9 +8,11 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -22,11 +24,13 @@ Object { }, }, "name": "arguments", + "optional": false, "range": Array [ 30, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { @@ -42,6 +46,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -53,14 +58,17 @@ Object { }, }, "name": "console", + "optional": false, "range": Array [ 18, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -72,11 +80,13 @@ Object { }, }, "name": "log", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 18, @@ -100,6 +110,7 @@ Object { 40, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -134,9 +145,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -148,11 +161,13 @@ Object { }, }, "name": "tag", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -169,9 +184,12 @@ Object { 0, 43, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -186,6 +204,7 @@ Object { "quasi": Object { "expressions": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -197,13 +216,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 55, 56, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -215,11 +237,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 71, 72, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -311,6 +335,7 @@ Object { 75, ], "tag": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -322,11 +347,13 @@ Object { }, }, "name": "tag", + "optional": false, "range": Array [ 44, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TaggedTemplateExpression", "typeParameters": undefined, diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/basic-string-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/basic-string-literal.src.js.shot deleted file mode 100644 index 7ebaec93ddf..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/basic-string-literal.src.js.shot +++ /dev/null @@ -1,100 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript unicodeCodePointEscapes basic-string-literal.src 1`] = ` -Object { - "body": Array [ - Object { - "directive": "\\\\u{714E}\\\\u{8336}", - "expression": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "raw": "\\"\\\\u{714E}\\\\u{8336}\\"", - "type": "Literal", - "value": "煎茶", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 19, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 18, - ], - "type": "String", - "value": "\\"\\\\u{714E}\\\\u{8336}\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 1, - }, - "start": Object { - "column": 18, - "line": 1, - }, - }, - "range": Array [ - 18, - 19, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/complex-string-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/complex-string-literal.src.js.shot deleted file mode 100644 index c79ece5c334..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/complex-string-literal.src.js.shot +++ /dev/null @@ -1,100 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript unicodeCodePointEscapes complex-string-literal.src 1`] = ` -Object { - "body": Array [ - Object { - "directive": "\\\\u{20BB7}\\\\u{10FFFF}\\\\u{1}", - "expression": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "raw": "\\"\\\\u{20BB7}\\\\u{10FFFF}\\\\u{1}\\"", - "type": "Literal", - "value": "𠮷􏿿", - }, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "type": "ExpressionStatement", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 27, - ], - "sourceType": "script", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "type": "String", - "value": "\\"\\\\u{20BB7}\\\\u{10FFFF}\\\\u{1}\\"", - }, - Object { - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 27, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot index f893dfa0609..6fa4ff6603d 100644 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -80,7 +85,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -92,11 +99,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -134,6 +143,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -154,7 +164,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -166,11 +178,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -208,6 +222,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -228,7 +243,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -240,11 +257,13 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 51, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -261,6 +280,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -272,11 +292,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 59, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -290,6 +312,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 59, 76, @@ -319,6 +342,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -330,11 +354,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 80, 81, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -348,6 +374,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 80, 103, @@ -374,6 +401,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -389,7 +417,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -401,11 +431,13 @@ Object { }, }, "name": "h", + "optional": false, "range": Array [ 82, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -417,6 +449,7 @@ Object { "line": 6, }, }, + "optional": false, "range": Array [ 82, 99, @@ -441,18 +474,22 @@ Object { "value": "�", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 81, 103, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -464,11 +501,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 107, 108, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -482,6 +521,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 107, 135, @@ -523,7 +563,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -535,11 +577,13 @@ Object { }, }, "name": "j", + "optional": false, "range": Array [ 111, 112, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -551,6 +595,7 @@ Object { "line": 7, }, }, + "optional": false, "range": Array [ 111, 128, @@ -575,13 +620,16 @@ Object { "value": "�", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 110, 135, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -608,6 +656,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -626,6 +675,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -661,6 +711,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -672,14 +723,17 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 140, 141, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -691,11 +745,13 @@ Object { }, }, "name": "i", + "optional": false, "range": Array [ 142, 143, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 140, @@ -719,6 +775,7 @@ Object { 151, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot deleted file mode 100644 index 7d4d1d1a6bd..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-empty-escape.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript unicodeCodePointEscapes invalid-empty-escape.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Hexadecimal digit expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot deleted file mode 100644 index b5e8902e41d..00000000000 --- a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/invalid-too-large-escape.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`javascript unicodeCodePointEscapes invalid-too-large-escape.src 1`] = ` -TSError { - "column": 10, - "index": 10, - "lineNumber": 1, - "message": "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot index 2e630050997..5abb5af0115 100644 --- a/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx-useJSXTextNode self-closing-tag-inside-tag.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot index 326c3194f95..6f5a8d10424 100644 --- a/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx-useJSXTextNode test-content.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot index 0c7c49b765a..241978d18f6 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx attributes.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { @@ -163,6 +164,7 @@ Object { "type": "JSXAttribute", "value": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -174,11 +176,13 @@ Object { }, }, "name": "quz", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -199,6 +203,7 @@ Object { }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -210,11 +215,13 @@ Object { }, }, "name": "rest", + "optional": false, "range": Array [ 29, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot index a1526ac3de6..4df545ff5a6 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx element-keyword-name.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot index 8d98282032a..da0918624ae 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx embedded-comment.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot index a0960faec84..ee0ecc91d1f 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx embedded-conditional.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -184,6 +185,7 @@ Object { 23, ], "test": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -195,11 +197,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "ConditionalExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot index e67cf324a95..fc3cd5e29f8 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx embedded-invalid-js-identifier.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot deleted file mode 100644 index 02c6e82f663..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/embedded-tags.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx embedded-tags.src 1`] = ` -TSError { - "column": 40, - "index": 40, - "lineNumber": 1, - "message": "Unexpected token. Did you mean \`{'>'}\` or \`>\`?", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot index d3b5a05c217..539fa714aa9 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx empty-placeholder.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot index 3db51530669..fb1976cfcff 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx escape-patterns-ignored.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot index 141520e983f..aeeb7caeb03 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx escape-patterns-unknown.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -133,6 +134,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -262,6 +264,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -391,6 +394,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "children": Array [ Object { @@ -519,6 +523,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "children": Array [ Object { @@ -647,6 +652,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot index 1856270c740..cc098930c42 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx escape-patterns-valid.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot index cc3c38b714c..cd171955f96 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx escape-patters-multi.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot deleted file mode 100644 index 312d414ac20..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute-missing-equals.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-attribute-missing-equals.src 1`] = ` -TSError { - "column": 14, - "index": 14, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot deleted file mode 100644 index 0a637a76255..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-attribute.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-attribute.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "'{' or JSX element expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot deleted file mode 100644 index f04a7143059..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-broken-tag.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-broken-tag.src 1`] = ` -TSError { - "column": 12, - "index": 12, - "lineNumber": 1, - "message": "Unterminated string literal.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot deleted file mode 100644 index 4e6aab21478..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-end-tag-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-computed-end-tag-name.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot deleted file mode 100644 index d6ebfad1a33..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-computed-string-end-tag-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-computed-string-end-tag-name.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot deleted file mode 100644 index b100da149e8..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-embedded-expression.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-embedded-expression.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "'}' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot deleted file mode 100644 index 57a4e46ab9d..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-leading-dot-tag-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-leading-dot-tag-name.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot deleted file mode 100644 index 0109dd78aee..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-matching-placeholder-in-closing-tag.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-matching-placeholder-in-closing-tag.src 1`] = ` -TSError { - "column": 27, - "index": 27, - "lineNumber": 1, - "message": "'>' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot deleted file mode 100644 index a8788896feb..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tag.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-mismatched-closing-tag.src 1`] = ` -TSError { - "column": 5, - "index": 5, - "lineNumber": 1, - "message": "Expected corresponding JSX closing tag for 'a'.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot deleted file mode 100644 index 911494689a4..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-closing-tags.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-mismatched-closing-tags.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "JSX element 'a' has no corresponding closing tag.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot deleted file mode 100644 index 560ee71e7f7..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-dot-tag-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-mismatched-dot-tag-name.src 1`] = ` -TSError { - "column": 9, - "index": 9, - "lineNumber": 1, - "message": "Expected corresponding JSX closing tag for 'a.b.c'.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot deleted file mode 100644 index 4e5bac634b9..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-mismatched-namespace-tag.src 1`] = ` -TSError { - "column": 7, - "index": 7, - "lineNumber": 1, - "message": "Expected corresponding JSX closing tag for 'a:b'.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot deleted file mode 100644 index 80d75f36ba2..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag-attribute-placeholder.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-missing-closing-tag-attribute-placeholder.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "JSX element 'a' has no corresponding closing tag.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot deleted file mode 100644 index 56f8c0d6ae3..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-closing-tag.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-missing-closing-tag.src 1`] = ` -TSError { - "column": 1, - "index": 1, - "lineNumber": 1, - "message": "JSX element 'a' has no corresponding closing tag.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot deleted file mode 100644 index c208b579c83..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-missing-namespace-name.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Expression expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot deleted file mode 100644 index d76a079d93e..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-namespace-value.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-missing-namespace-value.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot deleted file mode 100644 index ac0a591ee4f..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-missing-spread-operator.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-missing-spread-operator.src 1`] = ` -TSError { - "column": 6, - "index": 6, - "lineNumber": 1, - "message": "'...' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot deleted file mode 100644 index 31752fe9261..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-name-with-docts.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-namespace-name-with-docts.src 1`] = ` -TSError { - "column": 4, - "index": 4, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot index 3d11bc184cc..fd09316ce46 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx invalid-namespace-value-with-dots.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot deleted file mode 100644 index 70dbe413502..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent-with-comment.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-no-common-parent-with-comment.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "JSX expressions must have one parent element.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot deleted file mode 100644 index 459f4817020..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-common-parent.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-no-common-parent.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "JSX expressions must have one parent element.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot deleted file mode 100644 index 7468255ed50..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-no-tag-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-no-tag-name.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "Declaration or statement expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot deleted file mode 100644 index 68d4a0fe19d..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-placeholder-in-closing-tag.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-placeholder-in-closing-tag.src 1`] = ` -TSError { - "column": 16, - "index": 16, - "lineNumber": 1, - "message": "'>' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot deleted file mode 100644 index decbdbd3dc1..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-shorthand-fragment-no-closing.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-shorthand-fragment-no-closing.src 1`] = ` -TSError { - "column": 0, - "index": 0, - "lineNumber": 1, - "message": "JSX fragment has no corresponding closing tag.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot deleted file mode 100644 index 9043d6e4195..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-trailing-dot-tag-name.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-trailing-dot-tag-name.src 1`] = ` -TSError { - "column": 3, - "index": 3, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot deleted file mode 100644 index 6f8f5c8668e..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/invalid-unexpected-comma.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx invalid-unexpected-comma.src 1`] = ` -TSError { - "column": 19, - "index": 19, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot index 862711b68f6..fac1b442189 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx japanese-characters.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot index 9e4992cab3a..9a015370413 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx less-than-operator.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "children": Array [], @@ -78,6 +79,7 @@ Object { 13, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -89,11 +91,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot deleted file mode 100644 index c6d458d493e..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/member-expression-private.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx member-expression-private.src 1`] = ` -TSError { - "column": 10, - "index": 10, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot index 588debdd0d6..3a7e8f2e723 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx member-expression-this.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -148,6 +149,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, diff --git a/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot index 969318a5bb3..596329f458b 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx member-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot index 17fa0430b73..d7b71e4c67e 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx multiple-blank-spaces.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot index 46d67089584..7e0f5295c12 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx namespace-this-name.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot index cfb3f96c345..9b4e0acdb68 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx namespaced-attribute-and-value-inserted.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { @@ -27,6 +28,7 @@ Object { }, Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -38,11 +40,13 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 17, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot index b27c937e5a0..9b209cf1633 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx namespaced-name-and-attribute.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, diff --git a/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot deleted file mode 100644 index 598f29385b2..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/newslines-and-entities.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx newslines-and-entities.src 1`] = ` -TSError { - "column": 8, - "index": 8, - "lineNumber": 1, - "message": "Invalid character.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot index cfb82c9a414..921f92dc5b7 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx self-closing-tag-inside-tag.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot deleted file mode 100644 index 9de3d885b9d..00000000000 --- a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-with-newline.src.js.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`jsx self-closing-tag-with-newline.src 1`] = ` -TSError { - "column": 2, - "index": 2, - "lineNumber": 1, - "message": "Invalid character.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot index 9e5ea942a82..69decc59f4a 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx self-closing-tag.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, diff --git a/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot index 96a50d1928e..83610f13eb6 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx shorthand-fragment-with-child.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot index 4d75ad537f8..40eb0c61e8d 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx shorthand-fragment.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingFragment": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot index 4227ac2e551..9eca921ea7d 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx spread-child.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot index 0ba87aa2572..a2d98db8d7d 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx spread-operator-attribute-and-regular-attribute.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -21,6 +22,7 @@ Object { "attributes": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -32,11 +34,13 @@ Object { }, }, "name": "props", + "optional": false, "range": Array [ 9, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot index 402559dd631..9f06bd404b6 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx spread-operator-attributes.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, @@ -21,6 +22,7 @@ Object { "attributes": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -32,11 +34,13 @@ Object { }, }, "name": "props", + "optional": false, "range": Array [ 9, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot index fbd0fba223a..e7049389e4b 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx tag-names-with-dots.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot index 7ef41034fc5..797219d3f6e 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx tag-names-with-multi-dots-multi.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot index 84eb1e17b29..8aa9f0436a7 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx tag-names-with-multi-dots.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot index 4df5e2ed08b..4e1a62785cc 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx test-content.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [ Object { diff --git a/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot index d6e19fd1d05..d5bb5fd7fc6 100644 --- a/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot +++ b/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot @@ -4,6 +4,7 @@ exports[`jsx trailing-spread-operator-attribute.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { @@ -163,6 +164,7 @@ Object { }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -174,11 +176,13 @@ Object { }, }, "name": "props", + "optional": false, "range": Array [ 40, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot index 8cd3cfa65cc..acc324cfad1 100644 --- a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot +++ b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot @@ -4,6 +4,7 @@ exports[`tsx generic-jsx-element.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": null, diff --git a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot deleted file mode 100644 index 5d5d2c98492..00000000000 --- a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-member-expression-private.src.tsx.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`tsx generic-jsx-member-expression-private.src 1`] = ` -TSError { - "column": 22, - "index": 22, - "lineNumber": 1, - "message": "Identifier expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot index d516de71c1c..d38d0c85cd3 100644 --- a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot +++ b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot @@ -4,6 +4,7 @@ exports[`tsx generic-jsx-opening-element.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "children": Array [], "closingElement": Object { diff --git a/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot index cf0793e2573..ba034cff116 100644 --- a/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot +++ b/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -63,11 +64,13 @@ Object { }, }, "name": "React", + "optional": false, "range": Array [ 12, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, @@ -79,7 +82,9 @@ Object { "type": "ImportDeclaration", }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -91,11 +96,13 @@ Object { }, }, "name": "Props", + "optional": false, "range": Array [ 36, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -125,10 +132,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -140,11 +149,13 @@ Object { }, }, "name": "title", + "optional": false, "range": Array [ 48, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -156,13 +167,13 @@ Object { "line": 3, }, }, - "optional": undefined, + "optional": false, "range": Array [ 48, 61, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -206,6 +217,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, Object { "declaration": Object { @@ -250,6 +262,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -261,14 +274,17 @@ Object { }, }, "name": "props", + "optional": false, "range": Array [ 136, 141, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -280,11 +296,13 @@ Object { }, }, "name": "title", + "optional": false, "range": Array [ 142, 147, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 136, @@ -452,9 +470,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -466,11 +486,13 @@ Object { }, }, "name": "App", + "optional": false, "range": Array [ 89, 92, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -484,6 +506,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -495,6 +518,7 @@ Object { }, }, "name": "props", + "optional": false, "range": Array [ 93, 105, @@ -533,6 +557,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -544,11 +569,13 @@ Object { }, }, "name": "Props", + "optional": false, "range": Array [ 100, 105, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -559,7 +586,9 @@ Object { 80, 164, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { 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 a32b6821f9e..5ee9949c8b7 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 @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 0, 24, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -86,6 +91,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -97,11 +103,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 bd4752cee3b..370cfc2ff60 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 @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 0, 42, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -118,6 +123,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -129,11 +135,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot index 7b34b013580..c859e255d4b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot @@ -10,8 +10,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -23,11 +26,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 52, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -40,6 +45,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 43, @@ -47,9 +53,11 @@ Object { ], "static": false, "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -68,7 +76,9 @@ Object { 63, 66, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -88,7 +98,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -100,12 +113,15 @@ Object { }, }, "name": "AbstractSocket", + "optional": false, "range": Array [ 22, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -121,7 +137,9 @@ Object { 68, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot index 4fce3551bf9..e800d9256e1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot @@ -10,8 +10,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -23,11 +26,13 @@ Object { }, }, "name": "createSocket", + "optional": false, "range": Array [ 52, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -40,6 +45,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 43, @@ -47,9 +53,11 @@ Object { ], "static": false, "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -101,6 +109,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -112,11 +121,13 @@ Object { }, }, "name": "Promise", + "optional": false, "range": Array [ 68, 75, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -157,6 +168,7 @@ Object { }, }, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -176,7 +188,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -188,12 +203,15 @@ Object { }, }, "name": "AbstractSocket", + "optional": false, "range": Array [ 22, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -209,7 +227,9 @@ Object { 86, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot index 34ca54e31bb..e9b5b3aaf8d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot @@ -8,9 +8,13 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -22,11 +26,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,20 +44,26 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 25, 38, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "TSAbstractPropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -63,11 +75,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 52, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -79,12 +93,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 43, 64, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { @@ -140,7 +155,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -152,12 +170,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -173,7 +194,9 @@ Object { 66, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot index 66cc1ade490..60776d29fa3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot @@ -11,7 +11,10 @@ Object { "accessibility": "public", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -23,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 48, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +44,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 23, @@ -100,7 +106,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -112,12 +121,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -133,7 +145,9 @@ Object { 62, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot index ac16278e0e7..503adfa42c7 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot @@ -10,8 +10,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -23,11 +26,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 57, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -40,6 +45,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 41, @@ -47,9 +53,11 @@ Object { ], "static": true, "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -68,7 +76,9 @@ Object { 68, 71, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -88,7 +98,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -100,12 +113,15 @@ Object { }, }, "name": "AbstractSocket", + "optional": false, "range": Array [ 22, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -121,7 +137,9 @@ Object { 73, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot index 2ba070b7a0b..fa5364f6d5c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot @@ -8,9 +8,13 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -22,11 +26,13 @@ Object { }, }, "name": "prop1", + "optional": false, "range": Array [ 45, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 37, 59, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -83,9 +90,13 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -97,11 +108,13 @@ Object { }, }, "name": "prop2", + "optional": false, "range": Array [ 79, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,12 +126,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 62, 93, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { @@ -161,7 +175,10 @@ Object { "accessibility": "public", "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -173,11 +190,13 @@ Object { }, }, "name": "prop3", + "optional": false, "range": Array [ 120, 125, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -189,12 +208,13 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 96, 134, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "TSAbstractPropertyDefinition", "typeAnnotation": Object { @@ -234,9 +254,13 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -248,11 +272,13 @@ Object { }, }, "name": "prop4", + "optional": false, "range": Array [ 163, 168, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -264,6 +290,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 137, @@ -312,7 +339,10 @@ Object { "accessibility": "public", "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -324,11 +354,13 @@ Object { }, }, "name": "prop5", + "optional": false, "range": Array [ 213, 218, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -340,6 +372,7 @@ Object { "line": 6, }, }, + "optional": false, "override": false, "range": Array [ 180, @@ -401,7 +434,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -413,12 +449,15 @@ Object { }, }, "name": "AbstractDeclProps", + "optional": false, "range": Array [ 15, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -434,7 +473,9 @@ Object { 229, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot index a9672cf2757..2bc82c310bb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot @@ -10,8 +10,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -23,11 +26,13 @@ Object { }, }, "name": "createSocket", + "optional": false, "range": Array [ 43, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -48,9 +53,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -102,6 +109,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -113,11 +121,13 @@ Object { }, }, "name": "Promise", + "optional": false, "range": Array [ 60, 67, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -158,6 +168,7 @@ Object { }, }, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -177,7 +188,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -189,12 +203,15 @@ Object { }, }, "name": "AbstractSocket", + "optional": false, "range": Array [ 22, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -210,7 +227,9 @@ Object { 78, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot index 32e9b1f0028..2bedfb7ac5f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot @@ -8,8 +8,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -21,11 +24,13 @@ Object { }, }, "name": "show", + "optional": false, "range": Array [ 80, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": true, "range": Array [ 62, @@ -45,9 +51,11 @@ Object { ], "static": false, "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -66,7 +74,9 @@ Object { 84, 87, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -86,7 +96,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -98,12 +111,15 @@ Object { }, }, "name": "SpecializedComponent", + "optional": false, "range": Array [ 15, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -119,6 +135,7 @@ Object { 89, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 57, @@ -130,13 +147,17 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 44, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot index d22f508108d..1b092c20049 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot @@ -8,9 +8,13 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -22,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 80, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,14 +44,16 @@ Object { "line": 2, }, }, + "optional": false, "override": true, "range": Array [ 62, 88, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "TSAbstractPropertyDefinition", + "typeAnnotation": undefined, "value": null, }, ], @@ -65,7 +73,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -77,12 +88,15 @@ Object { }, }, "name": "SpecializedComponent", + "optional": false, "range": Array [ 15, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -98,6 +112,7 @@ Object { 90, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 57, @@ -109,13 +124,17 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 44, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot index 5d96c992f86..ead501da961 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot @@ -6,7 +6,6 @@ Object { Object { "assertions": Array [], "declaration": Object { - "abstract": true, "body": Object { "body": Array [], "loc": Object { @@ -25,7 +24,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -37,11 +39,13 @@ Object { }, }, "name": "I", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 31, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, "exportKind": "type", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot index 724c90a6e82..8d450898f1b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -18,11 +20,13 @@ Object { }, }, "name": "asserted2", + "optional": false, "range": Array [ 4, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -31,6 +35,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -42,11 +47,13 @@ Object { }, }, "name": "n", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -96,6 +103,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -107,18 +115,22 @@ Object { }, }, "name": "n", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 22, 42, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -170,6 +182,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot index fac27b9cb3e..1629da85325 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -94,6 +98,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot index e059e49fe56..e13f20e8452 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot @@ -4,12 +4,14 @@ exports[`typescript basics arrow-function-with-optional-parameter.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { "async": false, "body": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -21,11 +23,13 @@ Object { }, }, "name": "k", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -78,6 +82,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -95,13 +100,16 @@ Object { 4, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 1, 14, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -119,6 +127,7 @@ Object { 17, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { 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 b233dae579e..d184debdce5 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 @@ -4,12 +4,14 @@ exports[`typescript basics arrow-function-with-type-parameters.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "async": false, "body": Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -21,11 +23,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +79,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -86,6 +91,7 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 4, 8, @@ -124,6 +130,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -135,11 +142,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -183,6 +192,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -194,11 +204,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -231,6 +243,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -242,11 +255,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot index 506b7feaedc..028c4f3ca9e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics async-function-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -26,9 +27,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -40,11 +43,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 16, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -61,7 +66,9 @@ Object { 1, 26, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -79,6 +86,7 @@ Object { 29, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot index 680e8ebcb35..ad8b2ec9dee 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot @@ -10,7 +10,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -22,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -64,6 +68,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -84,7 +89,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -96,11 +103,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 53, 56, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -138,6 +147,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -158,7 +168,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -170,11 +182,13 @@ Object { }, }, "name": "fooBar", + "optional": false, "range": Array [ 76, 82, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -212,6 +226,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -246,9 +261,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -260,11 +277,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 15, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -281,7 +300,9 @@ Object { 0, 96, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot index 335852f9e7f..72c8450e1e1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot @@ -10,7 +10,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -22,16 +24,19 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 25, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "argument": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -43,11 +48,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 37, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -65,6 +72,7 @@ Object { 42, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -99,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -130,6 +139,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -141,14 +151,17 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 53, 56, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -160,11 +173,13 @@ Object { }, }, "name": "qux", + "optional": false, "range": Array [ 57, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 53, @@ -205,9 +220,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -219,11 +236,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -240,7 +259,9 @@ Object { 0, 63, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 8ec8827246f..9f15fc12159 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 @@ -4,7 +4,9 @@ exports[`typescript basics call-signatures-with-generics.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -62,6 +66,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -73,6 +78,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 19, 28, @@ -180,6 +186,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -191,11 +198,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -225,6 +234,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -236,6 +246,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 47, 56, @@ -343,6 +354,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -354,11 +366,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 44, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -382,6 +396,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot index 4f02bba2e4e..5d82d07709b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics call-signatures.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -62,6 +66,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -73,6 +78,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 25, @@ -153,6 +159,7 @@ Object { }, }, "type": "TSCallSignatureDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { @@ -167,6 +174,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -178,6 +186,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 41, 50, @@ -258,6 +267,7 @@ Object { }, }, "type": "TSConstructSignatureDeclaration", + "typeParameters": undefined, }, ], "range": Array [ @@ -266,6 +276,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot index 45d17fc3bfd..831a51bb958 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript basics cast-as-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -40,6 +44,7 @@ Object { 5, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -51,11 +56,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot index bd920460143..239d6837284 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot @@ -4,10 +4,12 @@ exports[`typescript basics cast-as-multi-assign.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "expression": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -19,11 +21,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 1, 2, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot index ab6b513bd47..073977b60c6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript basics cast-as-multi.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -89,6 +93,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -100,11 +105,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot index 3decb6ca4f1..a6ad519b22a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics cast-as-operator.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot index 985bfa73869..999ba3023f5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,14 +20,17 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -37,11 +42,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -93,6 +100,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot index 7626acea9a8..271f190c206 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot @@ -53,6 +53,7 @@ Object { }, }, "param": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -64,6 +65,7 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 16, 22, @@ -176,6 +178,7 @@ Object { }, }, "param": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -187,6 +190,7 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 46, 56, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot index 6c7105ea336..873e5d58ec4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot @@ -53,6 +53,7 @@ Object { }, }, "param": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -64,6 +65,7 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 16, 25, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot index f022531c3c7..92999b2ef5b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics class-multi-line-keyword-abstract.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "abstract", + "optional": false, "range": Array [ 0, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +43,7 @@ Object { "type": "ExpressionStatement", }, Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -57,7 +62,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -69,12 +77,15 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -90,7 +101,9 @@ Object { 19, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot index 2822f6f7ad6..e7044c2559d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics class-multi-line-keyword-declare.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -16,11 +18,13 @@ Object { }, }, "name": "declare", + "optional": false, "range": Array [ 0, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +43,7 @@ Object { "type": "ExpressionStatement", }, Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -57,7 +62,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -69,12 +77,15 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 10, @@ -90,7 +101,9 @@ Object { 18, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot index 04b127b9d7e..9dff921bdb2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot @@ -4,12 +4,15 @@ exports[`typescript basics class-private-identifier-field-with-accessibility-err Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "private", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -38,12 +41,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 36, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -86,6 +90,8 @@ Object { "accessibility": "public", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -114,12 +120,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 39, 60, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -159,8 +166,11 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -189,12 +199,13 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 63, 84, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -250,7 +261,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -262,12 +276,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -283,7 +300,9 @@ Object { 86, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot index c75fc510111..07b5c0884e1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-private-identifier-field-with-annotation.src 1` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -37,12 +41,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 29, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -82,8 +87,11 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -112,12 +120,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 32, 51, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -175,8 +184,11 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -188,11 +200,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 55, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -205,6 +219,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 55, @@ -212,11 +227,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -341,6 +358,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -359,7 +377,9 @@ Object { 66, 95, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -379,7 +399,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -391,12 +414,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -412,7 +438,9 @@ Object { 97, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot index 1131eb4ab21..11091507b80 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-private-identifier-readonly-field.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -37,6 +41,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -98,7 +103,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -110,12 +118,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -131,7 +142,9 @@ Object { 38, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot index 761783ccd1d..e0feb16115b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot @@ -4,12 +4,17 @@ exports[`typescript basics class-static-blocks.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -21,11 +26,13 @@ Object { }, }, "name": "count", + "optional": false, "range": Array [ 21, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,14 +44,16 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 31, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -72,8 +81,10 @@ Object { "consequent": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -85,11 +96,13 @@ Object { }, }, "name": "count", + "optional": false, "range": Array [ 76, 81, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -159,6 +172,7 @@ Object { "test": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -170,11 +184,13 @@ Object { }, }, "name": "someCondition", + "optional": false, "range": Array [ 51, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -192,6 +208,7 @@ Object { 66, ], "type": "CallExpression", + "typeParameters": undefined, }, "type": "IfStatement", }, @@ -229,7 +246,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -241,12 +261,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -262,7 +285,9 @@ Object { 96, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot index 72b6e487ad1..66b705fe68d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot @@ -4,13 +4,17 @@ exports[`typescript basics class-with-accessibility-modifiers.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "private", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -22,11 +26,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 35, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -86,7 +93,10 @@ Object { "accessibility": "public", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -98,11 +108,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 52, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -114,12 +126,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 38, 65, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -161,7 +174,9 @@ Object { Object { "accessibility": "public", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -173,11 +188,13 @@ Object { }, }, "name": "getBar", + "optional": false, "range": Array [ 75, 81, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -190,6 +207,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 68, @@ -197,6 +215,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -233,6 +252,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -244,11 +264,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 103, 106, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 98, @@ -289,6 +311,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -307,13 +330,17 @@ Object { 82, 111, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "protected", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -325,11 +352,13 @@ Object { }, }, "name": "setBar", + "optional": false, "range": Array [ 124, 130, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -342,6 +371,7 @@ Object { "line": 7, }, }, + "optional": false, "override": false, "range": Array [ 114, @@ -349,11 +379,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -386,6 +418,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -397,11 +430,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 157, 160, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 152, @@ -425,6 +460,7 @@ Object { 166, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -436,11 +472,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 163, 166, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, @@ -477,6 +515,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -492,6 +531,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -503,6 +543,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 132, 144, @@ -548,7 +589,9 @@ Object { 131, 171, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -568,7 +611,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -580,12 +626,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -601,7 +650,9 @@ Object { 173, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot index ed6760da000..5a6a52818cb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot @@ -4,12 +4,15 @@ exports[`typescript basics class-with-constructor-and-modifier.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "protected", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -21,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 22, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -38,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, @@ -45,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -65,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -83,12 +91,15 @@ Object { 33, 39, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "public", "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -119,6 +130,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 43, @@ -126,6 +138,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -146,6 +159,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -164,7 +178,9 @@ Object { 65, 71, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -184,7 +200,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -196,12 +215,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -217,7 +239,9 @@ Object { 73, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot index c05e61d2370..894bb53449d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-constructor-and-parameter-property-with-mo Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 53, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 53, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,7 +89,8 @@ Object { "params": Array [ Object { "accessibility": "protected", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 55, @@ -93,6 +103,7 @@ Object { }, "override": true, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -104,6 +115,7 @@ Object { }, }, "name": "param", + "optional": false, "range": Array [ 93, 106, @@ -149,7 +161,7 @@ Object { 106, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, ], @@ -157,7 +169,9 @@ Object { 64, 110, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -177,7 +191,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -189,12 +206,15 @@ Object { }, }, "name": "SpecializedComponent", + "optional": false, "range": Array [ 6, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -210,6 +230,7 @@ Object { 112, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -221,13 +242,17 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 35, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot index 2ab13d8e51c..34b890b13c3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-constructor-and-parameter-proptery-with-ov Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 53, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 53, @@ -44,11 +51,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -84,6 +93,7 @@ Object { 104, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -118,6 +128,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -134,7 +145,8 @@ Object { "params": Array [ Object { "accessibility": undefined, - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 36, @@ -147,6 +159,7 @@ Object { }, "override": true, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -158,6 +171,7 @@ Object { }, }, "name": "param", + "optional": false, "range": Array [ 74, 87, @@ -202,8 +216,8 @@ Object { 65, 87, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, ], @@ -211,7 +225,9 @@ Object { 64, 109, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -231,7 +247,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -243,12 +262,15 @@ Object { }, }, "name": "SpecializedComponent", + "optional": false, "range": Array [ 6, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -264,6 +286,7 @@ Object { 111, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -275,13 +298,17 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 35, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot index c3a17fbe698..601f1dcb7db 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-constructor-and-return-type.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 12, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -117,10 +126,13 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -151,6 +163,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 41, @@ -158,6 +171,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -178,6 +192,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -231,6 +246,7 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -250,7 +266,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -262,12 +281,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -283,7 +305,9 @@ Object { 72, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 fc9e41e1cce..f9fdbbc32f7 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 @@ -4,11 +4,15 @@ exports[`typescript basics class-with-constructor-and-type-parameters.src 1`] = Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 12, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,6 +91,7 @@ Object { 23, 32, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -110,6 +120,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -121,11 +132,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -144,7 +157,9 @@ Object { }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -175,6 +190,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 36, @@ -182,6 +198,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -202,6 +219,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -220,6 +238,7 @@ Object { 51, 60, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -248,6 +267,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -259,11 +279,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 52, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -298,7 +320,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -310,12 +335,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -331,7 +359,9 @@ Object { 62, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot index d42896e1914..195cc59be38 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot @@ -4,12 +4,17 @@ exports[`typescript basics class-with-declare-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -21,11 +26,13 @@ Object { }, }, "name": "prop1", + "optional": false, "range": Array [ 28, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 20, 42, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -85,7 +93,10 @@ Object { "accessibility": "public", "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -97,11 +108,13 @@ Object { }, }, "name": "prop2", + "optional": false, "range": Array [ 60, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,12 +126,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 45, 74, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -158,9 +172,13 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -172,11 +190,13 @@ Object { }, }, "name": "prop3", + "optional": false, "range": Array [ 92, 97, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -188,12 +208,13 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 77, 106, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -233,9 +254,13 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -247,11 +272,13 @@ Object { }, }, "name": "prop3", + "optional": false, "range": Array [ 126, 131, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -263,6 +290,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 109, @@ -311,7 +339,10 @@ Object { "accessibility": "public", "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -323,11 +354,13 @@ Object { }, }, "name": "prop4", + "optional": false, "range": Array [ 167, 172, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -339,6 +372,7 @@ Object { "line": 6, }, }, + "optional": false, "override": false, "range": Array [ 143, @@ -387,7 +421,10 @@ Object { "accessibility": "public", "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -399,11 +436,13 @@ Object { }, }, "name": "prop5", + "optional": false, "range": Array [ 206, 211, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -415,12 +454,13 @@ Object { "line": 7, }, }, + "optional": false, "override": false, "range": Array [ 184, 220, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -463,7 +503,10 @@ Object { "accessibility": "public", "computed": false, "declare": true, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -475,11 +518,13 @@ Object { }, }, "name": "prop6", + "optional": false, "range": Array [ 254, 259, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -491,6 +536,7 @@ Object { "line": 8, }, }, + "optional": false, "override": false, "range": Array [ 223, @@ -552,7 +598,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -564,12 +613,15 @@ Object { }, }, "name": "DeclProps", + "optional": false, "range": Array [ 6, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -585,7 +637,9 @@ Object { 270, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot index 8c358d12d20..e767114ee28 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot @@ -4,13 +4,17 @@ exports[`typescript basics class-with-definite-assignment.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], "definite": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -22,11 +26,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, 23, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -99,7 +106,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -111,12 +121,15 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -132,7 +145,9 @@ Object { 25, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot index 274ac4ac7c7..fd77a07d3f4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-export-parameter-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 16, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 16, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,6 +89,7 @@ Object { "params": Array [ Object { "accessibility": undefined, + "decorators": Array [], "export": true, "loc": Object { "end": Object { @@ -91,8 +101,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -104,6 +115,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 35, 44, @@ -148,8 +160,8 @@ Object { 28, 44, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, ], @@ -157,7 +169,9 @@ Object { 27, 54, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -177,7 +191,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -189,12 +206,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -210,7 +230,9 @@ Object { 56, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot index 0e146abbdde..77813357b3f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics class-with-extends-and-implements.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -34,15 +38,18 @@ Object { }, }, "name": "ClassWithParentAndInterface", + "optional": false, "range": Array [ 6, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 77, @@ -54,11 +61,13 @@ Object { }, }, "name": "MyInterface", + "optional": false, "range": Array [ 66, 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +84,7 @@ Object { 77, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -92,6 +102,7 @@ Object { 80, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 54, @@ -103,13 +114,17 @@ Object { }, }, "name": "MyOtherClass", + "optional": false, "range": Array [ 42, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 4b163281504..f6f2652718e 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 @@ -4,6 +4,7 @@ exports[`typescript basics class-with-extends-generic-multiple.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -55,6 +62,7 @@ Object { 45, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -66,11 +74,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 31, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "superTypeParameters": Object { "loc": Object { @@ -101,6 +111,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -112,11 +123,13 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -137,6 +150,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -148,11 +162,13 @@ Object { }, }, "name": "D", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -194,6 +210,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -205,11 +222,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -226,6 +245,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -237,11 +257,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 1b34e17f7eb..e569978121f 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 @@ -4,6 +4,7 @@ exports[`typescript basics class-with-extends-generic.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -55,6 +62,7 @@ Object { 32, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -66,11 +74,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "superTypeParameters": Object { "loc": Object { @@ -101,6 +111,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -112,11 +123,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -155,6 +168,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -166,11 +180,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 d648e1c98cf..8e4836a5ead 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 @@ -4,11 +4,15 @@ exports[`typescript basics class-with-generic-method-default.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -20,11 +24,13 @@ Object { }, }, "name": "getBar", + "optional": false, "range": Array [ 14, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,6 +91,7 @@ Object { 20, 34, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -114,6 +124,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -125,11 +136,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 25, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -145,6 +158,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -156,11 +170,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -195,7 +211,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -207,12 +226,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -228,7 +250,9 @@ Object { 36, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 f00ade847e8..c79899448ef 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 @@ -4,11 +4,15 @@ exports[`typescript basics class-with-generic-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -20,11 +24,13 @@ Object { }, }, "name": "getBar", + "optional": false, "range": Array [ 14, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,6 +91,7 @@ Object { 20, 28, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -110,6 +120,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -121,11 +132,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -160,7 +173,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -172,12 +188,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -193,7 +212,9 @@ Object { 30, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot index 34cc48c587d..8e00330e79b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics class-with-implements-and-extends.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -34,15 +38,18 @@ Object { }, }, "name": "ClassWithParentAndInterface", + "optional": false, "range": Array [ 6, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 56, @@ -54,11 +61,13 @@ Object { }, }, "name": "MyInterface", + "optional": false, "range": Array [ 45, 56, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +84,7 @@ Object { 56, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -92,6 +102,7 @@ Object { 80, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 77, @@ -103,13 +114,17 @@ Object { }, }, "name": "MyOtherClass", + "optional": false, "range": Array [ 65, 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot index 651f3c663b7..ad5f6cb5f24 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics class-with-implements-generic-multiple.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,15 +38,18 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -54,11 +61,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -104,6 +113,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -115,11 +125,13 @@ Object { }, }, "name": "S", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -140,6 +152,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -151,11 +164,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -183,7 +198,9 @@ Object { 35, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot index 55a31001fd1..1309c2bd42e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics class-with-implements-generic.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,15 +38,18 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -54,11 +61,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -104,6 +113,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -115,11 +125,13 @@ Object { }, }, "name": "S", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -147,7 +159,9 @@ Object { 32, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot index c84815bb0e8..4168e15a30f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics class-with-implements.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,15 +38,18 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -54,11 +61,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +84,7 @@ Object { 24, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -92,7 +102,9 @@ Object { 29, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 7519442ea6e..2948805166c 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 @@ -4,11 +4,15 @@ exports[`typescript basics class-with-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -117,11 +126,15 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -133,11 +146,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -150,6 +165,7 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 32, @@ -157,6 +173,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -177,6 +194,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -195,6 +213,7 @@ Object { 35, 44, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -223,6 +242,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -234,11 +254,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 36, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -257,8 +279,11 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -270,11 +295,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -287,6 +314,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 47, @@ -294,6 +322,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -314,6 +343,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -332,7 +362,9 @@ Object { 50, 55, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -352,7 +384,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -364,12 +399,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -385,7 +423,9 @@ Object { 57, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 47dd1de2f0d..ffd5aa93d96 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 @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "M", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -66,6 +71,7 @@ Object { }, }, "name": "Base", + "optional": false, "range": Array [ 37, 44, @@ -104,6 +110,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -115,11 +122,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 43, 44, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -130,6 +139,7 @@ Object { 0, 49, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -161,6 +171,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -172,11 +183,13 @@ Object { }, }, "name": "Constructor", + "optional": false, "range": Array [ 21, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -207,6 +220,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -218,11 +232,13 @@ Object { }, }, "name": "M", + "optional": false, "range": Array [ 33, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -247,6 +263,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -258,11 +275,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 8a991733611..131bd49f8de 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 @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "argument": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -27,7 +28,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 33, @@ -43,6 +47,7 @@ Object { 82, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -54,13 +59,17 @@ Object { }, }, "name": "Base", + "optional": false, "range": Array [ 74, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -95,9 +104,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -109,11 +120,13 @@ Object { }, }, "name": "M", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -127,6 +140,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -138,6 +152,7 @@ Object { }, }, "name": "Base", + "optional": false, "range": Array [ 38, 45, @@ -176,6 +191,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -187,11 +203,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 44, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -202,6 +220,7 @@ Object { 0, 84, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -233,6 +252,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -244,11 +264,13 @@ Object { }, }, "name": "Constructor", + "optional": false, "range": Array [ 21, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -301,6 +323,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -312,11 +335,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -334,6 +359,7 @@ Object { }, }, Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -352,7 +378,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -364,15 +393,18 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 92, 93, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -384,11 +416,13 @@ Object { }, }, "name": "I", + "optional": false, "range": Array [ 123, 124, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -405,6 +439,7 @@ Object { 124, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -424,6 +459,7 @@ Object { "superClass": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -435,14 +471,17 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 109, 110, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -454,11 +493,13 @@ Object { }, }, "name": "M", + "optional": false, "range": Array [ 102, 103, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -513,9 +554,12 @@ Object { "type": "TSTypeParameterInstantiation", }, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -534,7 +578,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -546,12 +593,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 136, 137, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 11, @@ -567,7 +617,9 @@ Object { 141, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "body": Object { @@ -588,7 +640,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -600,11 +655,13 @@ Object { }, }, "name": "I", + "optional": false, "range": Array [ 152, 153, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -621,9 +678,12 @@ Object { 157, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -635,11 +695,13 @@ Object { }, }, "name": "Constructor", + "optional": false, "range": Array [ 163, 174, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -671,6 +733,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -682,12 +745,15 @@ Object { }, }, "name": "args", + "optional": false, "range": Array [ 188, 192, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -698,6 +764,7 @@ Object { "line": 9, }, }, + "optional": false, "range": Array [ 185, 199, @@ -754,6 +821,7 @@ Object { "type": "TSArrayType", }, }, + "value": undefined, }, ], "range": Array [ @@ -793,6 +861,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -804,16 +873,19 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 204, 205, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, "type": "TSConstructorType", + "typeParameters": undefined, }, "typeParameters": Object { "loc": Object { @@ -842,6 +914,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -853,11 +926,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 175, 176, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot index 1fd54885c28..6841a4cb34f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +20,13 @@ Object { }, }, "name": "computed1", + "optional": false, "range": Array [ 6, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -80,7 +85,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -92,11 +99,13 @@ Object { }, }, "name": "computed2", + "optional": false, "range": Array [ 32, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -134,6 +143,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -154,7 +164,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -166,11 +178,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 58, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -187,6 +201,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -198,11 +213,13 @@ Object { }, }, "name": "member", + "optional": false, "range": Array [ 68, 74, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -216,6 +233,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 68, 84, @@ -245,6 +263,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -256,11 +275,13 @@ Object { }, }, "name": "member2", + "optional": false, "range": Array [ 88, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -274,6 +295,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 88, 106, @@ -324,6 +346,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -342,11 +365,15 @@ Object { "type": "VariableDeclaration", }, Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -358,11 +385,13 @@ Object { }, }, "name": "computed1", + "optional": false, "range": Array [ 124, 133, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -383,9 +412,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -404,12 +435,17 @@ Object { 135, 138, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -421,11 +457,13 @@ Object { }, }, "name": "computed2", + "optional": false, "range": Array [ 142, 151, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -446,6 +484,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -466,6 +505,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -484,11 +524,15 @@ Object { 153, 158, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -527,9 +571,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -548,11 +594,15 @@ Object { 166, 169, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -591,6 +641,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -611,6 +662,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -629,11 +681,15 @@ Object { 176, 181, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -672,9 +728,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -693,11 +751,15 @@ Object { 198, 201, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -736,6 +798,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -756,6 +819,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -774,11 +838,15 @@ Object { 217, 222, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "computed": false, "loc": Object { @@ -792,6 +860,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -803,14 +872,17 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 227, 230, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -822,11 +894,13 @@ Object { }, }, "name": "member", + "optional": false, "range": Array [ 231, 237, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 227, @@ -853,6 +927,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -873,6 +948,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -891,11 +967,15 @@ Object { 239, 244, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "computed": false, "loc": Object { @@ -909,6 +989,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -920,14 +1001,17 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 249, 252, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -939,11 +1023,13 @@ Object { }, }, "name": "member2", + "optional": false, "range": Array [ 253, 260, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 249, @@ -970,9 +1056,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -991,14 +1079,19 @@ Object { 262, 265, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -1010,11 +1103,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 269, 270, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1032,6 +1127,7 @@ Object { 272, ], "type": "CallExpression", + "typeParameters": undefined, }, "kind": "method", "loc": Object { @@ -1052,6 +1148,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -1072,6 +1169,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -1090,7 +1188,9 @@ Object { 274, 279, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -1110,7 +1210,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -1122,12 +1225,15 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 117, 118, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -1143,7 +1249,9 @@ Object { 281, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot index 13e6452c859..4fece8014eb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot @@ -4,12 +4,15 @@ exports[`typescript basics class-with-optional-computed-property.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "private", "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -45,10 +48,12 @@ Object { 14, 43, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -60,11 +65,13 @@ Object { }, }, "name": "undefined", + "optional": false, "range": Array [ 33, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -84,7 +91,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -96,12 +106,15 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -117,7 +130,9 @@ Object { 45, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot index 5ad7ce5d913..1b5fc09b085 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-optional-methods.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -45,9 +51,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -66,12 +74,17 @@ Object { 18, 21, ], + "returnType": undefined, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -83,11 +96,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -108,9 +123,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -164,12 +181,15 @@ Object { }, }, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "private", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -181,11 +201,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 50, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -206,9 +228,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -262,6 +286,7 @@ Object { }, }, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -281,7 +306,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -293,12 +321,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -314,7 +345,9 @@ Object { 67, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot index 048f000b9e2..8c685b95703 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -18,11 +20,13 @@ Object { }, }, "name": "computed", + "optional": false, "range": Array [ 6, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -80,7 +85,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -92,11 +99,13 @@ Object { }, }, "name": "computed2", + "optional": false, "range": Array [ 31, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -134,6 +143,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -152,12 +162,17 @@ Object { "type": "VariableDeclaration", }, Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -169,11 +184,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 65, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -191,15 +208,20 @@ Object { 65, 70, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -211,11 +233,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 73, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -233,7 +257,7 @@ Object { 73, 87, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -276,7 +300,10 @@ Object { "accessibility": "private", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -288,11 +315,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 98, 101, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -310,7 +339,7 @@ Object { 90, 112, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -350,9 +379,13 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -364,11 +397,13 @@ Object { }, }, "name": "computed", + "optional": false, "range": Array [ 116, 124, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -386,14 +421,18 @@ Object { 115, 127, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -429,14 +468,18 @@ Object { 130, 143, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -472,15 +515,20 @@ Object { 146, 151, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -492,11 +540,13 @@ Object { }, }, "name": "computed2", + "optional": false, "range": Array [ 155, 164, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -514,7 +564,7 @@ Object { 154, 175, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -554,8 +604,11 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -591,7 +644,7 @@ Object { 178, 200, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -631,8 +684,11 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": true, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -668,7 +724,7 @@ Object { 203, 216, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -724,7 +780,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -736,12 +795,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 57, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -757,7 +819,9 @@ Object { 218, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot index c5fd8a1fd1a..531dcdad739 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot @@ -4,13 +4,17 @@ exports[`typescript basics class-with-optional-property-undefined.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "private", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -22,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -44,10 +50,12 @@ Object { 12, 37, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -59,11 +67,13 @@ Object { }, }, "name": "undefined", + "optional": false, "range": Array [ 27, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -83,7 +93,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -95,12 +108,15 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -116,7 +132,9 @@ Object { 39, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot index e600ab918a5..b33f6f43641 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-override-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "show", + "optional": false, "range": Array [ 62, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": true, "range": Array [ 53, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,7 +91,9 @@ Object { 66, 87, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -102,7 +113,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -114,12 +128,15 @@ Object { }, }, "name": "SpecializedComponent", + "optional": false, "range": Array [ 6, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -135,6 +152,7 @@ Object { 89, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -146,13 +164,17 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 35, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot index 49a33895f9d..5fc0b57cf81 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot @@ -4,12 +4,17 @@ exports[`typescript basics class-with-override-property.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -21,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 62, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,14 +44,16 @@ Object { "line": 2, }, }, + "optional": false, "override": true, "range": Array [ 53, 70, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -82,7 +91,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -94,12 +106,15 @@ Object { }, }, "name": "SpecializedComponent", + "optional": false, "range": Array [ 6, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -115,6 +130,7 @@ Object { 72, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -126,13 +142,17 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 35, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot index dfb9b9557cd..2ce16908067 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-private-optional-property.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -43,7 +47,7 @@ Object { 14, 29, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -83,8 +87,11 @@ Object { "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -119,7 +126,7 @@ Object { 32, 69, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -177,8 +184,11 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -213,9 +223,10 @@ Object { 72, 101, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -253,7 +264,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -265,12 +279,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -286,7 +303,9 @@ Object { 103, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot index 72e5749ba0f..c85ed787d6d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-private-parameter-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,7 +89,8 @@ Object { "params": Array [ Object { "accessibility": "private", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 39, @@ -91,8 +101,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -104,6 +115,7 @@ Object { }, }, "name": "firstName", + "optional": false, "range": Array [ 34, 51, @@ -148,13 +160,14 @@ Object { 26, 51, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 47, @@ -165,8 +178,9 @@ Object { "line": 3, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -178,6 +192,7 @@ Object { }, }, "name": "lastName", + "optional": false, "range": Array [ 84, 100, @@ -223,12 +238,13 @@ Object { 100, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 38, @@ -239,9 +255,11 @@ Object { "line": 4, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -253,6 +271,7 @@ Object { }, }, "name": "age", + "optional": false, "range": Array [ 124, 135, @@ -303,6 +322,7 @@ Object { "line": 4, }, }, + "optional": false, "range": Array [ 124, 140, @@ -327,18 +347,20 @@ Object { "value": 30, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 116, 140, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 55, @@ -349,9 +371,11 @@ Object { "line": 5, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -363,6 +387,7 @@ Object { }, }, "name": "student", + "optional": false, "range": Array [ 173, 189, @@ -413,6 +438,7 @@ Object { "line": 5, }, }, + "optional": false, "range": Array [ 173, 197, @@ -437,13 +463,14 @@ Object { "value": false, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 156, 197, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, ], @@ -451,7 +478,9 @@ Object { 25, 201, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -471,7 +500,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -483,12 +515,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -504,7 +539,9 @@ Object { 203, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot index 1705e340f45..1e0af20bcff 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot @@ -4,12 +4,17 @@ exports[`typescript basics class-with-property-function.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -21,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 55, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -112,6 +120,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, }, "value": Object { @@ -188,12 +197,17 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -205,11 +219,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 58, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -221,12 +237,13 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 58, 83, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -266,6 +283,7 @@ Object { "value": Object { "async": false, "body": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -277,11 +295,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 78, 82, ], "type": "Identifier", + "typeAnnotation": undefined, }, "expression": true, "generator": false, @@ -301,7 +321,9 @@ Object { 72, 82, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -321,7 +343,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -333,12 +358,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -354,7 +382,9 @@ Object { 85, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot index a2238f57f0d..5c627f37a7f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot @@ -4,12 +4,17 @@ exports[`typescript basics class-with-property-values.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -21,11 +26,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,14 +44,16 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 20, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -66,9 +75,13 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -80,11 +93,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -96,14 +111,16 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 23, 30, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -124,9 +141,13 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -138,11 +159,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 33, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -154,14 +177,16 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 33, 40, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "elements": Array [], "loc": Object { @@ -182,9 +207,13 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -196,11 +225,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 43, 44, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -212,14 +243,16 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 43, 50, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -241,9 +274,13 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -255,11 +292,13 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 53, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -271,14 +310,16 @@ Object { "line": 6, }, }, + "optional": false, "override": false, "range": Array [ 53, 80, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "arguments": Array [ Object { @@ -357,6 +398,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -368,11 +410,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 61, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -389,6 +433,7 @@ Object { 79, ], "type": "NewExpression", + "typeParameters": undefined, }, }, ], @@ -408,7 +453,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -420,12 +468,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -441,7 +492,9 @@ Object { 82, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot index 7e87ef2df91..58e981f6516 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-protected-parameter-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,7 +89,8 @@ Object { "params": Array [ Object { "accessibility": "protected", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 41, @@ -91,8 +101,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -104,6 +115,7 @@ Object { }, }, "name": "firstName", + "optional": false, "range": Array [ 36, 53, @@ -148,13 +160,14 @@ Object { 26, 53, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "protected", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 49, @@ -165,8 +178,9 @@ Object { "line": 3, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 49, @@ -178,6 +192,7 @@ Object { }, }, "name": "lastName", + "optional": false, "range": Array [ 88, 104, @@ -223,12 +238,13 @@ Object { 104, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "protected", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 40, @@ -239,9 +255,11 @@ Object { "line": 4, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -253,6 +271,7 @@ Object { }, }, "name": "age", + "optional": false, "range": Array [ 130, 141, @@ -303,6 +322,7 @@ Object { "line": 4, }, }, + "optional": false, "range": Array [ 130, 146, @@ -327,18 +347,20 @@ Object { "value": 30, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 120, 146, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "protected", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 57, @@ -349,9 +371,11 @@ Object { "line": 5, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 49, @@ -363,6 +387,7 @@ Object { }, }, "name": "student", + "optional": false, "range": Array [ 181, 197, @@ -413,6 +438,7 @@ Object { "line": 5, }, }, + "optional": false, "range": Array [ 181, 205, @@ -437,13 +463,14 @@ Object { "value": false, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 162, 205, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, ], @@ -451,7 +478,9 @@ Object { 25, 209, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -471,7 +500,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -483,12 +515,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -504,7 +539,9 @@ Object { 211, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot index 363608735e5..cdc4474637f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-public-parameter-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,7 +89,8 @@ Object { "params": Array [ Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 38, @@ -91,8 +101,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -104,6 +115,7 @@ Object { }, }, "name": "firstName", + "optional": false, "range": Array [ 33, 50, @@ -148,13 +160,14 @@ Object { 26, 50, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 46, @@ -165,8 +178,9 @@ Object { "line": 3, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -178,6 +192,7 @@ Object { }, }, "name": "lastName", + "optional": false, "range": Array [ 82, 98, @@ -223,12 +238,13 @@ Object { 98, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 37, @@ -239,9 +255,11 @@ Object { "line": 4, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -253,6 +271,7 @@ Object { }, }, "name": "age", + "optional": false, "range": Array [ 121, 132, @@ -303,6 +322,7 @@ Object { "line": 4, }, }, + "optional": false, "range": Array [ 121, 137, @@ -327,18 +347,20 @@ Object { "value": 30, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 114, 137, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 54, @@ -349,9 +371,11 @@ Object { "line": 5, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -363,6 +387,7 @@ Object { }, }, "name": "student", + "optional": false, "range": Array [ 169, 185, @@ -413,6 +438,7 @@ Object { "line": 5, }, }, + "optional": false, "range": Array [ 169, 193, @@ -437,13 +463,14 @@ Object { "value": false, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 153, 193, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, ], @@ -451,7 +478,9 @@ Object { 25, 197, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -471,7 +500,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -483,12 +515,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -504,7 +539,9 @@ Object { 199, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot index 225de104f5e..af0bb502f9a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-readonly-parameter-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,7 +89,8 @@ Object { "params": Array [ Object { "accessibility": undefined, - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 40, @@ -91,8 +101,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -104,6 +115,7 @@ Object { }, }, "name": "firstName", + "optional": false, "range": Array [ 35, 52, @@ -149,12 +161,13 @@ Object { 52, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": undefined, - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 49, @@ -165,9 +178,11 @@ Object { "line": 3, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -179,6 +194,7 @@ Object { }, }, "name": "lastName", + "optional": false, "range": Array [ 77, 93, @@ -229,6 +245,7 @@ Object { "line": 3, }, }, + "optional": false, "range": Array [ 77, 103, @@ -253,13 +270,14 @@ Object { "value": "Smith", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, "range": Array [ 68, 103, ], "readonly": true, - "static": undefined, + "static": false, "type": "TSParameterProperty", }, ], @@ -267,7 +285,9 @@ Object { 25, 107, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -287,7 +307,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -299,12 +322,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -320,7 +346,9 @@ Object { 109, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot index c3fc1acb2af..e1cb3027f48 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot @@ -4,13 +4,17 @@ exports[`typescript basics class-with-readonly-property.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "public", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -22,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,6 +44,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 16, @@ -46,6 +53,7 @@ Object { "readonly": true, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -83,7 +91,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -95,12 +106,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -116,7 +130,9 @@ Object { 49, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot index 9287f9c1d21..3967ac7a6c0 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics class-with-static-parameter-properties.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 16, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 16, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,7 +89,8 @@ Object { "params": Array [ Object { "accessibility": undefined, - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 32, @@ -91,8 +101,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -104,6 +115,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 35, 44, @@ -148,7 +160,7 @@ Object { 28, 44, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "TSParameterProperty", }, @@ -157,7 +169,9 @@ Object { 27, 54, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -177,7 +191,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -189,12 +206,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -210,7 +230,9 @@ Object { 56, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 f119f99cc7c..b98697aa054 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 @@ -4,10 +4,13 @@ exports[`typescript basics class-with-two-methods-computed-constructor.src 1`] = Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -38,6 +41,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, @@ -45,6 +49,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -65,6 +70,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -145,6 +151,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -156,11 +163,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -179,7 +188,9 @@ Object { }, }, Object { + "accessibility": undefined, "computed": true, + "decorators": Array [], "key": Object { "loc": Object { "end": Object { @@ -210,6 +221,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 48, @@ -217,6 +229,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -237,6 +250,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -317,6 +331,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -328,11 +343,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 64, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -367,7 +384,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -379,12 +399,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -400,7 +423,9 @@ Object { 84, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { 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 b062afebf38..579cd3a2533 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 @@ -4,6 +4,7 @@ exports[`typescript basics class-with-type-parameter-default.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -55,6 +62,7 @@ Object { 23, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -87,6 +95,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -98,11 +107,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -118,6 +129,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -129,11 +141,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 f11826fd104..ee2092ed3b5 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 @@ -4,6 +4,7 @@ exports[`typescript basics class-with-type-parameter-underscore.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -34,12 +38,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 15, @@ -55,6 +62,7 @@ Object { 15, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -83,6 +91,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -94,11 +103,13 @@ Object { }, }, "name": "__P", + "optional": false, "range": Array [ 8, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 8403e95ce8c..d59966b5d8d 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 @@ -4,6 +4,7 @@ exports[`typescript basics class-with-type-parameter.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -55,6 +62,7 @@ Object { 17, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -83,6 +91,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -94,11 +103,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot index 1f6a79883fb..d4d46d09c25 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -18,11 +20,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -76,6 +80,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -87,11 +92,13 @@ Object { }, }, "name": "const", + "optional": false, "range": Array [ 27, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -113,6 +120,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -133,7 +141,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -145,11 +155,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 67, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -241,6 +253,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -252,11 +265,13 @@ Object { }, }, "name": "const", + "optional": false, "range": Array [ 83, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -278,6 +293,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -298,7 +314,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -310,11 +328,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 132, 133, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -332,6 +352,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -343,11 +364,13 @@ Object { }, }, "name": "text", + "optional": false, "range": Array [ 138, 142, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -361,6 +384,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 138, 151, @@ -426,6 +450,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -437,11 +462,13 @@ Object { }, }, "name": "const", + "optional": false, "range": Array [ 157, 162, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -463,6 +490,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -483,7 +511,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -495,11 +525,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 182, 183, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -553,6 +585,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -564,11 +597,13 @@ Object { }, }, "name": "const", + "optional": false, "range": Array [ 187, 192, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -590,6 +625,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -610,7 +646,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -622,11 +660,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 230, 231, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -718,6 +758,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -729,11 +770,13 @@ Object { }, }, "name": "const", + "optional": false, "range": Array [ 235, 240, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -755,6 +798,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -775,7 +819,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -787,11 +833,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 293, 294, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "expression": Object { @@ -809,6 +857,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -820,11 +869,13 @@ Object { }, }, "name": "text", + "optional": false, "range": Array [ 306, 310, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -838,6 +889,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 306, 319, @@ -903,6 +955,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -914,11 +967,13 @@ Object { }, }, "name": "const", + "optional": false, "range": Array [ 298, 303, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -940,6 +995,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot index 557a16875cb..678e60a81ea 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot @@ -5,7 +5,9 @@ Object { "body": Array [ Object { "const": true, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -17,11 +19,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -35,7 +39,9 @@ Object { }, "members": Array [ Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -47,11 +53,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "initializer": Object { "loc": Object { @@ -89,7 +97,9 @@ Object { "type": "TSEnumMember", }, Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -101,12 +111,15 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot index 134b75cb5fe..b9f3475ad29 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics declare-class-with-optional-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 24, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -45,9 +51,11 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": null, + "declare": false, "expression": false, "generator": false, "id": null, @@ -101,6 +109,7 @@ Object { }, }, "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -121,7 +130,9 @@ Object { "type": "ClassBody", }, "declare": true, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -133,12 +144,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -154,7 +168,9 @@ Object { 38, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot index 5dd945c2feb..43bbd37c22b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot @@ -10,6 +10,7 @@ Object { "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -21,11 +22,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +42,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -50,6 +54,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 21, 32, @@ -130,6 +135,7 @@ Object { }, }, "type": "TSDeclareFunction", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot index 463b82dd00e..ec9805e06bb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics destructuring-assignment-nested.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 81, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -31,11 +35,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 3, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 79, @@ -56,7 +63,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 73, @@ -67,10 +76,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -82,11 +93,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -100,6 +113,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 10, 71, @@ -107,7 +121,9 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 66, @@ -118,10 +134,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -133,11 +151,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -151,6 +171,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 17, 64, @@ -158,9 +179,12 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -172,14 +196,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -190,10 +218,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -205,11 +235,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 28, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -223,6 +255,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 28, 42, @@ -230,9 +263,12 @@ Object { "shorthand": false, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -244,11 +280,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 34, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -261,11 +299,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 33, 36, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -277,6 +317,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 33, 42, @@ -320,6 +361,7 @@ Object { "type": "ArrayExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -328,6 +370,7 @@ Object { 44, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -339,6 +382,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 26, 58, @@ -358,6 +402,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 52, @@ -369,11 +414,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 49, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -387,6 +434,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 49, 57, @@ -440,6 +488,7 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -452,11 +501,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 22, 59, ], "type": "ArrayPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -468,6 +519,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 22, 64, @@ -491,6 +543,7 @@ Object { "type": "ArrayExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -499,6 +552,7 @@ Object { 66, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -510,6 +564,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 71, @@ -533,6 +588,7 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -541,6 +597,7 @@ Object { 73, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -552,6 +609,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 8, 79, @@ -575,6 +633,7 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -583,6 +642,7 @@ Object { 81, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -614,6 +674,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 89, @@ -625,11 +686,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 86, 89, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -643,6 +706,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 86, 126, @@ -664,6 +728,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 96, @@ -675,11 +740,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 93, 96, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -693,6 +760,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 93, 124, @@ -714,6 +782,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 103, @@ -725,11 +794,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 100, 103, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -743,6 +814,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 100, 122, @@ -785,6 +857,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 114, @@ -796,11 +869,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 111, 114, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -814,6 +889,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 111, 119, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot index 097fd53b02a..cee6ef4b9dc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics destructuring-assignment-object.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -31,11 +35,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 3, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 11, @@ -56,7 +63,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -68,11 +77,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 3, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -84,6 +95,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 3, 11, @@ -107,6 +119,7 @@ Object { "type": "ObjectExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -115,6 +128,7 @@ Object { 13, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -132,6 +146,7 @@ Object { 19, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -143,11 +158,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot index 5686bf812d4..826e02c3a47 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -37,11 +39,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,7 +59,9 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -66,10 +72,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -81,11 +89,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -99,6 +109,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 15, 23, @@ -106,7 +117,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -118,11 +131,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -134,6 +149,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 15, 23, @@ -157,6 +173,7 @@ Object { "type": "ArrayExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -165,6 +182,7 @@ Object { 25, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -176,11 +194,13 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 13, 31, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -192,20 +212,25 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 28, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 37, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot index cb281c20b00..88aa09dc410 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics destructuring-assignment.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -31,11 +35,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 3, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 11, @@ -56,7 +63,9 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -68,11 +77,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 3, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -84,6 +95,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 3, 11, @@ -107,6 +119,7 @@ Object { "type": "ArrayExpression", }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, }, ], @@ -115,6 +128,7 @@ Object { 13, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -132,6 +146,7 @@ Object { 19, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -143,11 +158,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot index 2a65e53254b..2eb6fecd04b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot @@ -46,7 +46,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -58,11 +60,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -100,6 +104,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -118,6 +123,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -170,7 +176,10 @@ Object { ], "type": "TSModuleBlock", }, + "declare": false, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -182,13 +191,14 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "module", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot index 28b76d987c4..ca335e16698 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot @@ -46,7 +46,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -58,11 +60,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -100,6 +104,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -118,6 +123,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -170,7 +176,10 @@ Object { ], "type": "TSModuleBlock", }, + "declare": false, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -182,13 +191,14 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "namespace", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot index 90a43822eca..3df92c53024 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics dynamic-import-with-import-assertions.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "attributes": Object { "loc": Object { @@ -20,6 +21,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -31,11 +33,13 @@ Object { }, }, "name": "assert", + "optional": false, "range": Array [ 16, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +53,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 16, 40, @@ -70,6 +75,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -81,11 +87,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 26, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -99,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 26, 38, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot index 3fd3efea845..c0a1ebe8438 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot @@ -7,6 +7,7 @@ Object { "assertions": Array [ Object { "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -18,11 +19,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 29, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot index 4e698b3cee4..762447f79f6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -16,11 +17,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot index b7a53c7e727..e32083119d8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -16,11 +17,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot index 2067ecc1432..6b8c64ddcae 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot @@ -9,6 +9,7 @@ Object { "const": true, "declare": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -20,11 +21,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,7 +41,9 @@ Object { }, "members": Array [ Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -50,11 +55,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 36, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "initializer": Object { "loc": Object { @@ -92,7 +99,9 @@ Object { "type": "TSEnumMember", }, Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -104,12 +113,15 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 49, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot index 3c0702b063a..01a33397137 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot @@ -6,8 +6,10 @@ Object { Object { "assertions": Array [], "declaration": Object { + "const": false, "declare": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -19,11 +21,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,7 +41,9 @@ Object { }, "members": Array [ Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -49,11 +55,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 30, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "initializer": Object { "loc": Object { @@ -91,7 +99,9 @@ Object { "type": "TSEnumMember", }, Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -103,12 +113,15 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 43, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, 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 b8c81c94fc2..5ffbcb3602d 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 @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +24,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -39,6 +43,7 @@ Object { 28, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -67,6 +72,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -78,11 +84,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 5c8f0f1bd13..da88cdb4430 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 @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +24,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": null, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -39,6 +43,7 @@ Object { 31, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -67,6 +72,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -78,11 +84,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -106,6 +114,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -117,11 +126,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot index d7778592270..62ff5e71b50 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot @@ -8,8 +8,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -21,11 +24,13 @@ Object { }, }, "name": "method1", + "optional": false, "range": Array [ 31, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,11 +43,13 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [], "range": Array [ 31, 47, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -77,7 +84,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -96,7 +105,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -108,11 +120,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -129,6 +143,7 @@ Object { 49, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { 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 150f857526d..d907ed8d584 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 @@ -6,6 +6,7 @@ Object { Object { "assertions": Array [], "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -24,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -36,12 +40,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -57,6 +64,7 @@ Object { 24, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -85,6 +93,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -96,11 +105,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 74f2566093d..0aa3eb70821 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 @@ -6,6 +6,7 @@ Object { Object { "assertions": Array [], "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -24,7 +25,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -36,12 +40,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -57,6 +64,7 @@ Object { 27, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", "typeParameters": Object { "loc": Object { @@ -85,6 +93,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -96,11 +105,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -124,6 +135,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -135,11 +147,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot index c9ec2237d16..6f44a4685e2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot @@ -6,7 +6,10 @@ Object { Object { "assertions": Array [], "declaration": Object { + "const": false, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +21,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,6 +61,7 @@ Object { "type": "Literal", "value": 1, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot index f4a66e995eb..45f6879979c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot @@ -6,7 +6,10 @@ Object { Object { "assertions": Array [], "declaration": Object { + "const": false, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +21,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,6 +61,7 @@ Object { "type": "Literal", "value": "baz", }, + "initializer": undefined, "loc": Object { "end": Object { "column": 11, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot index 557d76a3736..15f9ab6adcb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot @@ -6,7 +6,10 @@ Object { Object { "assertions": Array [], "declaration": Object { + "const": false, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +21,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,6 +43,7 @@ Object { Object { "computed": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -49,12 +55,15 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot index 9b4477c59c9..2ba70f6dbfc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot @@ -6,7 +6,10 @@ Object { Object { "assertions": Array [], "declaration": Object { + "const": false, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +21,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -36,7 +41,9 @@ Object { }, "members": Array [ Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -48,11 +55,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "initializer": Object { "loc": Object { @@ -90,7 +99,9 @@ Object { "type": "TSEnumMember", }, Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -102,12 +113,15 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 35, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot index ba4a7e299ab..d2e375c0d85 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot @@ -7,6 +7,7 @@ Object { "assertions": Array [], "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,11 +19,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot index aacc96aed24..6ff8663ab0d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -37,11 +38,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -65,11 +69,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot index 1534942cd7c..bbc8ed36a35 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -55,11 +56,13 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -83,11 +87,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot index 8cf718151bc..cc28ae28863 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -55,11 +56,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -83,11 +87,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-star-from.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-star-from.src.ts.shot deleted file mode 100644 index 3bc0a74b5f7..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-star-from.src.ts.shot +++ /dev/null @@ -1,174 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript basics export-type-star-from.src 1`] = ` -Object { - "body": Array [ - Object { - "assertions": Array [], - "exportKind": "type", - "exported": null, - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 25, - ], - "source": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "raw": "'bar'", - "type": "Literal", - "value": "bar", - }, - "type": "ExportAllDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 26, - ], - "sourceType": "module", - "tokens": Array [ - Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 1, - }, - "start": Object { - "column": 0, - "line": 1, - }, - }, - "range": Array [ - 0, - 6, - ], - "type": "Keyword", - "value": "export", - }, - Object { - "loc": Object { - "end": Object { - "column": 11, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 11, - ], - "type": "Identifier", - "value": "type", - }, - Object { - "loc": Object { - "end": Object { - "column": 13, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 13, - ], - "type": "Punctuator", - "value": "*", - }, - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "range": Array [ - 14, - 18, - ], - "type": "Identifier", - "value": "from", - }, - Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 24, - ], - "type": "String", - "value": "'bar'", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 1, - }, - "start": Object { - "column": 24, - "line": 1, - }, - }, - "range": Array [ - 24, - 25, - ], - "type": "Punctuator", - "value": ";", - }, - ], - "type": "Program", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot index ce9f65ed7a4..9d2e60e63f3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot @@ -26,6 +26,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -37,11 +38,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +57,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -65,11 +69,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot index be34e1cb111..0899fc9e971 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot @@ -7,6 +7,7 @@ Object { "assertions": Array [ Object { "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -18,11 +19,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 35, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -99,6 +102,7 @@ Object { Object { "exportKind": "value", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -110,11 +114,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -127,6 +133,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -138,11 +145,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 9, 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 9945853dea0..4aecf98d26d 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -30,6 +34,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -41,11 +46,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 45, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -80,6 +87,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -95,6 +103,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -106,6 +115,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 23, 32, @@ -151,6 +161,7 @@ Object { 10, 49, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -179,6 +190,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -190,11 +202,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -228,6 +242,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot index 9917e4422bd..c315d367f84 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -44,6 +48,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -97,6 +102,7 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -115,6 +121,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot index 56d78d267c6..0d2e375cd3e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot @@ -8,9 +8,11 @@ Object { "declaration": Object { "async": false, "body": undefined, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -22,11 +24,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -40,6 +44,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -51,6 +56,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 18, 27, @@ -131,6 +137,7 @@ Object { }, }, "type": "TSDeclareFunction", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { @@ -156,9 +163,11 @@ Object { "declaration": Object { "async": false, "body": undefined, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -170,11 +179,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 54, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -188,6 +199,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -199,6 +211,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 56, 65, @@ -279,6 +292,7 @@ Object { }, }, "type": "TSDeclareFunction", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { @@ -307,6 +321,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -318,11 +333,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 142, 143, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -357,9 +374,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -371,11 +390,13 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 92, 93, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -389,6 +410,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -400,6 +422,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 94, 112, @@ -552,6 +575,7 @@ Object { }, }, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot index f9be8cbae1b..9514f6b8a75 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot @@ -8,8 +8,10 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -21,11 +23,13 @@ Object { }, }, "name": "future", + "optional": false, "range": Array [ 40, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -76,9 +80,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -90,11 +96,13 @@ Object { }, }, "name": "hope", + "optional": false, "range": Array [ 15, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -108,6 +116,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -119,18 +128,22 @@ Object { }, }, "name": "future", + "optional": false, "range": Array [ 20, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 0, 49, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot index 8f837cf2e71..972236437d2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -80,11 +87,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 17, @@ -105,6 +115,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -116,16 +127,19 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -137,11 +151,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -155,6 +171,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 19, 22, @@ -162,6 +179,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -173,11 +191,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -215,10 +235,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -230,11 +252,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -251,8 +275,8 @@ Object { 26, 39, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -290,10 +314,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -305,11 +331,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 40, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -326,8 +354,8 @@ Object { 40, 44, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": undefined, }, @@ -345,7 +373,9 @@ Object { 0, 51, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot index 6ed5ad110b1..15aa7f496ed 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -37,11 +39,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -65,10 +70,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -80,11 +87,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -98,6 +107,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 14, 17, @@ -105,6 +115,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -116,16 +127,19 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -137,11 +151,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -155,6 +171,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 19, 22, @@ -162,6 +179,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -173,11 +191,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -215,10 +235,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -230,11 +252,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -246,13 +270,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 26, 38, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -290,10 +314,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -305,11 +331,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 39, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -321,13 +349,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 39, 42, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": undefined, }, @@ -345,7 +373,9 @@ Object { 0, 49, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 0bd43c2697c..57d31962b11 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 @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -37,11 +39,13 @@ Object { }, }, "name": "compare", + "optional": false, "range": Array [ 9, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 0, 35, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -86,6 +91,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -97,11 +103,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 114fd02b9e6..9f8c82cd7ce 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 @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -20,11 +21,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 47, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,9 +62,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -73,11 +78,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -91,6 +98,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -102,6 +110,7 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 25, 29, @@ -140,6 +149,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -151,11 +161,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -199,6 +211,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -210,11 +223,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -264,6 +279,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -275,11 +291,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 defa0485d9e..3105d1e9135 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 @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -20,11 +21,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 36, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,9 +62,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -73,11 +78,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -91,6 +98,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -102,6 +110,7 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 14, 18, @@ -140,6 +149,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -151,11 +161,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -199,6 +211,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -210,11 +223,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -247,6 +262,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -258,11 +274,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot index 45304c8dd08..2c5e6ce2fea 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +21,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 89, 93, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,9 +62,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -73,11 +78,13 @@ Object { }, }, "name": "message", + "optional": false, "range": Array [ 9, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -91,6 +98,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -102,6 +110,7 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 17, 28, @@ -143,7 +152,9 @@ Object { }, }, Object { + "decorators": Array [], "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -155,6 +166,7 @@ Object { }, }, "name": "age", + "optional": false, "range": Array [ 30, 40, @@ -205,6 +217,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 30, 46, @@ -229,9 +242,11 @@ Object { "value": 100, }, "type": "AssignmentPattern", + "typeAnnotation": undefined, }, Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -243,12 +258,15 @@ Object { }, }, "name": "args", + "optional": false, "range": Array [ 51, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 69, @@ -259,6 +277,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 48, 69, @@ -297,6 +316,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 61, @@ -308,11 +328,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 56, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -352,6 +374,7 @@ Object { }, }, }, + "value": undefined, }, ], "range": Array [ @@ -393,6 +416,7 @@ Object { }, }, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot index 24cd796473e..844121df237 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot @@ -9,6 +9,7 @@ Object { "body": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +21,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 50, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -59,9 +62,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -73,11 +78,13 @@ Object { }, }, "name": "message", + "optional": false, "range": Array [ 9, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -91,6 +98,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -102,6 +110,7 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 17, 28, @@ -182,6 +191,7 @@ Object { }, }, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot index 48a95068a3c..807c5602ad2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "abc", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -78,6 +83,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -92,6 +98,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -103,14 +110,17 @@ Object { }, }, "name": "globalThis", + "optional": false, "range": Array [ 69, 79, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -122,11 +132,13 @@ Object { }, }, "name": "abc", + "optional": false, "range": Array [ 80, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 69, @@ -189,7 +201,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -201,11 +215,13 @@ Object { }, }, "name": "answer", + "optional": false, "range": Array [ 97, 103, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -243,6 +259,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -261,6 +278,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -275,6 +293,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -286,14 +305,17 @@ Object { }, }, "name": "globalThis", + "optional": false, "range": Array [ 178, 188, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -305,11 +327,13 @@ Object { }, }, "name": "answer", + "optional": false, "range": Array [ 189, 195, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 178, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot index 99c14c70ea9..9a2a76e6233 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -16,11 +17,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "importKind": "value", "isExport": false, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot index 1e5a56be081..5528903ee6b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -16,11 +17,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "importKind": "type", "isExport": false, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot index ac4b760010d..d8e642b0590 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -16,11 +17,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "importKind": "value", "isExport": true, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot index f5763d6fe01..e209bf0617d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -16,11 +17,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "importKind": "type", "isExport": true, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot index 37de8a2ca76..37f4d356ac2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 12, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot index 1f9269046ed..bf0a2bf3d21 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -63,11 +64,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 62, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 62, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot index 89218380012..e5b0845f2ad 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 12, @@ -78,6 +81,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -89,11 +93,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -106,6 +112,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -117,11 +124,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 19, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot index ce54edc62e8..9ad033cfb1c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -54,11 +55,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -82,11 +86,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot index 0d81408bdd0..07ec1f7ce92 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -54,11 +55,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -82,11 +86,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 14, @@ -97,6 +103,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -108,11 +115,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -125,6 +134,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -136,11 +146,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 19, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot index 4e1f626f6ec..49e8bfdb5e4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot @@ -52,6 +52,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -63,11 +64,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 12, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot index b726332faac..7da9b8788b7 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot @@ -7,6 +7,7 @@ Object { "assertions": Array [ Object { "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -18,11 +19,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 31, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -107,6 +110,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -118,11 +122,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 7, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 7, 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 deleted file mode 100644 index 92bc144ccc0..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/instantiation-expression.src.ts.shot +++ /dev/null @@ -1,2330 +0,0 @@ -// 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-extends-multiple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends-multiple.src.ts.shot index 57a08508e2b..b501a9707cd 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends-multiple.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends-multiple.src.ts.shot @@ -22,9 +22,11 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -36,11 +38,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -57,9 +61,11 @@ Object { 25, ], "type": "TSInterfaceHeritage", + "typeParameters": undefined, }, Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -71,11 +77,13 @@ Object { }, }, "name": "Baz", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -92,9 +100,11 @@ Object { 29, ], "type": "TSInterfaceHeritage", + "typeParameters": undefined, }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -106,11 +116,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -127,6 +139,7 @@ Object { 34, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot index ee56b199c2d..8524d88e020 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot @@ -22,9 +22,11 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -36,11 +38,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -57,9 +61,11 @@ Object { 25, ], "type": "TSInterfaceHeritage", + "typeParameters": undefined, }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -71,11 +77,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -92,6 +100,7 @@ Object { 30, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 f1d74ce8b70..b508cbae137 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 @@ -22,7 +22,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -34,11 +37,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -82,6 +87,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -93,11 +99,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 8c772c7947a..8bc85fa7687 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 @@ -7,10 +7,12 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -22,11 +24,13 @@ Object { }, }, "name": "baa", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,13 +42,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 20, 32, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -82,10 +86,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -97,11 +103,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 37, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -118,8 +126,8 @@ Object { 37, 50, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -157,10 +165,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": true, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -172,11 +182,13 @@ Object { }, }, "name": "bax", + "optional": false, "range": Array [ 56, 59, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -188,13 +200,13 @@ Object { "line": 4, }, }, - "optional": undefined, + "optional": false, "range": Array [ 55, 69, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -232,10 +244,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": true, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -247,11 +261,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 75, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -268,8 +284,8 @@ Object { 74, 89, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -307,6 +323,8 @@ Object { }, }, Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 26, @@ -319,6 +337,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -330,6 +349,7 @@ Object { }, }, "name": "eee", + "optional": false, "range": Array [ 95, 106, @@ -375,6 +395,8 @@ Object { 94, 116, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -412,8 +434,11 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -425,11 +450,13 @@ Object { }, }, "name": "doo", + "optional": false, "range": Array [ 121, 124, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -442,11 +469,13 @@ Object { "line": 7, }, }, + "optional": false, "params": Array [], "range": Array [ 121, 133, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -481,11 +510,16 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -497,11 +531,13 @@ Object { }, }, "name": "coo", + "optional": false, "range": Array [ 138, 141, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -517,6 +553,7 @@ Object { "optional": true, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -528,13 +565,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 143, 144, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -546,13 +586,16 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 146, 147, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -564,17 +607,20 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 149, 150, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 138, 158, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -609,11 +655,16 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": true, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -625,11 +676,13 @@ Object { }, }, "name": "loo", + "optional": false, "range": Array [ 164, 167, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -645,6 +698,7 @@ Object { "optional": true, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -656,13 +710,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 170, 171, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -674,13 +731,16 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 173, 174, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -692,17 +752,20 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 176, 177, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 163, 185, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -737,11 +800,16 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -753,11 +821,13 @@ Object { }, }, "name": "boo", + "optional": false, "range": Array [ 190, 193, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -770,8 +840,10 @@ Object { "line": 10, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -783,13 +855,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 197, 198, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -801,13 +876,16 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 200, 201, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -819,17 +897,20 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 203, 204, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 190, 212, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -864,6 +945,7 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", "typeParameters": Object { "loc": Object { @@ -892,6 +974,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -903,11 +986,13 @@ Object { }, }, "name": "J", + "optional": false, "range": Array [ 194, 195, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -937,6 +1022,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -948,13 +1034,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 222, 223, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -972,6 +1061,7 @@ Object { 227, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ @@ -1013,6 +1103,7 @@ Object { }, }, "type": "TSConstructSignatureDeclaration", + "typeParameters": undefined, }, Object { "loc": Object { @@ -1027,6 +1118,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -1038,13 +1130,16 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 250, 251, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -1062,6 +1157,7 @@ Object { 255, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ @@ -1130,6 +1226,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -1141,11 +1238,13 @@ Object { }, }, "name": "F", + "optional": false, "range": Array [ 247, 248, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1179,7 +1278,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -1191,11 +1293,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1212,6 +1316,7 @@ Object { 267, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot index 75ad28bb759..c6e9757b2fa 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot @@ -20,7 +20,8 @@ Object { "params": Array [ Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 17, @@ -31,8 +32,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -44,23 +46,26 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 33, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 26, 34, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "private", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 28, @@ -71,8 +76,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -84,18 +90,20 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 44, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 36, 45, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, ], @@ -103,7 +111,9 @@ Object { 21, 47, ], + "returnType": undefined, "type": "TSConstructSignatureDeclaration", + "typeParameters": undefined, }, ], "loc": Object { @@ -122,7 +132,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -134,11 +147,13 @@ Object { }, }, "name": "Test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -155,6 +170,7 @@ Object { 49, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot index ea099804bde..1ee22831720 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot @@ -22,6 +22,7 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { @@ -37,6 +38,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -48,14 +50,17 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -67,11 +72,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 22, @@ -94,9 +101,11 @@ Object { 29, ], "type": "TSInterfaceHeritage", + "typeParameters": undefined, }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -108,11 +117,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -129,6 +140,7 @@ Object { 33, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 5ac92facdff..e0e55ee3945 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 @@ -22,9 +22,11 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -36,11 +38,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 25, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -86,6 +90,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -97,11 +102,13 @@ Object { }, }, "name": "J", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -115,6 +122,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -126,11 +134,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -174,6 +184,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -185,11 +196,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 3c1d50e28b2..bb5079d781d 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 @@ -22,7 +22,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -34,11 +37,13 @@ Object { }, }, "name": "Test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -82,6 +87,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -93,11 +99,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot index c4299c7644c..7a4cb6b571d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +23,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 76, 79, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 6, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -50,18 +57,24 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 80, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 76, 85, ], + "readonly": false, + "returnType": undefined, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -80,7 +93,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -92,11 +108,13 @@ Object { }, }, "name": "Test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,6 +131,7 @@ Object { 87, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ 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 fdc32c02335..e82eb8b7cb6 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 @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -20,11 +23,13 @@ Object { }, }, "name": "h", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -50,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 21, 32, @@ -95,6 +103,7 @@ Object { 19, 40, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -129,11 +138,16 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -145,11 +159,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 43, 44, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -162,8 +178,10 @@ Object { "line": 3, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -175,6 +193,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 48, 54, @@ -213,6 +232,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -224,11 +244,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 53, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -239,6 +261,7 @@ Object { 43, 59, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -272,6 +295,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -283,15 +307,18 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 57, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, + "static": false, "type": "TSMethodSignature", "typeParameters": Object { "loc": Object { @@ -320,6 +347,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -331,11 +359,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 45, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -369,7 +399,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -381,11 +414,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -402,6 +437,7 @@ Object { 61, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot index f0d57792836..1a1c822d9b4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot @@ -7,10 +7,12 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -22,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -43,16 +47,18 @@ Object { 21, 26, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": undefined, }, Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -64,11 +70,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 31, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -85,8 +93,8 @@ Object { 31, 44, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -124,8 +132,11 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -137,11 +148,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 49, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -157,6 +170,7 @@ Object { "optional": true, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -168,13 +182,16 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 54, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -228,6 +245,7 @@ Object { }, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -245,13 +263,18 @@ Object { 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 49, 79, ], + "readonly": false, + "returnType": undefined, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -270,7 +293,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -282,11 +308,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -303,6 +331,7 @@ Object { 81, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot index 402d5df0570..81c669ee9db 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot @@ -7,10 +7,12 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -22,11 +24,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,13 +42,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 21, 25, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": undefined, }, @@ -65,7 +69,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -77,11 +84,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 10, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -98,6 +107,7 @@ Object { 27, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 5b885e496df..039aea820b3 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 @@ -4,7 +4,9 @@ exports[`typescript basics intrinsic-keyword.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -16,11 +18,13 @@ Object { }, }, "name": "Uppercase", + "optional": false, "range": Array [ 5, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -97,6 +101,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -108,11 +113,13 @@ Object { }, }, "name": "S", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -130,7 +137,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -142,11 +151,13 @@ Object { }, }, "name": "Lowercase", + "optional": false, "range": Array [ 51, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -223,6 +234,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -234,11 +246,13 @@ Object { }, }, "name": "S", + "optional": false, "range": Array [ 61, 62, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -256,7 +270,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -268,11 +284,13 @@ Object { }, }, "name": "Capitalize", + "optional": false, "range": Array [ 97, 107, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -349,6 +367,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -360,11 +379,13 @@ Object { }, }, "name": "S", + "optional": false, "range": Array [ 108, 109, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -382,7 +403,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -394,11 +417,13 @@ Object { }, }, "name": "Uncapitalize", + "optional": false, "range": Array [ 144, 156, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -475,6 +500,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -486,11 +512,13 @@ Object { }, }, "name": "S", + "optional": false, "range": Array [ 157, 158, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot index 485bdef6f27..6f229cb965a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics keyof-operator.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -16,11 +18,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +75,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -82,15 +87,18 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot index 1092be3a13f..fddca0c561d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot @@ -8,7 +8,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -20,11 +22,13 @@ Object { }, }, "name": "abstract", + "optional": false, "range": Array [ 10, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -62,6 +66,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -82,7 +87,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -94,11 +101,13 @@ Object { }, }, "name": "as", + "optional": false, "range": Array [ 32, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -136,6 +145,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -156,7 +166,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -168,11 +180,13 @@ Object { }, }, "name": "asserts", + "optional": false, "range": Array [ 48, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -210,6 +224,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -230,7 +245,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -242,11 +259,13 @@ Object { }, }, "name": "any", + "optional": false, "range": Array [ 69, 72, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -284,6 +303,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -304,7 +324,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -316,11 +338,13 @@ Object { }, }, "name": "async", + "optional": false, "range": Array [ 86, 91, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -358,6 +382,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -378,7 +403,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -390,11 +417,13 @@ Object { }, }, "name": "await", + "optional": false, "range": Array [ 105, 110, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -432,6 +461,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -452,7 +482,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -464,11 +496,13 @@ Object { }, }, "name": "boolean", + "optional": false, "range": Array [ 124, 131, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -506,6 +540,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -526,7 +561,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -538,11 +575,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 145, 156, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -580,6 +619,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -600,7 +640,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -612,11 +654,13 @@ Object { }, }, "name": "declare", + "optional": false, "range": Array [ 170, 177, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -654,6 +698,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -674,7 +719,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -686,11 +733,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 191, 194, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -728,6 +777,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -748,7 +798,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -760,11 +812,13 @@ Object { }, }, "name": "infer", + "optional": false, "range": Array [ 208, 213, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -802,6 +856,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -822,7 +877,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -834,11 +891,13 @@ Object { }, }, "name": "is", + "optional": false, "range": Array [ 227, 229, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -876,6 +935,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -896,7 +956,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -908,11 +970,13 @@ Object { }, }, "name": "keyof", + "optional": false, "range": Array [ 243, 248, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -950,6 +1014,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -970,7 +1035,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -982,11 +1049,13 @@ Object { }, }, "name": "module", + "optional": false, "range": Array [ 262, 268, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1024,6 +1093,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1044,7 +1114,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -1056,11 +1128,13 @@ Object { }, }, "name": "namespace", + "optional": false, "range": Array [ 282, 291, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1098,6 +1172,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1118,7 +1193,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -1130,11 +1207,13 @@ Object { }, }, "name": "never", + "optional": false, "range": Array [ 305, 310, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1172,6 +1251,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1192,7 +1272,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -1204,11 +1286,13 @@ Object { }, }, "name": "readonly", + "optional": false, "range": Array [ 324, 332, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1246,6 +1330,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1266,7 +1351,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -1278,11 +1365,13 @@ Object { }, }, "name": "require", + "optional": false, "range": Array [ 346, 353, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1320,6 +1409,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1340,7 +1430,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1352,11 +1444,13 @@ Object { }, }, "name": "number", + "optional": false, "range": Array [ 367, 373, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1394,6 +1488,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1414,7 +1509,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1426,11 +1523,13 @@ Object { }, }, "name": "object", + "optional": false, "range": Array [ 387, 393, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1468,6 +1567,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1488,7 +1588,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -1500,11 +1602,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 407, 410, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1542,6 +1646,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1562,7 +1667,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1574,11 +1681,13 @@ Object { }, }, "name": "string", + "optional": false, "range": Array [ 424, 430, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1616,6 +1725,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1636,7 +1746,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1648,11 +1760,13 @@ Object { }, }, "name": "symbol", + "optional": false, "range": Array [ 444, 450, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1690,6 +1804,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1710,7 +1825,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -1722,11 +1839,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 464, 468, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1764,6 +1883,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1784,7 +1904,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -1796,11 +1918,13 @@ Object { }, }, "name": "undefined", + "optional": false, "range": Array [ 482, 491, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1838,6 +1962,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1858,7 +1983,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1870,11 +1997,13 @@ Object { }, }, "name": "unique", + "optional": false, "range": Array [ 505, 511, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1912,6 +2041,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -1932,7 +2062,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -1944,11 +2076,13 @@ Object { }, }, "name": "unknown", + "optional": false, "range": Array [ 525, 532, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -1986,6 +2120,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -2006,7 +2141,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -2018,11 +2155,13 @@ Object { }, }, "name": "from", + "optional": false, "range": Array [ 546, 550, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -2060,6 +2199,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -2080,7 +2220,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -2092,11 +2234,13 @@ Object { }, }, "name": "global", + "optional": false, "range": Array [ 564, 570, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -2134,6 +2278,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -2154,7 +2299,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -2166,11 +2313,13 @@ Object { }, }, "name": "bigint", + "optional": false, "range": Array [ 584, 590, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -2208,6 +2357,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -2228,7 +2378,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -2240,11 +2392,13 @@ Object { }, }, "name": "of", + "optional": false, "range": Array [ 604, 606, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -2282,6 +2436,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -2356,6 +2511,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -2367,11 +2523,13 @@ Object { }, }, "name": "abstract", + "optional": false, "range": Array [ 626, 634, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2384,6 +2542,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -2395,11 +2554,13 @@ Object { }, }, "name": "abstract", + "optional": false, "range": Array [ 626, 634, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 626, @@ -2410,6 +2571,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -2421,11 +2583,13 @@ Object { }, }, "name": "as", + "optional": false, "range": Array [ 638, 640, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2438,6 +2602,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -2449,11 +2614,13 @@ Object { }, }, "name": "as", + "optional": false, "range": Array [ 638, 640, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 638, @@ -2464,6 +2631,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -2475,11 +2643,13 @@ Object { }, }, "name": "asserts", + "optional": false, "range": Array [ 644, 651, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2492,6 +2662,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -2503,11 +2674,13 @@ Object { }, }, "name": "asserts", + "optional": false, "range": Array [ 644, 651, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 644, @@ -2518,6 +2691,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -2529,11 +2703,13 @@ Object { }, }, "name": "any", + "optional": false, "range": Array [ 655, 658, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2546,6 +2722,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -2557,11 +2734,13 @@ Object { }, }, "name": "any", + "optional": false, "range": Array [ 655, 658, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 655, @@ -2572,6 +2751,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -2583,11 +2763,13 @@ Object { }, }, "name": "async", + "optional": false, "range": Array [ 662, 667, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2600,6 +2782,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -2611,11 +2794,13 @@ Object { }, }, "name": "async", + "optional": false, "range": Array [ 662, 667, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 662, @@ -2626,6 +2811,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -2637,11 +2823,13 @@ Object { }, }, "name": "await", + "optional": false, "range": Array [ 671, 676, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2654,6 +2842,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -2665,11 +2854,13 @@ Object { }, }, "name": "await", + "optional": false, "range": Array [ 671, 676, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 671, @@ -2680,6 +2871,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -2691,11 +2883,13 @@ Object { }, }, "name": "boolean", + "optional": false, "range": Array [ 680, 687, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2708,6 +2902,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -2719,11 +2914,13 @@ Object { }, }, "name": "boolean", + "optional": false, "range": Array [ 680, 687, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 680, @@ -2734,6 +2931,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -2745,11 +2943,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 691, 702, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2762,6 +2962,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -2773,11 +2974,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 691, 702, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 691, @@ -2788,6 +2991,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -2799,11 +3003,13 @@ Object { }, }, "name": "declare", + "optional": false, "range": Array [ 706, 713, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2816,6 +3022,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -2827,11 +3034,13 @@ Object { }, }, "name": "declare", + "optional": false, "range": Array [ 706, 713, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 706, @@ -2842,6 +3051,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -2853,11 +3063,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 717, 720, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2870,6 +3082,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -2881,11 +3094,13 @@ Object { }, }, "name": "get", + "optional": false, "range": Array [ 717, 720, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 717, @@ -2896,6 +3111,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -2907,11 +3123,13 @@ Object { }, }, "name": "infer", + "optional": false, "range": Array [ 724, 729, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2924,6 +3142,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -2935,11 +3154,13 @@ Object { }, }, "name": "infer", + "optional": false, "range": Array [ 724, 729, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 724, @@ -2950,6 +3171,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -2961,11 +3183,13 @@ Object { }, }, "name": "is", + "optional": false, "range": Array [ 733, 735, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -2978,6 +3202,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -2989,11 +3214,13 @@ Object { }, }, "name": "is", + "optional": false, "range": Array [ 733, 735, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 733, @@ -3004,6 +3231,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -3015,11 +3243,13 @@ Object { }, }, "name": "keyof", + "optional": false, "range": Array [ 739, 744, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3032,6 +3262,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -3043,11 +3274,13 @@ Object { }, }, "name": "keyof", + "optional": false, "range": Array [ 739, 744, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 739, @@ -3058,6 +3291,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3069,11 +3303,13 @@ Object { }, }, "name": "module", + "optional": false, "range": Array [ 748, 754, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3086,6 +3322,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3097,11 +3334,13 @@ Object { }, }, "name": "module", + "optional": false, "range": Array [ 748, 754, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 748, @@ -3112,6 +3351,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -3123,11 +3363,13 @@ Object { }, }, "name": "namespace", + "optional": false, "range": Array [ 758, 767, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3140,6 +3382,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -3151,11 +3394,13 @@ Object { }, }, "name": "namespace", + "optional": false, "range": Array [ 758, 767, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 758, @@ -3166,6 +3411,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -3177,11 +3423,13 @@ Object { }, }, "name": "never", + "optional": false, "range": Array [ 771, 776, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3194,6 +3442,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -3205,11 +3454,13 @@ Object { }, }, "name": "never", + "optional": false, "range": Array [ 771, 776, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 771, @@ -3220,6 +3471,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -3231,11 +3483,13 @@ Object { }, }, "name": "readonly", + "optional": false, "range": Array [ 780, 788, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3248,6 +3502,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -3259,11 +3514,13 @@ Object { }, }, "name": "readonly", + "optional": false, "range": Array [ 780, 788, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 780, @@ -3274,6 +3531,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -3285,11 +3543,13 @@ Object { }, }, "name": "require", + "optional": false, "range": Array [ 792, 799, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3302,6 +3562,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -3313,11 +3574,13 @@ Object { }, }, "name": "require", + "optional": false, "range": Array [ 792, 799, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 792, @@ -3328,6 +3591,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3339,11 +3603,13 @@ Object { }, }, "name": "number", + "optional": false, "range": Array [ 803, 809, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3356,6 +3622,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3367,11 +3634,13 @@ Object { }, }, "name": "number", + "optional": false, "range": Array [ 803, 809, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 803, @@ -3382,6 +3651,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3393,11 +3663,13 @@ Object { }, }, "name": "object", + "optional": false, "range": Array [ 813, 819, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3410,6 +3682,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3421,11 +3694,13 @@ Object { }, }, "name": "object", + "optional": false, "range": Array [ 813, 819, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 813, @@ -3436,6 +3711,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -3447,11 +3723,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 823, 826, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3464,6 +3742,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -3475,11 +3754,13 @@ Object { }, }, "name": "set", + "optional": false, "range": Array [ 823, 826, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 823, @@ -3490,6 +3771,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3501,11 +3783,13 @@ Object { }, }, "name": "string", + "optional": false, "range": Array [ 830, 836, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3518,6 +3802,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3529,11 +3814,13 @@ Object { }, }, "name": "string", + "optional": false, "range": Array [ 830, 836, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 830, @@ -3544,6 +3831,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3555,11 +3843,13 @@ Object { }, }, "name": "symbol", + "optional": false, "range": Array [ 840, 846, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3572,6 +3862,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3583,11 +3874,13 @@ Object { }, }, "name": "symbol", + "optional": false, "range": Array [ 840, 846, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 840, @@ -3598,6 +3891,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -3609,11 +3903,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 850, 854, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3626,6 +3922,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -3637,11 +3934,13 @@ Object { }, }, "name": "type", + "optional": false, "range": Array [ 850, 854, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 850, @@ -3652,6 +3951,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -3663,11 +3963,13 @@ Object { }, }, "name": "undefined", + "optional": false, "range": Array [ 858, 867, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3680,6 +3982,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -3691,11 +3994,13 @@ Object { }, }, "name": "undefined", + "optional": false, "range": Array [ 858, 867, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 858, @@ -3706,6 +4011,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3717,11 +4023,13 @@ Object { }, }, "name": "unique", + "optional": false, "range": Array [ 871, 877, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3734,6 +4042,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3745,11 +4054,13 @@ Object { }, }, "name": "unique", + "optional": false, "range": Array [ 871, 877, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 871, @@ -3760,6 +4071,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -3771,11 +4083,13 @@ Object { }, }, "name": "unknown", + "optional": false, "range": Array [ 881, 888, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3788,6 +4102,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -3799,11 +4114,13 @@ Object { }, }, "name": "unknown", + "optional": false, "range": Array [ 881, 888, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 881, @@ -3814,6 +4131,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -3825,11 +4143,13 @@ Object { }, }, "name": "from", + "optional": false, "range": Array [ 892, 896, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3842,6 +4162,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -3853,11 +4174,13 @@ Object { }, }, "name": "from", + "optional": false, "range": Array [ 892, 896, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 892, @@ -3868,6 +4191,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3879,11 +4203,13 @@ Object { }, }, "name": "global", + "optional": false, "range": Array [ 900, 906, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3896,6 +4222,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3907,11 +4234,13 @@ Object { }, }, "name": "global", + "optional": false, "range": Array [ 900, 906, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 900, @@ -3922,6 +4251,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3933,11 +4263,13 @@ Object { }, }, "name": "bigint", + "optional": false, "range": Array [ 910, 916, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -3950,6 +4282,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -3961,11 +4294,13 @@ Object { }, }, "name": "bigint", + "optional": false, "range": Array [ 910, 916, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 910, @@ -3976,6 +4311,7 @@ Object { Object { "importKind": "value", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -3987,11 +4323,13 @@ Object { }, }, "name": "of", + "optional": false, "range": Array [ 920, 922, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -4004,6 +4342,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -4015,11 +4354,13 @@ Object { }, }, "name": "of", + "optional": false, "range": Array [ 920, 922, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 920, @@ -4049,7 +4390,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -4061,11 +4405,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 957, 958, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -4082,13 +4428,18 @@ Object { 961, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -4100,11 +4451,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 994, 995, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -4117,6 +4470,7 @@ Object { "line": 71, }, }, + "optional": false, "override": false, "range": Array [ 987, @@ -4124,6 +4478,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -4144,6 +4499,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -4162,13 +4518,17 @@ Object { 995, 1000, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "private", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -4180,11 +4540,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 1011, 1012, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -4197,6 +4559,7 @@ Object { "line": 72, }, }, + "optional": false, "override": false, "range": Array [ 1003, @@ -4204,6 +4567,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -4224,6 +4588,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -4242,13 +4607,17 @@ Object { 1012, 1017, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "public", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -4260,11 +4629,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 1027, 1028, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -4277,6 +4648,7 @@ Object { "line": 73, }, }, + "optional": false, "override": false, "range": Array [ 1020, @@ -4284,6 +4656,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -4304,6 +4677,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -4322,13 +4696,17 @@ Object { 1028, 1033, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "protected", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -4340,11 +4718,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 1047, 1048, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -4357,6 +4737,7 @@ Object { "line": 74, }, }, + "optional": false, "override": false, "range": Array [ 1036, @@ -4364,6 +4745,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -4371,7 +4753,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -4383,11 +4767,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 1061, 1062, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "argument": null, @@ -4425,6 +4811,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -4459,6 +4846,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": true, "id": null, @@ -4477,7 +4865,9 @@ Object { 1048, 1075, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -4497,7 +4887,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -4509,15 +4902,18 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 968, 969, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -4529,11 +4925,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 981, 982, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -4550,6 +4948,7 @@ Object { 982, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -4567,7 +4966,9 @@ Object { 1077, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot index 3419aedd5b9..57445e1681a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -18,6 +20,7 @@ Object { }, }, "name": "nestedArray", + "optional": false, "range": Array [ 4, 44, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -67,11 +71,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 17, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -102,6 +108,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -113,11 +120,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 23, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -148,6 +157,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -159,11 +169,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 29, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -238,6 +250,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot index fd30d755822..6d84c412d33 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 15, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -67,11 +71,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -130,6 +136,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -148,6 +155,7 @@ Object { "type": "VariableDeclaration", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -163,6 +171,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -174,14 +183,17 @@ Object { }, }, "name": "Observable", + "optional": false, "range": Array [ 17, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -193,11 +205,13 @@ Object { }, }, "name": "empty", + "optional": false, "range": Array [ 28, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 17, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot index 760fb5ce957..3326909cd75 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -38,6 +42,7 @@ Object { }, }, "meta": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -49,13 +54,16 @@ Object { }, }, "name": "new", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -67,11 +75,13 @@ Object { }, }, "name": "target", + "optional": false, "range": Array [ 20, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 16, @@ -97,7 +107,9 @@ Object { 10, 26, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -116,6 +128,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot index 3abb8a86713..6d2102b8086 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot @@ -8,9 +8,11 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -22,14 +24,17 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 56, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -41,11 +46,13 @@ Object { }, }, "name": "validateEntity", + "optional": false, "range": Array [ 41, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -63,6 +70,7 @@ Object { 58, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -83,7 +91,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -95,11 +105,13 @@ Object { }, }, "name": "s", + "optional": false, "range": Array [ 68, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "computed": false, @@ -115,6 +127,7 @@ Object { }, "object": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -126,11 +139,13 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 72, 73, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -150,6 +165,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -161,11 +177,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 75, 79, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 72, @@ -190,6 +208,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -224,9 +243,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -238,11 +259,13 @@ Object { }, }, "name": "processEntity", + "optional": false, "range": Array [ 9, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -256,6 +279,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -306,6 +330,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -317,11 +342,13 @@ Object { }, }, "name": "Entity", + "optional": false, "range": Array [ 27, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -332,7 +359,9 @@ Object { 0, 82, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot index c3db06cc0aa..38a5dee4492 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 11, @@ -76,6 +79,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -96,7 +100,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -108,6 +114,7 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 17, 29, @@ -166,6 +173,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot index e2c86b20997..6d53507132c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot @@ -10,7 +10,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -22,14 +24,17 @@ Object { }, }, "name": "len", + "optional": false, "range": Array [ 52, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -41,11 +46,13 @@ Object { }, }, "name": "s", + "optional": false, "range": Array [ 59, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -100,6 +107,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -134,9 +142,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -148,11 +158,13 @@ Object { }, }, "name": "processNullishCoalesce", + "optional": false, "range": Array [ 9, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -166,6 +178,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -223,7 +236,9 @@ Object { 0, 70, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot index 4373bd4bb67..d8889f407b3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics object-with-escaped-properties.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -49,6 +50,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 3, 13, @@ -99,6 +101,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -144,6 +147,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 22, 31, @@ -170,6 +174,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -188,7 +193,9 @@ Object { 26, 31, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -215,6 +222,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -260,6 +268,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 40, 52, @@ -310,11 +319,15 @@ Object { "type": "ExpressionStatement", }, Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -344,14 +357,16 @@ Object { "line": 7, }, }, + "optional": false, "override": false, "range": Array [ 68, 79, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "loc": Object { "end": Object { @@ -389,7 +404,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -401,12 +419,15 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 64, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 23, @@ -422,7 +443,9 @@ Object { 81, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 bafe11a59fd..83b6c9fc83d 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -69,6 +73,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 16, 61, @@ -132,6 +137,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -212,6 +218,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -223,11 +230,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -248,6 +257,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -259,11 +269,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 65, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -277,6 +289,7 @@ Object { }, }, "method": true, + "optional": false, "range": Array [ 65, 100, @@ -340,6 +353,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -420,6 +434,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -431,11 +446,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 69, 70, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -456,6 +473,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -467,11 +485,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 108, 109, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -485,6 +505,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 104, 138, @@ -548,6 +569,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -601,11 +623,13 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -617,11 +641,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 146, 147, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -635,6 +661,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 142, 172, @@ -661,6 +688,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -676,6 +704,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -687,6 +716,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 148, 157, @@ -767,6 +797,7 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -793,6 +824,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot index cc4eb5c81ff..95c6baf56da 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -25,6 +26,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -36,14 +38,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 40, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -55,11 +60,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 45, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 40, @@ -99,6 +106,7 @@ Object { 51, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -133,6 +141,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -162,6 +171,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -173,14 +183,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 55, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -192,11 +205,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 60, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 55, @@ -222,6 +237,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -233,11 +249,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 65, 70, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 55, @@ -261,6 +279,7 @@ Object { 72, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -295,6 +314,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -312,6 +332,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -323,14 +344,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 77, 80, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -342,11 +366,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 82, 85, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 77, @@ -402,6 +428,7 @@ Object { 89, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -420,6 +447,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -449,6 +477,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -460,14 +489,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 94, 97, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -479,11 +511,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 99, 102, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 94, @@ -525,6 +559,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -536,11 +571,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 105, 110, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 93, @@ -564,6 +601,7 @@ Object { 112, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -582,6 +620,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -599,6 +638,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -610,14 +650,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 117, 120, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -629,11 +672,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 122, 125, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 117, @@ -689,6 +734,7 @@ Object { 129, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -707,6 +753,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -736,6 +783,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -747,14 +795,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 134, 137, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -766,11 +817,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 139, 142, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 134, @@ -812,6 +865,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -823,11 +877,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 145, 150, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 133, @@ -851,6 +907,7 @@ Object { 152, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -885,9 +942,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -899,11 +958,13 @@ Object { }, }, "name": "processOptional", + "optional": false, "range": Array [ 9, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -917,6 +978,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -974,7 +1036,9 @@ Object { 0, 155, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot index d53caae0ce8..389216de89c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -24,6 +25,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -35,14 +37,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 51, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -54,11 +59,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 56, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 51, @@ -82,6 +89,7 @@ Object { 60, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -116,6 +124,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -144,6 +153,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -155,14 +165,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 66, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -174,11 +187,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 71, 74, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 66, @@ -204,6 +219,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -215,11 +231,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 76, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 65, @@ -243,6 +261,7 @@ Object { 80, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -261,6 +280,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -289,6 +309,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -300,14 +321,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 85, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -319,11 +343,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 89, 92, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 85, @@ -333,6 +359,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -344,11 +371,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 94, 96, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 85, @@ -372,6 +401,7 @@ Object { 98, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -406,6 +436,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -446,6 +477,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -457,14 +489,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 104, 107, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -476,11 +511,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 108, 111, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 104, @@ -490,6 +527,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -501,11 +539,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 113, 118, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 104, @@ -531,6 +571,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -542,11 +583,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 120, 122, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 103, @@ -570,6 +613,7 @@ Object { 124, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -588,6 +632,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -628,6 +673,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -639,14 +685,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 129, 132, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -658,11 +707,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 133, 136, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 129, @@ -672,6 +723,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -683,11 +735,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 138, 143, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 129, @@ -697,6 +751,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -708,11 +763,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 145, 147, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 129, @@ -736,6 +793,7 @@ Object { 149, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -770,10 +828,12 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -785,11 +845,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 156, 159, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -807,6 +869,7 @@ Object { 163, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -841,12 +904,14 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -858,11 +923,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 169, 172, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -880,6 +947,7 @@ Object { 176, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -913,6 +981,7 @@ Object { 179, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -931,6 +1000,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -938,6 +1008,7 @@ Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -949,11 +1020,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 184, 187, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -971,6 +1044,7 @@ Object { 191, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -1004,6 +1078,7 @@ Object { 196, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -1038,6 +1113,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -1054,6 +1130,7 @@ Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -1065,11 +1142,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 202, 205, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1087,6 +1166,7 @@ Object { 209, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -1106,6 +1186,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -1117,11 +1198,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 211, 214, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 201, @@ -1162,9 +1245,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -1176,11 +1261,13 @@ Object { }, }, "name": "processOptionalCallParens", + "optional": false, "range": Array [ 9, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1194,6 +1281,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -1251,7 +1339,9 @@ Object { 0, 217, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot index a1bc055e666..64eafcb5be3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -24,6 +25,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -35,14 +37,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 44, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -54,11 +59,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 49, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 44, @@ -82,6 +89,7 @@ Object { 53, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -116,6 +124,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -144,6 +153,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -155,14 +165,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 57, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -174,11 +187,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 62, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 57, @@ -188,6 +203,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -199,11 +215,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 66, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 57, @@ -227,6 +245,7 @@ Object { 70, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -261,6 +280,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -289,6 +309,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -300,14 +321,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 74, 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -319,11 +343,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 78, 81, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 74, @@ -333,6 +359,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -344,11 +371,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 83, 85, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 74, @@ -372,6 +401,7 @@ Object { 87, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -406,6 +436,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -446,6 +477,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -457,14 +489,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 91, 94, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -476,11 +511,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 95, 98, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 91, @@ -490,6 +527,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -501,11 +539,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 100, 105, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 91, @@ -515,6 +555,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -526,11 +567,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 106, 108, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 91, @@ -554,6 +597,7 @@ Object { 110, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -588,6 +632,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -628,6 +673,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -639,14 +685,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 114, 117, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -658,11 +707,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 118, 121, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 114, @@ -672,6 +723,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -683,11 +735,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 123, 128, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 114, @@ -697,6 +751,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -708,11 +763,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 130, 132, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 114, @@ -736,6 +793,7 @@ Object { 134, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -770,10 +828,12 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -785,11 +845,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 139, 142, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -807,6 +869,7 @@ Object { 146, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -841,12 +904,14 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], "callee": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -858,11 +923,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 150, 153, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -880,6 +947,7 @@ Object { 157, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -897,6 +965,7 @@ Object { 159, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -931,12 +1000,14 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], "callee": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -948,11 +1019,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 163, 166, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -970,6 +1043,7 @@ Object { 170, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -987,6 +1061,7 @@ Object { 174, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -1021,6 +1096,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -1037,6 +1113,7 @@ Object { "object": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -1048,11 +1125,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 179, 182, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1070,9 +1149,11 @@ Object { 186, ], "type": "CallExpression", + "typeParameters": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -1084,11 +1165,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 187, 190, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 179, @@ -1145,9 +1228,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -1159,11 +1244,13 @@ Object { }, }, "name": "processOptionalCall", + "optional": false, "range": Array [ 9, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1177,6 +1264,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -1234,7 +1322,9 @@ Object { 0, 193, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot index 6ea1b41480b..4cb40072283 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -35,6 +36,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -46,11 +48,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 40, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -96,6 +100,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -107,11 +112,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 54, 59, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 40, @@ -152,6 +159,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -179,6 +187,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -190,11 +199,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 64, 67, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -256,6 +267,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -267,11 +279,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 79, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 63, @@ -296,6 +310,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -323,6 +338,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -334,11 +350,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 89, 92, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -400,6 +418,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -411,11 +430,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 104, 109, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 88, @@ -440,6 +461,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -467,6 +489,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -478,14 +501,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 113, 116, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -497,11 +523,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 118, 121, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 113, @@ -584,6 +612,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": true, "loc": Object { @@ -611,6 +640,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -622,14 +652,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 136, 139, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -641,11 +674,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 141, 144, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 136, @@ -728,6 +763,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": true, "loc": Object { @@ -755,6 +791,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -766,14 +803,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 160, 163, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -785,11 +825,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 165, 168, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 160, @@ -888,9 +930,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -902,11 +946,13 @@ Object { }, }, "name": "processOptional", + "optional": false, "range": Array [ 9, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -920,6 +966,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -977,7 +1024,9 @@ Object { 0, 182, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot index bad9cf7b189..b9bcd42e586 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -22,6 +23,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -33,11 +35,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 54, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -98,6 +102,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": true, "loc": Object { @@ -124,6 +129,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -135,11 +141,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 68, 71, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -226,6 +234,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -252,6 +261,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -263,11 +273,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 85, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -354,6 +366,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": true, "loc": Object { @@ -392,6 +405,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -403,11 +417,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 102, 105, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -520,6 +536,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -558,6 +575,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -569,11 +587,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 122, 125, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -686,6 +706,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": true, "loc": Object { @@ -736,6 +757,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -747,11 +769,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 144, 147, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -906,9 +930,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -920,11 +946,13 @@ Object { }, }, "name": "processOptionalElementParens", + "optional": false, "range": Array [ 9, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -938,6 +966,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -995,7 +1024,9 @@ Object { 0, 167, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot index f2854d51f62..65a342a69b0 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -22,6 +23,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -33,11 +35,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -98,6 +102,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -124,6 +129,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -135,11 +141,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 59, 62, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { @@ -226,6 +234,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -252,6 +261,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -263,11 +273,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 74, 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -354,6 +366,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -380,6 +393,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -391,11 +405,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 89, 92, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -482,6 +498,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -520,6 +537,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -531,11 +549,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 104, 107, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -648,6 +668,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": true, @@ -686,6 +707,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -697,11 +719,13 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 122, 125, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -830,9 +854,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -844,11 +870,13 @@ Object { }, }, "name": "processOptionalElement", + "optional": false, "range": Array [ 9, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -862,6 +890,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -919,7 +948,9 @@ Object { 0, 141, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot index df6699c1555..8d488e0d54e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -35,6 +36,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -46,14 +48,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 40, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -65,11 +70,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 45, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 40, @@ -95,6 +102,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -106,11 +114,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 50, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 40, @@ -151,6 +161,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -178,6 +189,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -189,14 +201,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 60, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -208,11 +223,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 65, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 60, @@ -254,6 +271,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -265,11 +283,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 71, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 59, @@ -294,6 +314,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -321,6 +342,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -332,14 +354,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 81, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -351,11 +376,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 86, 89, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 81, @@ -397,6 +424,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -408,11 +436,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 92, 97, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 80, @@ -453,9 +483,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -467,11 +499,13 @@ Object { }, }, "name": "processOptional", + "optional": false, "range": Array [ 9, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -485,6 +519,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -542,7 +577,9 @@ Object { 0, 100, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot index 25d8a21935a..abb458ba8fb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -22,6 +23,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -33,14 +35,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 47, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -52,11 +57,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 52, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 47, @@ -97,6 +104,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -123,6 +131,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -134,14 +143,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 61, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -153,11 +165,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 66, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 61, @@ -183,6 +197,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -194,11 +209,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 71, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 60, @@ -223,6 +240,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -249,6 +267,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -260,14 +279,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 81, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -279,11 +301,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 85, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 81, @@ -293,6 +317,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -304,11 +329,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 90, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 81, @@ -349,6 +376,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -387,6 +415,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -398,14 +427,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 101, 104, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -417,11 +449,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 105, 108, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 101, @@ -431,6 +465,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -442,11 +477,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 110, 115, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 101, @@ -472,6 +509,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -483,11 +521,13 @@ Object { }, }, "name": "four", + "optional": false, "range": Array [ 117, 121, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 100, @@ -512,6 +552,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -550,6 +591,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -561,14 +603,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 126, 129, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -580,11 +625,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 130, 133, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 126, @@ -594,6 +641,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -605,11 +653,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 135, 140, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 126, @@ -619,6 +669,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -630,11 +681,13 @@ Object { }, }, "name": "four", + "optional": false, "range": Array [ 142, 146, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 126, @@ -675,6 +728,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "computed": false, "loc": Object { @@ -725,6 +779,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -736,14 +791,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 152, 155, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -755,11 +813,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 156, 159, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 152, @@ -769,6 +829,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -780,11 +841,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 161, 166, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 152, @@ -794,6 +857,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -805,11 +869,13 @@ Object { }, }, "name": "four", + "optional": false, "range": Array [ 168, 172, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 152, @@ -835,6 +901,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -846,11 +913,13 @@ Object { }, }, "name": "five", + "optional": false, "range": Array [ 174, 178, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 151, @@ -891,9 +960,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -905,11 +976,13 @@ Object { }, }, "name": "processOptionalParens", + "optional": false, "range": Array [ 9, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -923,6 +996,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -980,7 +1054,9 @@ Object { 0, 181, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot index cce78104239..d6a2c2b96e8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -22,6 +23,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -33,14 +35,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 40, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -52,11 +57,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 45, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 40, @@ -97,6 +104,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -123,6 +131,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -134,14 +143,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 52, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -153,11 +165,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 57, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 52, @@ -167,6 +181,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -178,11 +193,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 61, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 52, @@ -223,6 +240,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -249,6 +267,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -260,14 +279,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 70, 73, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -279,11 +301,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 74, 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 70, @@ -293,6 +317,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -304,11 +329,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 79, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 70, @@ -349,6 +376,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -387,6 +415,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -398,14 +427,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 88, 91, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -417,11 +449,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 92, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 88, @@ -431,6 +465,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -442,11 +477,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 97, 102, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 88, @@ -456,6 +493,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -467,11 +505,13 @@ Object { }, }, "name": "four", + "optional": false, "range": Array [ 103, 107, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 88, @@ -512,6 +552,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "computed": false, @@ -550,6 +591,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -561,14 +603,17 @@ Object { }, }, "name": "one", + "optional": false, "range": Array [ 111, 114, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -580,11 +625,13 @@ Object { }, }, "name": "two", + "optional": false, "range": Array [ 115, 118, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 111, @@ -594,6 +641,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -605,11 +653,13 @@ Object { }, }, "name": "three", + "optional": false, "range": Array [ 120, 125, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 111, @@ -619,6 +669,7 @@ Object { }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -630,11 +681,13 @@ Object { }, }, "name": "four", + "optional": false, "range": Array [ 127, 131, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 111, @@ -691,9 +744,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -705,11 +760,13 @@ Object { }, }, "name": "processOptional", + "optional": false, "range": Array [ 9, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -723,6 +780,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -780,7 +838,9 @@ Object { 0, 134, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot index 9ede9a55aa6..9f49ca46bda 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript basics parenthesized-use-strict.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot index 27c37ed05ad..384a9c4db14 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics private-fields-in-in.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { "loc": Object { "end": Object { @@ -37,19 +41,24 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 21, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -61,11 +70,13 @@ Object { }, }, "name": "method", + "optional": false, "range": Array [ 24, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -78,6 +89,7 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 24, @@ -85,6 +97,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -125,6 +138,7 @@ Object { 62, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -136,11 +150,13 @@ Object { }, }, "name": "arg", + "optional": false, "range": Array [ 59, 62, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, @@ -177,6 +193,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -192,6 +209,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -203,18 +221,22 @@ Object { }, }, "name": "arg", + "optional": false, "range": Array [ 31, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 30, 67, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -234,7 +256,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -246,12 +271,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -267,7 +295,9 @@ Object { 69, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot index a56985c288d..b7b7d0a21c1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -23,6 +24,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -34,14 +36,17 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 45, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -53,11 +58,13 @@ Object { }, }, "name": "slice", + "optional": false, "range": Array [ 49, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 45, @@ -81,6 +88,7 @@ Object { 56, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -99,6 +107,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -134,6 +143,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -145,14 +155,17 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 75, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -164,11 +177,13 @@ Object { }, }, "name": "push", + "optional": false, "range": Array [ 79, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 75, @@ -192,6 +207,7 @@ Object { 93, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -226,9 +242,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -240,11 +258,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -258,6 +278,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -269,6 +290,7 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 13, 39, @@ -307,6 +329,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -318,11 +341,13 @@ Object { }, }, "name": "ReadonlyArray", + "optional": false, "range": Array [ 18, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -368,13 +393,16 @@ Object { 0, 106, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -390,6 +418,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -401,14 +430,17 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 149, 152, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -420,11 +452,13 @@ Object { }, }, "name": "slice", + "optional": false, "range": Array [ 153, 158, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 149, @@ -448,6 +482,7 @@ Object { 160, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -466,6 +501,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -501,6 +537,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -512,14 +549,17 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 179, 182, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -531,11 +571,13 @@ Object { }, }, "name": "push", + "optional": false, "range": Array [ 183, 187, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 179, @@ -559,6 +601,7 @@ Object { 197, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -593,9 +636,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -607,11 +652,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 117, 120, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -625,6 +672,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -636,6 +684,7 @@ Object { }, }, "name": "arr", + "optional": false, "range": Array [ 121, 143, @@ -716,7 +765,9 @@ Object { 108, 210, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot index f0dbe06b538..789b6940c55 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [ Object { @@ -23,6 +24,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -34,11 +36,13 @@ Object { }, }, "name": "pair", + "optional": false, "range": Array [ 62, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -80,6 +84,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -91,14 +96,17 @@ Object { }, }, "name": "console", + "optional": false, "range": Array [ 50, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -110,11 +118,13 @@ Object { }, }, "name": "log", + "optional": false, "range": Array [ 58, 61, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 50, @@ -138,6 +148,7 @@ Object { 70, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -156,6 +167,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "left": Object { "computed": true, @@ -170,6 +182,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -181,11 +194,13 @@ Object { }, }, "name": "pair", + "optional": false, "range": Array [ 84, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { @@ -282,9 +297,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -296,11 +313,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 9, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -314,6 +333,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -325,6 +345,7 @@ Object { }, }, "name": "pair", + "optional": false, "range": Array [ 13, 44, @@ -424,7 +445,9 @@ Object { 0, 118, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot index 9cc451138fd..6783484bf3e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics short-circuiting-assignment-and-and.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +43,7 @@ Object { 7, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -50,11 +55,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot index 714a7e449b2..5dabb523118 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics short-circuiting-assignment-or-or.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +43,7 @@ Object { 7, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -50,11 +55,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot index 25a13976648..d00f83597a6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript basics short-circuiting-assignment-question-question.src 1`] Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,6 +43,7 @@ Object { 7, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -50,11 +55,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot index fa61ef84dd9..60577d28b4a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -37,11 +39,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 9, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -66,6 +71,7 @@ Object { }, }, "name": "abc", + "optional": false, "range": Array [ 14, 38, @@ -104,6 +110,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -115,11 +122,13 @@ Object { }, }, "name": "Map", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -182,7 +191,9 @@ Object { 0, 42, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot index b845060344d..244d0052276 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "assertions": Array [], "declaration": Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -18,11 +20,13 @@ Object { }, }, "name": "TestCallback", + "optional": false, "range": Array [ 12, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -52,6 +56,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -63,6 +68,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 28, 37, @@ -143,7 +149,9 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, + "typeParameters": undefined, }, "exportKind": "type", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot index 352d429ffef..bce20128d3f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "assertions": Array [], "declaration": Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -18,11 +20,13 @@ Object { }, }, "name": "TestClassProps", + "optional": false, "range": Array [ 12, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -52,10 +56,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -67,11 +73,13 @@ Object { }, }, "name": "count", + "optional": false, "range": Array [ 35, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -83,13 +91,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 35, 48, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -133,6 +141,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, "exportKind": "type", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot index 189e76aa11a..f6aa2333339 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "assertions": Array [], "declaration": Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -18,11 +20,13 @@ Object { }, }, "name": "TestAlias", + "optional": false, "range": Array [ 12, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -92,6 +96,7 @@ Object { }, ], }, + "typeParameters": undefined, }, "exportKind": "type", "loc": Object { 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 d2c6248a377..b5e6bcb8d2a 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 @@ -4,7 +4,9 @@ exports[`typescript basics type-alias-declaration-with-constrained-type-paramete Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -16,11 +18,13 @@ Object { }, }, "name": "Result", + "optional": false, "range": Array [ 5, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +75,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -82,11 +87,13 @@ Object { }, }, "name": "Success", + "optional": false, "range": Array [ 28, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -117,6 +124,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -128,11 +136,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 36, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -161,6 +171,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -172,11 +183,13 @@ Object { }, }, "name": "Failure", + "optional": false, "range": Array [ 41, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -226,6 +239,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -237,11 +251,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 169e2a2c6f6..d3804f1e937 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 @@ -4,7 +4,9 @@ exports[`typescript basics type-alias-declaration.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -16,11 +18,13 @@ Object { }, }, "name": "Result", + "optional": false, "range": Array [ 5, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +75,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -82,11 +87,13 @@ Object { }, }, "name": "Success", + "optional": false, "range": Array [ 17, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -117,6 +124,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -128,11 +136,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -161,6 +171,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -172,11 +183,13 @@ Object { }, }, "name": "Failure", + "optional": false, "range": Array [ 30, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -209,6 +222,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -220,11 +234,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot index 66d595ecb35..545a5e2b59f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics type-alias-object-without-annotation.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,10 +54,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -65,11 +71,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -81,13 +89,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 12, 24, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -125,10 +133,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -140,11 +150,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 25, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -156,13 +168,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 25, 28, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": undefined, }, @@ -173,6 +185,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot index fa92cb442e4..61082763c66 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -18,11 +20,13 @@ Object { }, }, "name": "assertString", + "optional": false, "range": Array [ 6, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -78,6 +82,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -89,6 +94,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 22, 28, @@ -163,6 +169,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -174,11 +181,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 39, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 31, @@ -189,6 +198,7 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -207,6 +217,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot index 2594a013ddd..a9cebd20e86 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot @@ -42,9 +42,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -56,11 +58,13 @@ Object { }, }, "name": "assertsString", + "optional": false, "range": Array [ 9, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -85,6 +90,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 23, 29, @@ -159,6 +165,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -170,11 +177,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 40, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 32, @@ -185,6 +194,7 @@ Object { }, }, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot index 8cbbcfed1d5..efcdd6e5e9a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +23,13 @@ Object { }, }, "name": "isString", + "optional": false, "range": Array [ 24, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -50,6 +57,7 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 33, 42, @@ -95,6 +103,7 @@ Object { 24, 58, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -124,6 +133,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -135,11 +145,13 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 53, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 45, @@ -149,7 +161,9 @@ Object { "typeAnnotation": null, }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -168,7 +182,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -180,11 +197,13 @@ Object { }, }, "name": "AssertFoo", + "optional": false, "range": Array [ 10, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -201,6 +220,7 @@ Object { 60, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot index 8f61a28350a..c84fa6d40fa 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics type-assertion-in-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "isBar", + "optional": false, "range": Array [ 21, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 21, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -83,6 +91,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -155,12 +164,17 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -172,11 +186,13 @@ Object { }, }, "name": "isBaz", + "optional": false, "range": Array [ 63, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -188,14 +204,16 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 63, 108, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "async": false, "body": Object { @@ -307,6 +325,7 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -326,7 +345,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -338,12 +360,15 @@ Object { }, }, "name": "AssertsFoo", + "optional": false, "range": Array [ 6, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -359,7 +384,9 @@ Object { 110, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot index cd086d7c0fc..2b0109966c6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -18,11 +20,13 @@ Object { }, }, "name": "assertString", + "optional": false, "range": Array [ 6, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -78,6 +82,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -89,6 +94,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 22, 28, @@ -163,6 +169,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -174,11 +181,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 39, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 31, @@ -222,6 +231,7 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -240,6 +250,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot index f2ab8fdaefe..639bad6d9bc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot @@ -42,9 +42,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -56,11 +58,13 @@ Object { }, }, "name": "assertsStringGuard", + "optional": false, "range": Array [ 9, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,6 +78,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -85,6 +90,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 28, 34, @@ -159,6 +165,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -170,11 +177,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 45, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 37, @@ -218,6 +227,7 @@ Object { }, }, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot index a26782c1073..7b1f554558a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +23,13 @@ Object { }, }, "name": "isString", + "optional": false, "range": Array [ 24, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -50,6 +57,7 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 33, 42, @@ -95,6 +103,7 @@ Object { 24, 68, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -124,6 +133,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -135,11 +145,13 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 53, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 45, @@ -182,7 +194,9 @@ Object { }, }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -201,7 +215,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -213,11 +230,13 @@ Object { }, }, "name": "AssertFoo", + "optional": false, "range": Array [ 10, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -234,6 +253,7 @@ Object { 70, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot index abfccafd624..4b8449944b0 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics type-assertion-with-guard-in-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "isBar", + "optional": false, "range": Array [ 21, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 21, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -83,6 +91,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -188,12 +197,17 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -205,11 +219,13 @@ Object { }, }, "name": "isBaz", + "optional": false, "range": Array [ 73, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -221,14 +237,16 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 73, 128, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "async": false, "body": Object { @@ -373,6 +391,7 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -392,7 +411,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -404,12 +426,15 @@ Object { }, }, "name": "AssertsFoo", + "optional": false, "range": Array [ 6, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -425,7 +450,9 @@ Object { 130, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot index ff1a2fd2b03..c4389a3250a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -18,11 +20,13 @@ Object { }, }, "name": "isString", + "optional": false, "range": Array [ 6, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -32,6 +36,7 @@ Object { "argument": Object { "left": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -43,11 +48,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 62, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -151,6 +158,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -162,6 +170,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 18, 24, @@ -236,6 +245,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -247,11 +257,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 27, @@ -295,6 +307,7 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -313,6 +326,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot index 73778ba8b4d..c4827039bed 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot @@ -11,6 +11,7 @@ Object { "argument": Object { "left": Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -22,11 +23,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 59, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -115,9 +118,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -129,11 +134,13 @@ Object { }, }, "name": "isString", + "optional": false, "range": Array [ 9, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -147,6 +154,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -158,6 +166,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 18, 24, @@ -232,6 +241,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -243,11 +253,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 27, @@ -291,6 +303,7 @@ Object { }, }, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot index a7723369960..760f643e1b7 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +23,13 @@ Object { }, }, "name": "isString", + "optional": false, "range": Array [ 18, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -50,6 +57,7 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 27, 36, @@ -95,6 +103,7 @@ Object { 18, 54, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -124,6 +133,7 @@ Object { }, }, "parameterName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -135,11 +145,13 @@ Object { }, }, "name": "node", + "optional": false, "range": Array [ 39, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 39, @@ -182,7 +194,9 @@ Object { }, }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -201,7 +215,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -213,11 +230,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -234,6 +253,7 @@ Object { 56, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot index 9d4fe4c33ca..76405ed6613 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript basics type-guard-in-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "isBar", + "optional": false, "range": Array [ 14, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -83,6 +91,7 @@ Object { 70, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -94,11 +103,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 67, 70, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, @@ -135,6 +146,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -240,12 +252,17 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -257,11 +274,13 @@ Object { }, }, "name": "isBaz", + "optional": false, "range": Array [ 78, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -273,14 +292,16 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 78, 145, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "async": false, "body": Object { @@ -320,6 +341,7 @@ Object { 140, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -331,11 +353,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 137, 140, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, @@ -477,6 +501,7 @@ Object { }, }, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, }, ], @@ -496,7 +521,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -508,12 +536,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -529,7 +560,9 @@ Object { 147, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot index 3d1549888bc..78569c9d383 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics type-import-type-with-type-parameters-in-type-referen Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -16,11 +18,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -65,11 +70,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -84,18 +91,7 @@ Object { }, "params": Array [ Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 28, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "parameter": Object { + "argument": Object { "literal": Object { "loc": Object { "end": Object { @@ -131,7 +127,18 @@ Object { ], "type": "TSLiteralType", }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, "qualifier": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -143,11 +150,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 11, @@ -199,6 +208,7 @@ Object { "type": "TSTypeParameterInstantiation", }, }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot index 1afe1ff0424..3da18228ba4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics type-import-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -16,11 +18,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,19 +42,27 @@ Object { ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { - "isTypeOf": true, - "loc": Object { - "end": Object { - "column": 27, - "line": 1, - }, - "start": Object { - "column": 9, - "line": 1, - }, - }, - "parameter": Object { - "literal": Object { + "exprName": Object { + "argument": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "raw": "'A'", + "type": "Literal", + "value": "A", + }, "loc": Object { "end": Object { "column": 26, @@ -65,37 +77,49 @@ Object { 23, 26, ], - "raw": "'A'", - "type": "Literal", - "value": "A", + "type": "TSLiteralType", }, "loc": Object { "end": Object { - "column": 26, + "column": 27, "line": 1, }, "start": Object { - "column": 23, + "column": 16, "line": 1, }, }, + "qualifier": null, "range": Array [ - 23, - 26, + 16, + 27, ], - "type": "TSLiteralType", + "type": "TSImportType", + "typeParameters": null, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, }, - "qualifier": null, "range": Array [ 9, 27, ], - "type": "TSImportType", - "typeParameters": null, + "type": "TSTypeQuery", + "typeParameters": undefined, }, + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -107,11 +131,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 34, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -129,18 +155,7 @@ Object { ], "type": "TSTypeAliasDeclaration", "typeAnnotation": Object { - "isTypeOf": false, - "loc": Object { - "end": Object { - "column": 25, - "line": 2, - }, - "start": Object { - "column": 9, - "line": 2, - }, - }, - "parameter": Object { + "argument": Object { "literal": Object { "loc": Object { "end": Object { @@ -156,7 +171,7 @@ Object { 45, 48, ], - "raw": "\\"B\\"", + "raw": "'B'", "type": "Literal", "value": "B", }, @@ -176,7 +191,18 @@ Object { ], "type": "TSLiteralType", }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, "qualifier": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -188,11 +214,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 50, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 38, @@ -228,6 +256,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -239,11 +268,13 @@ Object { }, }, "name": "Y", + "optional": false, "range": Array [ 52, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -255,6 +286,7 @@ Object { "type": "TSTypeParameterInstantiation", }, }, + "typeParameters": undefined, }, ], "comments": Array [], @@ -542,7 +574,7 @@ Object { 48, ], "type": "String", - "value": "\\"B\\"", + "value": "'B'", }, Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot index 74b9ace6c94..fd0197325f6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot @@ -44,6 +44,7 @@ Object { Object { "exportKind": "type", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -55,11 +56,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +75,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -83,11 +87,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 9, @@ -98,6 +104,7 @@ Object { Object { "exportKind": "type", "exported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -109,11 +116,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -126,6 +135,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -137,11 +147,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 17, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot index 5508c996629..e250bf09a4e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot @@ -43,6 +43,7 @@ Object { Object { "importKind": "type", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -54,11 +55,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +74,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -82,11 +86,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 9, @@ -97,6 +103,7 @@ Object { Object { "importKind": "type", "imported": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -108,11 +115,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -125,6 +134,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -136,11 +146,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 17, 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 9ac707ba48f..ae6510407f6 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 @@ -4,6 +4,7 @@ exports[`typescript basics type-parameters-comments-heritage.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,12 +38,15 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 74, @@ -55,6 +62,7 @@ Object { 74, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -66,11 +74,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 43, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "superTypeParameters": Object { "loc": Object { @@ -101,6 +111,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 60, @@ -112,11 +123,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 59, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -155,6 +168,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -166,11 +180,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -188,6 +204,7 @@ Object { }, }, Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -206,7 +223,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -218,12 +238,15 @@ Object { }, }, "name": "foo2", + "optional": false, "range": Array [ 81, 85, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 89, @@ -239,6 +262,7 @@ Object { 164, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 61, @@ -250,11 +274,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 133, 136, ], "type": "Identifier", + "typeAnnotation": undefined, }, "superTypeParameters": Object { "loc": Object { @@ -285,6 +311,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 75, @@ -296,11 +323,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 149, 150, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -374,6 +403,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -385,11 +415,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 98, 99, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -425,9 +457,11 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 51, @@ -439,11 +473,13 @@ Object { }, }, "name": "bar2", + "optional": false, "range": Array [ 212, 216, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -489,6 +525,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 65, @@ -500,11 +537,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 229, 230, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -518,6 +557,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -529,11 +569,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 175, 178, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -577,6 +619,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -588,11 +631,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 191, 192, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -628,9 +673,11 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 65, @@ -642,11 +689,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 307, 310, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -692,6 +741,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 79, @@ -703,11 +753,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 323, 324, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -721,6 +773,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -732,11 +785,13 @@ Object { }, }, "name": "bar2", + "optional": false, "range": Array [ 255, 259, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -815,6 +870,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -826,11 +882,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 272, 273, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 23e4e8cfe5c..506d536cab3 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 @@ -4,9 +4,11 @@ exports[`typescript basics type-parameters-comments.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -69,6 +73,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -80,11 +85,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -132,9 +139,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -146,11 +155,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 53, 56, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -167,6 +178,7 @@ Object { 44, 87, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -195,6 +207,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -206,11 +219,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 68, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -247,9 +262,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -261,11 +278,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 97, 100, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -282,6 +301,7 @@ Object { 88, 137, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { @@ -314,6 +334,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -325,11 +346,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 126, 129, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -345,6 +368,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -356,11 +380,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 112, 113, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot index 50ce8ec40fd..97b337b9834 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot @@ -4,12 +4,17 @@ exports[`typescript basics type-reference-comments.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -21,11 +26,13 @@ Object { }, }, "name": "mBuffers", + "optional": false, "range": Array [ 26, 34, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -37,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 26, 75, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -79,6 +87,7 @@ Object { "type": "TSTypeReference", "typeName": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -90,11 +99,13 @@ Object { }, }, "name": "interop", + "optional": false, "range": Array [ 36, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -111,6 +122,7 @@ Object { 53, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -122,11 +134,13 @@ Object { }, }, "name": "Reference", + "optional": false, "range": Array [ 44, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TSQualifiedName", }, @@ -187,7 +201,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -199,12 +216,15 @@ Object { }, }, "name": "AudioBufferList", + "optional": false, "range": Array [ 6, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -220,7 +240,9 @@ Object { 77, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot index e567ad019d6..16718475226 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-bigint.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSBigIntKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot index 15df6a11783..6bae375246c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-boolean.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSBooleanKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot index db4792bdba5..cd61063d33c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-false.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -73,6 +77,7 @@ Object { ], "type": "TSLiteralType", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot index cf7d872afd4..2ef2bc7ac88 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-never.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSNeverKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot index c10960e9add..3063803b21a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-null.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSNullKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot index a6b45be0d7f..136af862576 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-number.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSNumberKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot index 4c61e67b2f1..93ff8619275 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-object.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSObjectKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot index 13ab7aa43cc..ef939b6e06d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-string.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSStringKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot index c1a42b8f583..293287d670b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-symbol.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSSymbolKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot index 81c20bcfc0a..6c85c788933 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-true.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -73,6 +77,7 @@ Object { ], "type": "TSLiteralType", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot index 03051c999c5..83bce206ac9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-undefined.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSUndefinedKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot index 578fd0f123d..b32a66f87d3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-unknown.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSUnknownKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot index a729ed280fc..3ba4accdf4f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics typed-keyword-void.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -54,6 +58,7 @@ Object { ], "type": "TSVoidKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], 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 45a7d851587..252f85afc2c 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 @@ -4,7 +4,9 @@ exports[`typescript basics typed-method-signature.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,8 +54,11 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -63,11 +70,13 @@ Object { }, }, "name": "h", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -80,8 +89,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -93,6 +104,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 17, 28, @@ -138,6 +150,7 @@ Object { 15, 36, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -172,11 +185,16 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -188,11 +206,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 39, 40, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -205,8 +225,10 @@ Object { "line": 3, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -218,6 +240,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 44, 50, @@ -256,6 +279,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -267,11 +291,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 49, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -282,6 +308,7 @@ Object { 39, 55, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -315,6 +342,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -326,15 +354,18 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 53, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, + "static": false, "type": "TSMethodSignature", "typeParameters": Object { "loc": Object { @@ -363,6 +394,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -374,11 +406,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 41, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -402,6 +436,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot index bfd4fd36e9e..cd43c09cf0b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -20,11 +23,13 @@ Object { }, }, "name": "addClickListener", + "optional": false, "range": Array [ 23, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 57, @@ -50,6 +57,7 @@ Object { }, }, "name": "onclick", + "optional": false, "range": Array [ 40, 79, @@ -84,6 +92,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -95,6 +104,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 50, 60, @@ -136,6 +146,7 @@ Object { }, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -147,6 +158,7 @@ Object { }, }, "name": "e", + "optional": false, "range": Array [ 62, 70, @@ -185,6 +197,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -196,11 +209,13 @@ Object { }, }, "name": "Event", + "optional": false, "range": Array [ 65, 70, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -246,6 +261,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, }, }, @@ -254,6 +270,7 @@ Object { 23, 87, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -288,7 +305,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -307,7 +326,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -319,11 +341,13 @@ Object { }, }, "name": "UIElement", + "optional": false, "range": Array [ 10, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -340,6 +364,7 @@ Object { 89, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot index cd8382ae043..dd98a273ca8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -18,6 +20,7 @@ Object { }, }, "name": "union", + "optional": false, "range": Array [ 4, 36, @@ -129,6 +132,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -149,7 +153,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -161,6 +167,7 @@ Object { }, }, "name": "intersection", + "optional": false, "range": Array [ 42, 71, @@ -255,6 +262,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -275,7 +283,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -287,6 +297,7 @@ Object { }, }, "name": "precedence1", + "optional": false, "range": Array [ 77, 115, @@ -417,6 +428,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -437,7 +449,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -449,6 +463,7 @@ Object { }, }, "name": "precedence2", + "optional": false, "range": Array [ 121, 159, @@ -579,6 +594,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -597,7 +613,9 @@ Object { "type": "VariableDeclaration", }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -609,11 +627,13 @@ Object { }, }, "name": "unionLeading", + "optional": false, "range": Array [ 167, 179, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -683,9 +703,12 @@ Object { }, ], }, + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -697,11 +720,13 @@ Object { }, }, "name": "intersectionLeading", + "optional": false, "range": Array [ 206, 225, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -790,9 +815,12 @@ Object { }, ], }, + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -804,11 +832,13 @@ Object { }, }, "name": "unionLeadingSingle", + "optional": false, "range": Array [ 252, 270, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -861,9 +891,12 @@ Object { }, ], }, + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -875,11 +908,13 @@ Object { }, }, "name": "intersectionLeadingSingle", + "optional": false, "range": Array [ 288, 313, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -932,6 +967,7 @@ Object { }, ], }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot index 3e62fc9068b..e6be3579754 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript basics unique-symbol.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -16,11 +18,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -72,6 +76,7 @@ Object { "type": "TSSymbolKeyword", }, }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot index 6ea8c03cd07..2a6acdb6186 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -18,6 +20,7 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 16, @@ -76,6 +79,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot index c858a9fc2c3..4f5708663e4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot @@ -8,6 +8,7 @@ Object { Object { "definite": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -19,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 6, 16, @@ -77,6 +79,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { @@ -99,6 +102,7 @@ Object { Object { "definite": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -110,6 +114,7 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 22, 32, @@ -168,6 +173,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -190,6 +196,7 @@ Object { Object { "definite": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -201,6 +208,7 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 38, 48, @@ -259,6 +267,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot index ff107189850..945791f1e11 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -18,6 +20,7 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 4, 14, @@ -58,6 +61,7 @@ Object { "typeName": Object { "left": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -69,11 +73,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -90,6 +96,7 @@ Object { 12, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -101,11 +108,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TSQualifiedName", }, @@ -124,6 +133,7 @@ Object { 14, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -135,11 +145,13 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TSQualifiedName", }, @@ -165,6 +177,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot index 5966311982a..22d3088a1ab 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -18,6 +20,7 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 4, 15, @@ -94,6 +97,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -114,7 +118,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -126,6 +132,7 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 34, 45, @@ -202,6 +209,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot index 4fedf82502f..ee4becfbc89 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 21, @@ -76,6 +79,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot index 802112c2720..84d87561a07 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot @@ -24,7 +24,9 @@ Object { "type": "ClassBody", }, "declare": true, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -36,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 23, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -57,7 +62,9 @@ Object { 31, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot index 31ea3c38408..78264807b98 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript declare class.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,7 +24,9 @@ Object { "type": "ClassBody", }, "declare": true, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -35,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -56,7 +62,9 @@ Object { 22, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot index e2422bfd330..2fc02c2308f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript declare enum.src 1`] = ` Object { "body": Array [ Object { + "const": false, "declare": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -17,11 +19,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -35,7 +39,9 @@ Object { }, "members": Array [ Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -47,12 +53,15 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 23, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, @@ -70,7 +79,9 @@ Object { "type": "TSEnumMember", }, Object { + "computed": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -82,12 +93,15 @@ Object { }, }, "name": "Baz", + "optional": false, "range": Array [ 32, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "initializer": undefined, "loc": Object { "end": Object { "column": 7, diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot index 2eceb689110..1cf91d345f3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot @@ -10,6 +10,7 @@ Object { "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -21,11 +22,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 17, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -77,6 +80,7 @@ Object { }, }, "type": "TSDeclareFunction", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot index 76a90b34fff..8d50d5601de 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot @@ -23,7 +23,9 @@ Object { "type": "TSInterfaceBody", }, "declare": true, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -35,11 +37,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 18, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,6 +60,7 @@ Object { 26, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot index a786486f85d..27c64a55228 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot @@ -23,7 +23,9 @@ Object { "type": "TSModuleBlock", }, "declare": true, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -35,13 +37,14 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "module", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot index 3823ff07f05..849614bd130 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot @@ -23,7 +23,9 @@ Object { "type": "TSModuleBlock", }, "declare": true, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -35,13 +37,14 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 18, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "namespace", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot index e7aaef933ca..b8b43753ae0 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot @@ -6,6 +6,7 @@ Object { Object { "declare": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -17,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 13, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +58,7 @@ Object { ], "type": "TSStringKeyword", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot index c86c2452896..a243c013741 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -18,6 +20,7 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 12, 20, diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot index 805be00cc76..b1e770513ed 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript decorators accessor-decorators accessor-decorator-factory-in Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { @@ -33,6 +35,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -44,11 +47,13 @@ Object { }, }, "name": "configurable", + "optional": false, "range": Array [ 19, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -66,6 +71,7 @@ Object { 38, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -85,6 +91,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -96,11 +103,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 47, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -113,6 +122,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 18, @@ -120,6 +130,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -156,6 +167,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -167,11 +179,13 @@ Object { }, }, "name": "_x", + "optional": false, "range": Array [ 65, 67, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 60, @@ -212,6 +226,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -230,7 +245,9 @@ Object { 48, 70, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -250,7 +267,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -262,12 +282,15 @@ Object { }, }, "name": "Point", + "optional": false, "range": Array [ 6, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -283,7 +306,9 @@ Object { 72, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot index e977890dec4..7d1123ac28e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript decorators accessor-decorators accessor-decorator-factory-st Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { @@ -27,6 +29,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -38,11 +41,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 25, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -56,6 +61,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 25, 34, @@ -91,6 +97,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -102,11 +109,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 19, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -124,6 +133,7 @@ Object { 37, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -143,6 +153,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -154,11 +165,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 53, 56, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -171,6 +184,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 18, @@ -178,6 +192,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -214,6 +229,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -225,11 +241,13 @@ Object { }, }, "name": "_bar", + "optional": false, "range": Array [ 73, 77, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 68, @@ -270,6 +288,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -288,7 +307,9 @@ Object { 56, 80, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -308,7 +329,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -320,12 +344,15 @@ Object { }, }, "name": "Other", + "optional": false, "range": Array [ 6, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -341,7 +368,9 @@ Object { 82, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot index 8eb7ac9e21c..15c4040b246 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot @@ -4,13 +4,16 @@ exports[`typescript decorators accessor-decorators accessor-decorator-instance-m Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -22,11 +25,13 @@ Object { }, }, "name": "hidden", + "optional": false, "range": Array [ 15, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -46,6 +51,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -57,11 +63,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -74,6 +82,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -81,6 +90,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -117,6 +127,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -128,11 +139,13 @@ Object { }, }, "name": "_z", + "optional": false, "range": Array [ 48, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 43, @@ -173,6 +186,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -191,7 +205,9 @@ Object { 31, 53, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -211,7 +227,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -223,12 +242,15 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -244,7 +266,9 @@ Object { 55, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot index 604fffa67a5..e1290fd6d76 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot @@ -4,13 +4,16 @@ exports[`typescript decorators accessor-decorators accessor-decorator-static-mem Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -22,11 +25,13 @@ Object { }, }, "name": "adminonly", + "optional": false, "range": Array [ 18, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -46,6 +51,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -57,11 +63,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 43, 44, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -74,6 +82,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 17, @@ -81,11 +90,13 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -118,6 +129,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -129,11 +141,13 @@ Object { }, }, "name": "_y", + "optional": false, "range": Array [ 63, 65, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 58, @@ -157,6 +171,7 @@ Object { 69, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -168,11 +183,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 68, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "AssignmentExpression", }, @@ -209,6 +226,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -224,6 +242,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -235,18 +254,22 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 45, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "range": Array [ 44, 76, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -266,7 +289,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -278,12 +304,15 @@ Object { }, }, "name": "User", + "optional": false, "range": Array [ 6, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -299,7 +328,9 @@ Object { 78, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot index 585a6f8ccd1..132245e6798 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript decorators class-decorators class-decorator-factory.src 1`] Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,6 +23,7 @@ Object { ], "type": "ClassBody", }, + "declare": false, "decorators": Array [ Object { "expression": Object { @@ -41,6 +43,7 @@ Object { Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -52,11 +55,13 @@ Object { }, }, "name": "selector", + "optional": false, "range": Array [ 17, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -70,6 +75,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 17, 32, @@ -105,6 +111,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -116,11 +123,13 @@ Object { }, }, "name": "Component", + "optional": false, "range": Array [ 1, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -138,6 +147,7 @@ Object { 36, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -157,6 +167,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -168,12 +179,15 @@ Object { }, }, "name": "FooComponent", + "optional": false, "range": Array [ 43, 55, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 21, @@ -189,7 +203,9 @@ Object { 58, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot index 4a4f520daef..c5ad448350f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript decorators class-decorators class-decorator.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,9 +23,11 @@ Object { ], "type": "ClassBody", }, + "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -36,11 +39,13 @@ Object { }, }, "name": "sealed", + "optional": false, "range": Array [ 1, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -60,6 +65,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -71,12 +77,15 @@ Object { }, }, "name": "Qux", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 12, @@ -92,7 +101,9 @@ Object { 20, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot index 81ff4dcfe3d..e0f6249be85 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators class-decorators class-parameter-property.src 1`] Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 12, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -83,6 +92,7 @@ Object { "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -94,11 +104,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -117,7 +129,7 @@ Object { "type": "Decorator", }, ], - "export": undefined, + "export": false, "loc": Object { "end": Object { "column": 34, @@ -128,8 +140,9 @@ Object { "line": 2, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -141,6 +154,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 35, 44, @@ -185,8 +199,8 @@ Object { 24, 44, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, ], @@ -194,7 +208,9 @@ Object { 23, 48, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -214,7 +230,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -226,12 +245,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -247,7 +269,9 @@ Object { 50, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot index 031962dfb27..ef6941711c5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -23,9 +24,11 @@ Object { ], "type": "ClassBody", }, + "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -37,11 +40,13 @@ Object { }, }, "name": "sealed", + "optional": false, "range": Array [ 1, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -61,6 +66,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -72,12 +78,15 @@ Object { }, }, "name": "Qux", + "optional": false, "range": Array [ 29, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 27, @@ -93,7 +102,9 @@ Object { 35, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot index f3b1a4c1ed5..dba1ae6fd05 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot @@ -6,6 +6,7 @@ Object { Object { "assertions": Array [], "declaration": Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -24,9 +25,11 @@ Object { ], "type": "ClassBody", }, + "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -38,11 +41,13 @@ Object { }, }, "name": "sealed", + "optional": false, "range": Array [ 1, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -62,6 +67,7 @@ Object { }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -73,12 +79,15 @@ Object { }, }, "name": "Qux", + "optional": false, "range": Array [ 21, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 19, @@ -94,7 +103,9 @@ Object { 27, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot index 108b09f249c..fc286d2c5ae 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript decorators method-decorators method-decorator-factory-instan Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { @@ -33,6 +35,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -44,11 +47,13 @@ Object { }, }, "name": "onlyRead", + "optional": false, "range": Array [ 15, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -66,6 +71,7 @@ Object { 30, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -85,6 +91,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -96,11 +103,13 @@ Object { }, }, "name": "instanceMethod", + "optional": false, "range": Array [ 35, 49, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -113,6 +122,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -120,6 +130,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -140,6 +151,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -158,7 +170,9 @@ Object { 49, 54, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -178,7 +192,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -190,12 +207,15 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -211,7 +231,9 @@ Object { 56, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot index c3429eb4f45..41f927c3347 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript decorators method-decorators method-decorator-factory-static Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { @@ -33,6 +35,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -44,11 +47,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -66,6 +71,7 @@ Object { 25, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -85,6 +91,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -96,11 +103,13 @@ Object { }, }, "name": "staticMethod", + "optional": false, "range": Array [ 37, 49, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -113,6 +122,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -120,6 +130,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -140,6 +151,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -158,7 +170,9 @@ Object { 49, 54, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -178,7 +192,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -190,12 +207,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -211,7 +231,9 @@ Object { 56, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot index c73b273260c..c8f3fa4ebad 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot @@ -4,13 +4,16 @@ exports[`typescript decorators method-decorators method-decorator-instance-membe Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -22,11 +25,13 @@ Object { }, }, "name": "onlyRead", + "optional": false, "range": Array [ 15, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -46,6 +51,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -57,11 +63,13 @@ Object { }, }, "name": "instanceMethod", + "optional": false, "range": Array [ 28, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -74,6 +82,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -81,6 +90,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -101,6 +111,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -119,7 +130,9 @@ Object { 42, 47, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -139,7 +152,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -151,12 +167,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -172,7 +191,9 @@ Object { 49, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot index 9afc61f6df0..98c64e562c2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot @@ -4,13 +4,16 @@ exports[`typescript decorators method-decorators method-decorator-static-member. Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -22,11 +25,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -46,6 +51,7 @@ Object { }, ], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -57,11 +63,13 @@ Object { }, }, "name": "staticMethod", + "optional": false, "range": Array [ 30, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -74,6 +82,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -81,6 +90,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -101,6 +111,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -119,7 +130,9 @@ Object { 42, 47, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -139,7 +152,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -151,12 +167,15 @@ Object { }, }, "name": "D", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -172,7 +191,9 @@ Object { 49, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot index 49db6673b5a..13e6abc7abc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-array-pattern-deco Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -104,6 +113,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -115,11 +125,13 @@ Object { }, }, "name": "special", + "optional": false, "range": Array [ 19, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -137,6 +149,7 @@ Object { 32, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -157,6 +170,7 @@ Object { ], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -168,11 +182,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 35, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -185,6 +201,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 33, 45, @@ -230,7 +247,9 @@ Object { 17, 49, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -250,7 +269,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -262,12 +284,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -283,7 +308,9 @@ Object { 51, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot index 400c54bbc48..fd55d3eb030 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-decorator-construc Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 20, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 20, @@ -44,11 +51,13 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { "computed": false, @@ -81,6 +90,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -92,11 +102,13 @@ Object { }, }, "name": "title", + "optional": false, "range": Array [ 86, 91, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 81, @@ -132,6 +144,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -143,14 +156,17 @@ Object { }, }, "name": "config", + "optional": false, "range": Array [ 94, 100, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -162,11 +178,13 @@ Object { }, }, "name": "title", + "optional": false, "range": Array [ 101, 106, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 94, @@ -209,6 +227,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -229,6 +248,7 @@ Object { "expression": Object { "arguments": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -240,14 +260,17 @@ Object { }, }, "name": "APP_CONFIG", + "optional": false, "range": Array [ 40, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -259,11 +282,13 @@ Object { }, }, "name": "Inject", + "optional": false, "range": Array [ 33, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -281,6 +306,7 @@ Object { 51, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -310,6 +336,7 @@ Object { }, }, "name": "config", + "optional": false, "range": Array [ 52, 69, @@ -348,6 +375,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 53, @@ -359,11 +387,13 @@ Object { }, }, "name": "AppConfig", + "optional": false, "range": Array [ 60, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -374,7 +404,9 @@ Object { 31, 113, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -394,7 +426,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -406,12 +441,15 @@ Object { }, }, "name": "Service", + "optional": false, "range": Array [ 6, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -427,7 +465,9 @@ Object { 115, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot index 237d9442521..d796ccc509a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-decorator-decorato Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 16, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 16, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -104,6 +113,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -115,11 +125,13 @@ Object { }, }, "name": "special", + "optional": false, "range": Array [ 21, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -137,6 +149,7 @@ Object { 34, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -166,6 +179,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 35, 46, @@ -211,7 +225,9 @@ Object { 19, 50, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -231,7 +247,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -243,12 +262,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -264,7 +286,9 @@ Object { 52, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot index 6e982f368f3..9ae0c0b122e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-decorator-decorato Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -20,11 +24,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 29, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 22, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -104,6 +113,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -115,11 +125,13 @@ Object { }, }, "name": "special", + "optional": false, "range": Array [ 34, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -137,6 +149,7 @@ Object { 47, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -166,6 +179,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 48, 59, @@ -211,7 +225,9 @@ Object { 32, 63, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -231,7 +247,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -243,12 +262,15 @@ Object { }, }, "name": "StaticFoo", + "optional": false, "range": Array [ 6, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -264,7 +286,9 @@ Object { 65, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot index 9e20b12a095..95d832d6628 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-decorator-instance Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -20,11 +24,13 @@ Object { }, }, "name": "greet", + "optional": false, "range": Array [ 20, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 20, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -86,6 +94,7 @@ Object { 82, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -97,11 +106,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 78, 82, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, @@ -174,6 +185,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -192,6 +204,7 @@ Object { "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -203,11 +216,13 @@ Object { }, }, "name": "required", + "optional": false, "range": Array [ 27, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -237,6 +252,7 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 36, 48, @@ -282,7 +298,9 @@ Object { 25, 95, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -302,7 +320,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -314,12 +335,15 @@ Object { }, }, "name": "Greeter", + "optional": false, "range": Array [ 6, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -335,7 +359,9 @@ Object { 97, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot index e12ff3fa819..435a57981b4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-decorator-static-m Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -20,11 +24,13 @@ Object { }, }, "name": "greet", + "optional": false, "range": Array [ 33, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 26, @@ -44,6 +51,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -86,6 +94,7 @@ Object { 95, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -97,11 +106,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 91, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "BinaryExpression", }, @@ -174,6 +185,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -192,6 +204,7 @@ Object { "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -203,11 +216,13 @@ Object { }, }, "name": "required", + "optional": false, "range": Array [ 40, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -237,6 +252,7 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 49, 61, @@ -282,7 +298,9 @@ Object { 38, 108, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -302,7 +320,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -314,12 +335,15 @@ Object { }, }, "name": "StaticGreeter", + "optional": false, "range": Array [ 6, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -335,7 +359,9 @@ Object { 110, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot index 69ad340de2a..2e7496ff983 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-object-pattern-dec Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -104,6 +113,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -115,11 +125,13 @@ Object { }, }, "name": "special", + "optional": false, "range": Array [ 19, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -137,6 +149,7 @@ Object { 32, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -165,10 +178,12 @@ Object { "line": 2, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -180,11 +195,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 35, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -198,6 +215,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 35, 38, @@ -205,6 +223,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -216,11 +235,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 35, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -269,7 +290,9 @@ Object { 17, 49, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -289,7 +312,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -301,12 +327,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -322,7 +351,9 @@ Object { 51, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot index 7f77443e46d..02508642ae3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript decorators parameter-decorators parameter-rest-element-decor Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -20,11 +24,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 14, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -80,6 +89,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -91,11 +101,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 36, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "decorators": Array [ Object { @@ -122,6 +134,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -133,11 +146,13 @@ Object { }, }, "name": "special", + "optional": false, "range": Array [ 19, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -155,6 +170,7 @@ Object { 32, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -183,6 +199,7 @@ Object { "line": 2, }, }, + "optional": false, "range": Array [ 18, 44, @@ -222,13 +239,16 @@ Object { "type": "TSAnyKeyword", }, }, + "value": undefined, }, ], "range": Array [ 17, 48, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -248,7 +268,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -260,12 +283,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -281,7 +307,9 @@ Object { 50, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot index 2dec783b8b4..b6ba2ac472c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript decorators property-decorators property-decorator-factory-in Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ @@ -14,6 +16,7 @@ Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -25,11 +28,13 @@ Object { }, }, "name": "Input", + "optional": false, "range": Array [ 27, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -47,6 +52,7 @@ Object { 34, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -65,7 +71,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -77,11 +85,13 @@ Object { }, }, "name": "data", + "optional": false, "range": Array [ 35, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -93,17 +103,20 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 26, 40, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ @@ -111,6 +124,7 @@ Object { "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -122,11 +136,13 @@ Object { }, }, "name": "Output", + "optional": false, "range": Array [ 46, 52, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -144,6 +160,7 @@ Object { 54, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -162,7 +179,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -174,11 +193,13 @@ Object { }, }, "name": "click", + "optional": false, "range": Array [ 59, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -190,17 +211,20 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 45, 86, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -212,11 +236,13 @@ Object { }, }, "name": "EventEmitter", + "optional": false, "range": Array [ 71, 83, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -233,6 +259,7 @@ Object { 85, ], "type": "NewExpression", + "typeParameters": undefined, }, }, ], @@ -252,7 +279,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -264,12 +294,15 @@ Object { }, }, "name": "SomeComponent", + "optional": false, "range": Array [ 6, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -285,7 +318,9 @@ Object { 88, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot index 53043405565..cbd4142c313 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript decorators property-decorators property-decorator-factory-st Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ @@ -34,6 +36,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -45,11 +48,13 @@ Object { }, }, "name": "configurable", + "optional": false, "range": Array [ 15, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -67,6 +72,7 @@ Object { 33, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -85,7 +91,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -97,11 +105,13 @@ Object { }, }, "name": "prop1", + "optional": false, "range": Array [ 41, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,17 +123,20 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 47, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ @@ -151,6 +164,7 @@ Object { }, ], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -162,11 +176,13 @@ Object { }, }, "name": "configurable", + "optional": false, "range": Array [ 54, 66, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -184,6 +200,7 @@ Object { 73, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -202,7 +219,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -214,11 +233,13 @@ Object { }, }, "name": "prop2", + "optional": false, "range": Array [ 85, 90, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -230,14 +251,16 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 53, 91, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, ], @@ -257,7 +280,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -269,12 +295,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -290,7 +319,9 @@ Object { 93, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot index 95ccdf95a30..0ea7c477352 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot @@ -4,14 +4,17 @@ exports[`typescript decorators property-decorators property-decorator-instance-m Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -23,11 +26,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -46,7 +51,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -58,11 +65,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,22 +83,26 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 21, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -101,11 +114,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 27, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -124,7 +139,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -136,11 +153,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -152,14 +171,16 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 26, 37, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, ], @@ -179,7 +200,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -191,12 +215,15 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -212,7 +239,9 @@ Object { 39, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot index 60c9860bfd0..00b6cb8accb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot @@ -4,14 +4,17 @@ exports[`typescript decorators property-decorators property-decorator-static-mem Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -23,11 +26,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -46,7 +51,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -58,11 +65,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,22 +83,26 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, 28, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, Object { + "accessibility": undefined, "computed": false, "declare": false, "decorators": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -101,11 +114,13 @@ Object { }, }, "name": "qux", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -124,7 +139,9 @@ Object { "type": "Decorator", }, ], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -136,11 +153,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 49, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -152,14 +171,16 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 33, 51, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "PropertyDefinition", + "typeAnnotation": undefined, "value": null, }, ], @@ -179,7 +200,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -191,12 +215,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -212,7 +239,9 @@ Object { 53, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot index 5e34a9b63ab..1bd37272699 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript errorRecovery class-empty-extends-implements.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,15 +38,18 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -54,11 +61,13 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 29, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +84,7 @@ Object { 32, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -92,7 +102,9 @@ Object { 37, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot index 092baa9e06c..3e03c06505a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript errorRecovery class-empty-extends.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,12 +38,15 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -55,7 +62,9 @@ Object { 22, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot index feca427c9c8..bc24a042d3e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript errorRecovery class-extends-empty-implements.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -34,11 +38,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [], "loc": Object { @@ -56,6 +62,7 @@ Object { 37, ], "superClass": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -67,13 +74,17 @@ Object { }, }, "name": "Bar", + "optional": false, "range": Array [ 18, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot index 3b9edb135b2..a9266f6761f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript errorRecovery class-multiple-implements.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [], "loc": Object { @@ -22,7 +23,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -34,15 +38,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "implements": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -54,11 +61,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -75,6 +84,7 @@ Object { 20, ], "type": "TSClassImplements", + "typeParameters": undefined, }, ], "loc": Object { @@ -92,7 +102,9 @@ Object { 36, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot index 5e2931242c1..bf9719e0e4d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot @@ -4,7 +4,10 @@ exports[`typescript errorRecovery decorator-on-enum-declaration.src 1`] = ` Object { "body": Array [ Object { + "const": false, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -16,11 +19,13 @@ Object { }, }, "name": "E", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot index 2fd5ad0bea3..c8a92c1fa3c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -37,11 +39,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,7 +62,9 @@ Object { 0, 19, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot index ef5878c412f..ec47840850a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot @@ -22,7 +22,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -34,11 +37,13 @@ Object { }, }, "name": "M", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +60,7 @@ Object { 22, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot index da9ce1e5a23..a50ff86e3b6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -60,6 +64,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot index 5a448875170..2c09af5f398 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript errorRecovery empty-type-arguments-in-call-expression.src 1` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot index ccbb6a7f946..93860b87c8b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript errorRecovery empty-type-arguments-in-new-expression.src 1`] Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,11 +20,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot index 91099f034a0..45e46b0c970 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -18,6 +20,7 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 16, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -67,11 +71,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 11, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -112,6 +118,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot index e71b38e8867..62578efead5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +39,13 @@ Object { }, }, "name": "f1", + "optional": false, "range": Array [ 9, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 0, 18, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot index 235dee9fe7c..a4efe957148 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript errorRecovery empty-type-parameters-in-constructor.src 1`] = Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -20,11 +24,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 14, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,6 +91,7 @@ Object { 25, 32, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -120,7 +130,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -132,12 +145,15 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -153,7 +169,9 @@ Object { 34, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot index beeaaea48bc..864e243a7e8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -44,6 +48,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -62,6 +67,7 @@ Object { 12, 27, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -99,6 +105,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot index bb110cf0575..4bfcb929485 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,11 +23,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 18, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,11 +42,15 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [], "range": Array [ 18, 27, ], + "readonly": false, + "returnType": undefined, + "static": false, "type": "TSMethodSignature", "typeParameters": Object { "loc": Object { @@ -79,7 +88,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -91,11 +103,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -112,6 +126,7 @@ Object { 29, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot index 3233906e5cc..9a77a16527e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript errorRecovery empty-type-parameters-in-method.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -20,11 +24,13 @@ Object { }, }, "name": "test", + "optional": false, "range": Array [ 14, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 14, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -64,6 +72,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -82,6 +91,7 @@ Object { 18, 25, ], + "returnType": undefined, "type": "FunctionExpression", "typeParameters": Object { "loc": Object { @@ -120,7 +130,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -132,12 +145,15 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -153,7 +169,9 @@ Object { 27, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot index 56205b0a1c6..4dd8d5a0b2c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot @@ -23,9 +23,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -37,11 +39,13 @@ Object { }, }, "name": "f1", + "optional": false, "range": Array [ 9, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { 0, 18, ], + "returnType": undefined, "type": "FunctionDeclaration", "typeParameters": Object { "loc": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot index f21c928657d..f6ee5e0b2c4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot @@ -6,7 +6,10 @@ Object { Object { "assertions": Array [], "declaration": Object { + "const": false, + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 69, @@ -18,11 +21,13 @@ Object { }, }, "name": "X", + "optional": false, "range": Array [ 68, 69, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -35,127 +40,6 @@ Object { }, }, "members": Array [], - "modifiers": Array [ - Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 1, - }, - "start": Object { - "column": 7, - "line": 1, - }, - }, - "range": Array [ - 7, - 14, - ], - "type": "TSPrivateKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "range": Array [ - 15, - 21, - ], - "type": "TSPublicKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 31, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 31, - ], - "type": "TSProtectedKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 38, - "line": 1, - }, - "start": Object { - "column": 32, - "line": 1, - }, - }, - "range": Array [ - 32, - 38, - ], - "type": "TSStaticKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 1, - }, - "start": Object { - "column": 39, - "line": 1, - }, - }, - "range": Array [ - 39, - 47, - ], - "type": "TSReadonlyKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 56, - "line": 1, - }, - "start": Object { - "column": 48, - "line": 1, - }, - }, - "range": Array [ - 48, - 56, - ], - "type": "TSAbstractKeyword", - }, - Object { - "loc": Object { - "end": Object { - "column": 62, - "line": 1, - }, - "start": Object { - "column": 57, - "line": 1, - }, - }, - "range": Array [ - 57, - 62, - ], - "type": "TSAsyncKeyword", - }, - ], "range": Array [ 7, 72, diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot index d6d54c70978..b883986f4e2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript errorRecovery index-signature-parameters.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,8 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 33, @@ -62,6 +68,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -73,6 +80,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 25, @@ -114,6 +122,7 @@ Object { }, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -125,6 +134,7 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 27, 36, @@ -170,6 +180,8 @@ Object { 15, 46, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -213,6 +225,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot index 8c89cc0d497..5c37a401de1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot @@ -22,7 +22,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -34,11 +37,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +60,7 @@ Object { 26, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot index 748c52a5a1f..6cab0a70e5f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot @@ -22,7 +22,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -34,49 +37,14 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "implements": Array [ - Object { - "expression": Object { - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "name": "e", - "range": Array [ - 23, - 24, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 24, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "range": Array [ - 23, - 24, - ], - "type": "TSInterfaceHeritage", - }, - ], "loc": Object { "end": Object { "column": 27, @@ -92,6 +60,7 @@ Object { 27, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot index 4df063e4206..a516da8fd01 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot @@ -7,6 +7,7 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "export": true, "loc": Object { "end": Object { @@ -20,6 +21,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -31,6 +33,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 37, @@ -76,6 +79,8 @@ Object { 18, 47, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -129,7 +134,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -141,11 +149,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { 49, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot index 098450d4617..e06857bbd7b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Array [ Object { "accessibility": "private", + "export": false, "loc": Object { "end": Object { "column": 32, @@ -20,6 +21,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -31,6 +33,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 27, 38, @@ -76,6 +79,8 @@ Object { 18, 48, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -129,7 +134,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -141,11 +149,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { 50, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot index b2d65b5bfe2..04c38fdea4a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Array [ Object { "accessibility": "protected", + "export": false, "loc": Object { "end": Object { "column": 34, @@ -20,6 +21,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -31,6 +33,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 29, 40, @@ -76,6 +79,8 @@ Object { 18, 50, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -129,7 +134,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -141,11 +149,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { 52, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot index 5400ac755f7..f03d9d10a9c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot @@ -8,6 +8,7 @@ Object { "body": Array [ Object { "accessibility": "public", + "export": false, "loc": Object { "end": Object { "column": 31, @@ -20,6 +21,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -31,6 +33,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 37, @@ -76,6 +79,8 @@ Object { 18, 47, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -129,7 +134,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -141,11 +149,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { 49, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot index af0c31ee518..81cf1090cc6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot @@ -7,6 +7,8 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 31, @@ -19,6 +21,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -30,6 +33,7 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 26, 37, @@ -75,6 +79,7 @@ Object { 18, 47, ], + "readonly": false, "static": true, "type": "TSIndexSignature", "typeAnnotation": Object { @@ -129,7 +134,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -141,11 +149,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { 49, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot index 49552e632b9..629a050332e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot @@ -7,9 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "export": true, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -21,11 +23,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -51,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 29, 40, @@ -96,6 +103,7 @@ Object { 20, 48, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -130,7 +138,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -149,7 +159,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +174,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -182,6 +197,7 @@ Object { 50, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot index 0b2fc02bfd5..b812425f1e2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot @@ -9,7 +9,9 @@ Object { Object { "accessibility": "private", "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -21,11 +23,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -51,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 30, 41, @@ -96,6 +103,7 @@ Object { 20, 49, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -130,7 +138,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -149,7 +159,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +174,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -182,6 +197,7 @@ Object { 51, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot index 1826aeadf4e..df9ea8a3ca4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot @@ -9,7 +9,9 @@ Object { Object { "accessibility": "protected", "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -21,11 +23,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -51,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 30, 41, @@ -96,6 +103,7 @@ Object { 18, 49, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -130,7 +138,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -149,7 +159,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +174,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -182,6 +197,7 @@ Object { 51, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot index 114bd1a7811..2a67eb873bb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot @@ -9,7 +9,9 @@ Object { Object { "accessibility": "public", "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -21,11 +23,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -38,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -51,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 29, 40, @@ -96,6 +103,7 @@ Object { 20, 48, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -130,7 +138,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -149,7 +159,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +174,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -182,6 +197,7 @@ Object { 50, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot index e1a82d8ecda..ecb26e58be2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -20,11 +23,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -50,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 29, 40, @@ -130,7 +138,9 @@ Object { "type": "TSVoidKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -149,7 +159,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +174,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -182,6 +197,7 @@ Object { 50, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot index 8aab33054a9..34440f37119 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +23,13 @@ Object { }, }, "name": "g", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,8 +42,10 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -50,6 +57,7 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 27, 38, @@ -95,6 +103,7 @@ Object { 18, 46, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -131,6 +140,7 @@ Object { }, "static": true, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -149,7 +159,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -161,11 +174,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -182,6 +197,7 @@ Object { 48, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot index 3b83031b70b..282c743b38e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot @@ -22,9 +22,11 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, "extends": Array [ Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -36,11 +38,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 22, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -57,9 +61,11 @@ Object { 25, ], "type": "TSInterfaceHeritage", + "typeParameters": undefined, }, Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 37, @@ -71,11 +77,13 @@ Object { }, }, "name": "baz", + "optional": false, "range": Array [ 34, 37, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -92,9 +100,11 @@ Object { 37, ], "type": "TSInterfaceHeritage", + "typeParameters": undefined, }, ], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -106,11 +116,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -127,6 +139,7 @@ Object { 40, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot index 6b4120347e3..257598e4688 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot @@ -7,10 +7,12 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, "export": true, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -22,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,13 +42,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 18, 35, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -98,7 +102,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -110,11 +117,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -131,6 +140,7 @@ Object { 37, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot index 564a46f672d..2650e9af820 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot @@ -9,9 +9,10 @@ Object { Object { "accessibility": "private", "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -23,11 +24,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,13 +42,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 18, 36, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -99,7 +102,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -111,11 +117,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -132,6 +140,7 @@ Object { 38, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot index 0694c631cf6..6538b7b3659 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot @@ -9,9 +9,10 @@ Object { Object { "accessibility": "protected", "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -23,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 28, 29, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,13 +42,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 18, 38, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -99,7 +102,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -111,11 +117,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -132,6 +140,7 @@ Object { 40, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot index 763f3da502a..29b3d54a1ca 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot @@ -9,9 +9,10 @@ Object { Object { "accessibility": "public", "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -23,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -39,13 +42,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 20, 37, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -99,7 +102,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -111,11 +117,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -132,6 +140,7 @@ Object { 39, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot index a44ae0cfd07..b51bb812a72 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot @@ -7,10 +7,12 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -22,11 +24,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,12 +42,12 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 18, 35, ], - "readonly": undefined, + "readonly": false, "static": true, "type": "TSPropertySignature", "typeAnnotation": Object { @@ -98,7 +102,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -110,11 +117,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -131,6 +140,7 @@ Object { 37, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot index ea3ec222569..64aeed4e3d2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot @@ -7,8 +7,9 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": Object { "loc": Object { "end": Object { @@ -29,6 +30,7 @@ Object { "value": "a", }, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -40,11 +42,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 18, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -56,13 +60,13 @@ Object { "line": 2, }, }, - "optional": undefined, + "optional": false, "range": Array [ 18, 36, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -116,7 +120,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -128,11 +135,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -149,6 +158,7 @@ Object { 38, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot deleted file mode 100644 index cd817aad0dc..00000000000 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-no-body.src.ts.shot +++ /dev/null @@ -1,10 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`typescript errorRecovery interface-with-no-body.src 1`] = ` -TSError { - "column": 0, - "index": 14, - "lineNumber": 2, - "message": "'{' expected.", -} -`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot index 9859019dc2f..e36e4a5be9b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot @@ -7,6 +7,8 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 25, @@ -19,6 +21,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -76,6 +79,8 @@ Object { 18, 41, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -129,7 +134,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -141,11 +149,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { 43, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot index 860e640c47d..54343656d5c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript errorRecovery object-assertion-not-allowed.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -31,11 +35,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 4, @@ -56,6 +63,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -67,11 +75,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -80,6 +90,7 @@ Object { 5, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot index a1cbd74ee1a..eb90daf1aa4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot @@ -4,8 +4,10 @@ exports[`typescript errorRecovery object-optional-not-allowed.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -16,10 +18,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -31,11 +35,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -49,6 +55,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 2, 4, @@ -56,6 +63,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -67,11 +75,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -80,6 +90,7 @@ Object { 5, ], "type": "ObjectPattern", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot index b383b33615a..1b638349b82 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declarations": Array [], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot index d980c2f742e..7c214e71e32 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot @@ -4,9 +4,11 @@ exports[`typescript expressions call-expression-type-arguments.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -18,11 +20,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -69,6 +73,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -80,11 +85,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 4, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -113,9 +120,11 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -127,11 +136,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 10, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { 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 index 25904ece493..75ed4901410 100644 --- 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 @@ -4,8 +4,10 @@ exports[`typescript expressions instantiation-expression.src 1`] = ` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 1, @@ -17,11 +19,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 0, 1, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -67,6 +71,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -78,11 +83,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 2, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -111,9 +118,11 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -125,11 +134,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -175,6 +186,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -186,11 +198,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -246,6 +260,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -257,11 +272,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -290,10 +307,12 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -305,11 +324,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -355,6 +376,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -366,11 +388,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -427,6 +451,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -438,11 +463,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 25, 26, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -471,12 +498,14 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], "callee": Object { "expression": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -488,11 +517,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 32, 33, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -538,6 +569,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -549,11 +581,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 34, 35, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -609,6 +643,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -620,11 +655,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -652,6 +689,7 @@ Object { 44, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -686,6 +724,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { @@ -703,6 +742,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 2, @@ -714,14 +754,17 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 47, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -733,11 +776,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 50, 51, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 47, @@ -805,6 +850,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -816,11 +862,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 52, 53, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -877,6 +925,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -888,11 +937,13 @@ Object { }, }, "name": "d", + "optional": false, "range": Array [ 56, 57, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -921,10 +972,12 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "arguments": Array [], "callee": Object { "expression": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -936,11 +989,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 67, 68, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -986,6 +1041,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -997,11 +1053,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 69, 70, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1057,6 +1115,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -1068,11 +1127,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 73, 74, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot index 481bb783af7..0c5811985c5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -18,15 +20,18 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -38,11 +43,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -88,6 +95,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -99,11 +107,13 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -132,6 +142,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot index e5c1aeba3c9..f7794772ecf 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript expressions optional-call-expression-type-arguments.src 1`] Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -20,6 +21,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -31,14 +33,17 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -50,11 +55,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 0, @@ -107,6 +114,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -118,11 +126,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -167,6 +177,7 @@ Object { "type": "ExpressionStatement", }, Object { + "directive": undefined, "expression": Object { "expression": Object { "arguments": Array [], @@ -183,6 +194,7 @@ Object { }, }, "object": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -194,14 +206,17 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 15, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "optional": true, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -213,11 +228,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 20, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 15, diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot index b6f11be9a43..79df088d98f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot @@ -4,6 +4,7 @@ exports[`typescript expressions tagged-template-expression-type-arguments.src 1` Object { "body": Array [ Object { + "directive": undefined, "expression": Object { "loc": Object { "end": Object { @@ -62,6 +63,7 @@ Object { 13, ], "tag": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -73,11 +75,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 0, 3, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TaggedTemplateExpression", "typeParameters": Object { @@ -109,6 +113,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -120,11 +125,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot index 0fc1dc4ce2b..4990086e943 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot @@ -55,6 +55,7 @@ Object { }, }, "local": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -66,11 +67,13 @@ Object { }, }, "name": "fs", + "optional": false, "range": Array [ 41, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 41, @@ -99,6 +102,7 @@ Object { "type": "TSModuleBlock", }, "declare": true, + "global": false, "id": Object { "loc": Object { "end": Object { @@ -118,7 +122,6 @@ Object { "type": "Literal", "value": "i-use-things", }, - "kind": "module", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot index 5a3e8f29ed6..5f47122f26e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot @@ -11,9 +11,11 @@ Object { "declaration": Object { "async": false, "body": undefined, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -25,11 +27,13 @@ Object { }, }, "name": "select", + "optional": false, "range": Array [ 41, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -43,6 +47,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 41, @@ -54,6 +59,7 @@ Object { }, }, "name": "selector", + "optional": false, "range": Array [ 48, 64, @@ -132,6 +138,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 53, @@ -143,11 +150,13 @@ Object { }, }, "name": "Selection", + "optional": false, "range": Array [ 67, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -188,6 +197,7 @@ Object { }, }, "type": "TSDeclareFunction", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { @@ -226,7 +236,9 @@ Object { "type": "TSModuleBlock", }, "declare": true, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -238,13 +250,14 @@ Object { }, }, "name": "d3", + "optional": false, "range": Array [ 18, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "namespace", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot index 08f680075d9..7dfc6f3a45f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot @@ -26,7 +26,9 @@ Object { "type": "TSModuleBlock", }, "declare": true, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -38,13 +40,14 @@ Object { }, }, "name": "global", + "optional": false, "range": Array [ 36, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "module", "loc": Object { "end": Object { "column": 5, @@ -81,7 +84,9 @@ Object { "type": "TSModuleBlock", }, "declare": true, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -93,13 +98,14 @@ Object { }, }, "name": "global", + "optional": false, "range": Array [ 74, 80, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "namespace", "loc": Object { "end": Object { "column": 5, @@ -136,6 +142,7 @@ Object { "declare": true, "global": true, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -147,13 +154,14 @@ Object { }, }, "name": "global", + "optional": false, "range": Array [ 8, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "global", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot index 7151fa18dde..b7e172473d1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot @@ -8,11 +8,15 @@ Object { "body": Array [ Object { "declaration": Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -24,11 +28,13 @@ Object { }, }, "name": "method", + "optional": false, "range": Array [ 52, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -41,6 +47,7 @@ Object { "line": 3, }, }, + "optional": false, "override": false, "range": Array [ 52, @@ -48,6 +55,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -68,6 +76,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -119,6 +128,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -130,16 +140,19 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 62, 63, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -159,7 +172,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -171,12 +187,15 @@ Object { }, }, "name": "C", + "optional": false, "range": Array [ 40, 41, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 5, @@ -192,7 +211,9 @@ Object { 73, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { @@ -232,9 +253,11 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -246,11 +269,13 @@ Object { }, }, "name": "bar", + "optional": false, "range": Array [ 102, 105, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -267,7 +292,9 @@ Object { 93, 110, ], + "returnType": undefined, "type": "FunctionDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { @@ -303,6 +330,8 @@ Object { ], "type": "TSModuleBlock", }, + "declare": false, + "global": false, "id": Object { "loc": Object { "end": Object { @@ -322,7 +351,6 @@ Object { "type": "Literal", "value": "foo", }, - "kind": "module", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot index ad77c1edc36..722a1fb0276 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot @@ -11,7 +11,9 @@ Object { "declaration": Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -23,11 +25,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 27, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "loc": Object { @@ -65,6 +69,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -104,11 +109,15 @@ Object { Object { "assertions": Array [], "declaration": Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -120,11 +129,13 @@ Object { }, }, "name": "constructor", + "optional": false, "range": Array [ 78, 89, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "constructor", "loc": Object { @@ -137,6 +148,7 @@ Object { "line": 5, }, }, + "optional": false, "override": false, "range": Array [ 78, @@ -144,6 +156,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -164,6 +177,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -180,7 +194,8 @@ Object { "params": Array [ Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 36, @@ -191,8 +206,9 @@ Object { "line": 5, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -204,6 +220,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 97, 106, @@ -248,13 +265,14 @@ Object { 90, 106, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, Object { "accessibility": "public", - "export": undefined, + "decorators": Array [], + "export": false, "loc": Object { "end": Object { "column": 54, @@ -265,8 +283,9 @@ Object { "line": 5, }, }, - "override": undefined, + "override": false, "parameter": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 54, @@ -278,6 +297,7 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 115, 124, @@ -322,8 +342,8 @@ Object { 108, 124, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSParameterProperty", }, ], @@ -331,7 +351,9 @@ Object { 89, 129, ], + "returnType": undefined, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -351,7 +373,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -363,12 +388,15 @@ Object { }, }, "name": "Point", + "optional": false, "range": Array [ 62, 67, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 5, @@ -384,7 +412,9 @@ Object { 135, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, "exportKind": "value", "loc": Object { @@ -416,10 +446,12 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -431,11 +463,13 @@ Object { }, }, "name": "name", + "optional": false, "range": Array [ 200, 204, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -447,13 +481,13 @@ Object { "line": 9, }, }, - "optional": undefined, + "optional": false, "range": Array [ 200, 213, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -507,7 +541,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -519,11 +556,13 @@ Object { }, }, "name": "Id", + "optional": false, "range": Array [ 183, 185, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -540,6 +579,7 @@ Object { 223, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, "exportKind": "type", "loc": Object { @@ -577,7 +617,10 @@ Object { ], "type": "TSModuleBlock", }, + "declare": false, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -589,13 +632,14 @@ Object { }, }, "name": "B", + "optional": false, "range": Array [ 154, 155, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "module", "loc": Object { "end": Object { "column": 5, @@ -648,7 +692,10 @@ Object { ], "type": "TSModuleBlock", }, + "declare": false, + "global": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -660,13 +707,14 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, - "kind": "module", "loc": Object { "end": Object { "column": 1, diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot index 5b90f004775..948f990fb52 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot @@ -5,6 +5,7 @@ Object { "body": Array [ Object { "declare": true, + "global": false, "id": Object { "loc": Object { "end": Object { @@ -24,7 +25,6 @@ Object { "type": "Literal", "value": "hot-new-module", }, - "kind": "module", "loc": Object { "end": Object { "column": 32, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot index 43f913bf707..661e8e4736c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types array-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +75,7 @@ Object { ], "type": "TSArrayType", }, + "typeParameters": undefined, }, ], "comments": Array [], 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 693f5d114a9..911eba05248 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 @@ -4,7 +4,9 @@ exports[`typescript types conditional-infer-nested.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -16,11 +18,13 @@ Object { }, }, "name": "Unpacked", + "optional": false, "range": Array [ 5, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 3, @@ -66,11 +71,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -106,6 +113,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -117,11 +125,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -165,6 +175,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 5, @@ -176,11 +187,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 53, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -215,6 +228,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -226,11 +240,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 69, 70, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -258,6 +274,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -269,11 +286,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 83, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -294,6 +313,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -305,11 +325,13 @@ Object { }, }, "name": "Promise", + "optional": false, "range": Array [ 93, 100, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -354,6 +376,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -365,11 +388,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 107, 108, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -404,6 +429,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -415,11 +441,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 124, 125, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -454,6 +482,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -465,11 +494,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 112, 113, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -506,6 +537,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -517,11 +549,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 73, 74, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -558,6 +592,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -569,11 +604,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 45, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -606,6 +643,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -617,11 +655,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 48cb6977cbf..895938f15da 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 @@ -4,7 +4,9 @@ exports[`typescript types conditional-infer-simple.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -66,11 +71,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -87,10 +94,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -102,11 +111,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -118,13 +129,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 26, 37, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -173,6 +184,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -184,11 +196,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -201,10 +215,12 @@ Object { }, }, Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 39, @@ -216,11 +232,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 38, 39, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -232,13 +250,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 38, 48, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -287,6 +305,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 48, @@ -298,11 +317,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 47, 48, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -369,6 +390,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 54, @@ -380,11 +402,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 53, 54, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -417,6 +441,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -428,11 +453,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 index f4a26f22e90..522c462a14b 100644 --- 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 @@ -4,7 +4,9 @@ exports[`typescript types conditional-infer-with-constraint.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -16,11 +18,13 @@ Object { }, }, "name": "X3", + "optional": false, "range": Array [ 5, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -66,11 +71,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -123,6 +130,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -134,11 +142,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -213,6 +223,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 62, @@ -224,11 +235,13 @@ Object { }, }, "name": "MustBeNumber", + "optional": false, "range": Array [ 50, 62, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -259,6 +272,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 64, @@ -270,11 +284,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 63, 64, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -315,6 +331,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -326,11 +343,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -348,7 +367,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -360,11 +381,13 @@ Object { }, }, "name": "X4", + "optional": false, "range": Array [ 80, 82, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -399,6 +422,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -410,11 +434,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 88, 89, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -467,6 +493,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -478,11 +505,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 105, 106, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -539,6 +568,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -550,11 +580,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 129, 130, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -629,6 +661,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 86, @@ -640,11 +673,13 @@ Object { }, }, "name": "MustBeNumber", + "optional": false, "range": Array [ 149, 161, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -675,6 +710,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 88, @@ -686,11 +722,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 162, 163, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -731,6 +769,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -742,11 +781,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 83, 84, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -764,7 +805,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -776,11 +819,13 @@ Object { }, }, "name": "X5", + "optional": false, "range": Array [ 179, 181, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -815,6 +860,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -826,11 +872,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 187, 188, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -883,6 +931,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -894,11 +943,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 204, 205, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -939,6 +990,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -950,11 +1002,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 228, 229, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1029,6 +1083,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 71, @@ -1040,11 +1095,13 @@ Object { }, }, "name": "MustBeNumber", + "optional": false, "range": Array [ 233, 245, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -1075,6 +1132,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 73, @@ -1086,11 +1144,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 246, 247, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1131,6 +1191,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -1142,11 +1203,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 182, 183, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1164,7 +1227,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -1176,11 +1241,13 @@ Object { }, }, "name": "X6", + "optional": false, "range": Array [ 263, 265, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1215,6 +1282,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1226,11 +1294,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 271, 272, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1267,6 +1337,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -1278,11 +1349,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 288, 289, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1339,6 +1412,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -1350,11 +1424,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 297, 298, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1429,6 +1505,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 71, @@ -1440,11 +1517,13 @@ Object { }, }, "name": "MustBeNumber", + "optional": false, "range": Array [ 317, 329, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -1475,6 +1554,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 73, @@ -1486,11 +1566,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 330, 331, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1531,6 +1613,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -1542,11 +1625,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 266, 267, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1564,7 +1649,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -1576,11 +1663,13 @@ Object { }, }, "name": "X7", + "optional": false, "range": Array [ 347, 349, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1615,6 +1704,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -1626,11 +1716,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 355, 356, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1683,6 +1775,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -1694,11 +1787,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 372, 373, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1755,6 +1850,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 55, @@ -1766,11 +1862,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 396, 397, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -1845,6 +1943,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 75, @@ -1856,11 +1955,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 416, 417, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1893,6 +1994,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -1904,11 +2006,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 350, 351, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 9534b875bd9..d556be2bb33 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 @@ -4,7 +4,9 @@ exports[`typescript types conditional-infer.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -16,11 +18,13 @@ Object { }, }, "name": "Element", + "optional": false, "range": Array [ 5, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -55,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -66,11 +71,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -106,6 +113,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -117,11 +125,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 35, 36, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -164,6 +174,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -175,11 +186,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 46, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -214,6 +227,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -225,11 +239,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 42, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -262,6 +278,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -273,11 +290,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot index 35916e82f2e..876c8a65b99 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 45, @@ -144,6 +147,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot index 6c9a3014448..8f5bdbc813e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 47, @@ -144,6 +147,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot index 1b50ff5409d..6f8cbb5fcba 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 30, @@ -91,6 +94,7 @@ Object { }, }, "type": "TSConstructorType", + "typeParameters": undefined, }, }, }, @@ -112,6 +116,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot index 83a2680a653..b6b6fbdd8fd 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 21, @@ -91,6 +94,7 @@ Object { }, }, "type": "TSConstructorType", + "typeParameters": undefined, }, }, }, @@ -112,6 +116,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { 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 43b72d5dff0..6315190137c 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 25, @@ -53,6 +56,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -64,6 +68,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 15, 19, @@ -102,6 +107,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -113,11 +119,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -161,6 +169,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -172,11 +181,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 24, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -209,6 +220,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -220,11 +232,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -261,6 +275,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot index e74c46c3f4c..3ef5ac52bce 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 30, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -67,11 +71,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 7, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -137,6 +143,7 @@ Object { }, }, "type": "TSConstructorType", + "typeParameters": undefined, }, ], "range": Array [ @@ -166,6 +173,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot index e001f2adb02..9302a680a28 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 35, @@ -54,6 +57,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -65,12 +69,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -81,6 +88,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 26, @@ -137,6 +145,7 @@ Object { "type": "TSArrayType", }, }, + "value": undefined, }, ], "range": Array [ @@ -178,6 +187,7 @@ Object { }, }, "type": "TSConstructorType", + "typeParameters": undefined, }, }, }, @@ -199,6 +209,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot index 03af1a6c2c0..baa59e3376a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 42, @@ -53,6 +56,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -64,6 +68,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 21, @@ -105,6 +110,7 @@ Object { }, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -197,6 +203,7 @@ Object { }, }, "type": "TSConstructorType", + "typeParameters": undefined, }, }, }, @@ -218,6 +225,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { 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 3d0a9285487..f02012c203f 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 21, @@ -52,6 +55,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -63,6 +67,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 15, @@ -101,6 +106,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -112,11 +118,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -160,6 +168,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -171,11 +180,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -208,6 +219,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -219,11 +231,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -260,6 +274,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot index 8f523988734..842b56c9950 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 24, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -67,11 +71,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 7, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -136,6 +142,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, ], "range": Array [ @@ -165,6 +172,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot index 230bb8732e3..f643c7622c5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types function-with-array-destruction.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,8 +54,10 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "elements": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -63,11 +69,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, ], "loc": Object { @@ -80,6 +88,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 12, 20, @@ -160,7 +169,9 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot index b76768a62f8..e15775eab01 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types function-with-object-destruction.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -60,10 +65,12 @@ Object { "line": 1, }, }, + "optional": false, "properties": Array [ Object { "computed": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -75,11 +82,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "init", "loc": Object { @@ -93,6 +102,7 @@ Object { }, }, "method": false, + "optional": false, "range": Array [ 13, 14, @@ -100,6 +110,7 @@ Object { "shorthand": true, "type": "Property", "value": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -111,11 +122,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, }, ], @@ -199,7 +212,9 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot index deab56c6e00..b7b0cf57c2f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 31, @@ -53,6 +56,7 @@ Object { "params": Array [ Object { "argument": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -64,12 +68,15 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -80,6 +87,7 @@ Object { "line": 1, }, }, + "optional": false, "range": Array [ 8, 22, @@ -136,6 +144,7 @@ Object { "type": "TSArrayType", }, }, + "value": undefined, }, ], "range": Array [ @@ -177,6 +186,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, }, }, @@ -198,6 +208,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot index 92d4540bdcb..9d7b67352db 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 29, @@ -52,6 +55,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -63,6 +67,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 8, 20, @@ -143,6 +148,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, }, }, @@ -164,6 +170,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot index cee9ccaf884..fbb141e32dc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -18,6 +20,7 @@ Object { }, }, "name": "f", + "optional": false, "range": Array [ 4, 38, @@ -52,6 +55,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -63,6 +67,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 17, @@ -104,6 +109,7 @@ Object { }, }, Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -196,6 +202,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, }, }, @@ -217,6 +224,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot index 5017294dedb..ce7d3c96f62 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types index-signature-readonly.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,8 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 33, @@ -62,6 +68,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -73,6 +80,7 @@ Object { }, }, "name": "key", + "optional": false, "range": Array [ 25, 36, @@ -119,6 +127,7 @@ Object { 46, ], "readonly": true, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -162,6 +171,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot index 41c939be2fe..2cc1ba964e9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types index-signature-without-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,8 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 14, @@ -62,6 +68,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -73,6 +80,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 25, @@ -118,7 +126,10 @@ Object { 15, 27, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", + "typeAnnotation": undefined, }, ], "range": Array [ @@ -127,6 +138,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot index 305eb29adec..59bc2f21368 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types index-signature.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,8 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, + "export": false, "loc": Object { "end": Object { "column": 22, @@ -62,6 +68,7 @@ Object { }, "parameters": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -73,6 +80,7 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 16, 25, @@ -118,6 +126,8 @@ Object { 15, 35, ], + "readonly": false, + "static": false, "type": "TSIndexSignature", "typeAnnotation": Object { "loc": Object { @@ -161,6 +171,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot index 460df7a1501..703c2baac08 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 11, @@ -57,6 +60,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -68,11 +72,13 @@ Object { }, }, "name": "K", + "optional": false, "range": Array [ 9, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -103,6 +109,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -114,11 +121,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -148,6 +157,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot index 02601964ea1..0b85e594dad 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot @@ -7,8 +7,11 @@ Object { "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -20,11 +23,13 @@ Object { }, }, "name": "size", + "optional": false, "range": Array [ 24, 28, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -37,11 +42,13 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [], "range": Array [ 20, 39, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -76,11 +83,16 @@ Object { "type": "TSNumberKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -92,11 +104,13 @@ Object { }, }, "name": "size", + "optional": false, "range": Array [ 46, 50, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -109,8 +123,10 @@ Object { "line": 3, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -122,6 +138,7 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 51, 83, @@ -220,7 +237,11 @@ Object { 42, 85, ], + "readonly": false, + "returnType": undefined, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "loc": Object { @@ -239,7 +260,10 @@ Object { ], "type": "TSInterfaceBody", }, + "declare": false, + "extends": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -251,11 +275,13 @@ Object { }, }, "name": "Thing", + "optional": false, "range": Array [ 10, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -272,6 +298,7 @@ Object { 87, ], "type": "TSInterfaceDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], 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 7e56c87cf8b..904a7453e7f 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 @@ -4,7 +4,9 @@ exports[`typescript types intersection-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -16,11 +18,13 @@ Object { }, }, "name": "LinkedList", + "optional": false, "range": Array [ 5, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -71,6 +75,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -82,11 +87,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -103,10 +110,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -118,11 +127,13 @@ Object { }, }, "name": "next", + "optional": false, "range": Array [ 27, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -134,13 +145,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 27, 46, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -175,6 +186,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -186,11 +198,13 @@ Object { }, }, "name": "LinkedList", + "optional": false, "range": Array [ 33, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -221,6 +235,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -232,11 +247,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 44, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -286,6 +303,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -297,11 +315,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot index 3e1f064339e..3480afeff7e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 9, @@ -114,6 +117,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot index 724da7b1507..204be090cbd 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 8, @@ -95,6 +98,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot index 137bbede45a..863e84993a8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 12, @@ -95,6 +98,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { 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 ad9603c0953..4d666f1164b 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 @@ -4,7 +4,9 @@ exports[`typescript types mapped-named-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -16,11 +18,13 @@ Object { }, }, "name": "Test", + "optional": false, "range": Array [ 5, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -84,10 +88,12 @@ Object { ], "type": "TSLiteralType", }, + "optional": undefined, "range": Array [ 15, 49, ], + "readonly": undefined, "type": "TSMappedType", "typeAnnotation": Object { "indexType": Object { @@ -107,6 +113,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -118,11 +125,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 44, 45, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -153,6 +162,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -164,11 +174,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 42, 43, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -213,6 +225,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -224,11 +237,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -246,6 +261,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 4, @@ -257,11 +273,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 20, 21, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -298,6 +316,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -309,11 +328,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 b4f571e2c11..5c8253cce0f 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 46, @@ -18,6 +20,7 @@ Object { }, }, "name": "map", + "optional": false, "range": Array [ 4, 46, @@ -106,6 +109,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -117,11 +121,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -151,6 +157,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { 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 f3ba73b4aa5..e0a3f82a0f6 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 47, @@ -18,6 +20,7 @@ Object { }, }, "name": "map", + "optional": false, "range": Array [ 4, 47, @@ -106,6 +109,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -117,11 +121,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -151,6 +157,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { 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 cce96c961cc..e40f0c70620 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 45, @@ -18,6 +20,7 @@ Object { }, }, "name": "map", + "optional": false, "range": Array [ 4, 45, @@ -106,6 +109,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -117,11 +121,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 21, 22, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -151,6 +157,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { 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 27b7b9c9c4d..b1d3f6463b6 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -18,6 +20,7 @@ Object { }, }, "name": "map", + "optional": false, "range": Array [ 4, 27, @@ -51,11 +54,14 @@ Object { }, }, "nameType": null, + "optional": undefined, "range": Array [ 9, 27, ], + "readonly": undefined, "type": "TSMappedType", + "typeAnnotation": undefined, "typeParameter": Object { "constraint": Object { "loc": Object { @@ -87,6 +93,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -98,11 +105,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -132,6 +141,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { 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 1689f5647b9..8b69a493792 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 @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 35, @@ -18,6 +20,7 @@ Object { }, }, "name": "map", + "optional": false, "range": Array [ 4, 35, @@ -51,10 +54,12 @@ Object { }, }, "nameType": null, + "optional": undefined, "range": Array [ 9, 35, ], + "readonly": undefined, "type": "TSMappedType", "typeAnnotation": Object { "loc": Object { @@ -104,6 +109,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -115,11 +121,13 @@ Object { }, }, "name": "P", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -149,6 +157,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot index be471583c51..bc759904969 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types nested-types.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -376,6 +380,7 @@ Object { }, ], }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot index df6ae88ba5d..d1c75c15bc1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types object-literal-type-with-accessors.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -16,11 +18,13 @@ Object { }, }, "name": "Thing", + "optional": false, "range": Array [ 5, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,8 +54,11 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -63,11 +70,13 @@ Object { }, }, "name": "size", + "optional": false, "range": Array [ 21, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "get", "loc": Object { @@ -80,11 +89,13 @@ Object { "line": 2, }, }, + "optional": false, "params": Array [], "range": Array [ 17, 36, ], + "readonly": false, "returnType": Object { "loc": Object { "end": Object { @@ -119,11 +130,16 @@ Object { "type": "TSNumberKeyword", }, }, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, Object { + "accessibility": undefined, "computed": false, + "export": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -135,11 +151,13 @@ Object { }, }, "name": "size", + "optional": false, "range": Array [ 43, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "set", "loc": Object { @@ -152,8 +170,10 @@ Object { "line": 3, }, }, + "optional": false, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 43, @@ -165,6 +185,7 @@ Object { }, }, "name": "value", + "optional": false, "range": Array [ 48, 80, @@ -263,7 +284,11 @@ Object { 39, 82, ], + "readonly": false, + "returnType": undefined, + "static": false, "type": "TSMethodSignature", + "typeParameters": undefined, }, ], "range": Array [ @@ -272,6 +297,7 @@ Object { ], "type": "TSTypeLiteral", }, + "typeParameters": undefined, }, ], "comments": Array [], 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 index 26e233652d4..c920673605a 100644 --- 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 @@ -4,7 +4,9 @@ exports[`typescript types optional-variance-in-and-out.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 11, @@ -16,11 +18,13 @@ Object { }, }, "name": "Mapper", + "optional": false, "range": Array [ 5, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -61,6 +66,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 28, 32, @@ -99,6 +105,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -110,11 +117,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -158,6 +167,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -169,16 +179,19 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 37, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, "typeParameters": Object { "loc": Object { @@ -207,6 +220,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -218,11 +232,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 15, 16, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -246,6 +262,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -257,11 +274,13 @@ Object { }, }, "name": "U", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": true, "range": Array [ 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 index 9639322188c..7b510af7227 100644 --- 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 @@ -4,7 +4,9 @@ exports[`typescript types optional-variance-in-out.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -16,11 +18,13 @@ Object { }, }, "name": "Processor", + "optional": false, "range": Array [ 5, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -61,6 +66,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 28, 32, @@ -99,6 +105,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -110,11 +117,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -158,6 +167,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 38, @@ -169,16 +179,19 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 37, 38, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, "typeParameters": Object { "loc": Object { @@ -207,6 +220,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -218,11 +232,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": true, "range": Array [ 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 index bf2e85f702f..13960d9cfa4 100644 --- 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 @@ -4,7 +4,9 @@ exports[`typescript types optional-variance-in.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -16,11 +18,13 @@ Object { }, }, "name": "Consumer", + "optional": false, "range": Array [ 5, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -50,6 +54,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -61,6 +66,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 23, 27, @@ -99,6 +105,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -110,11 +117,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -160,6 +169,7 @@ Object { }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, "typeParameters": Object { "loc": Object { @@ -188,6 +198,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -199,11 +210,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 17, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ 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 index 04c6769229f..5bbd49f347f 100644 --- 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 @@ -4,7 +4,9 @@ exports[`typescript types optional-variance-out.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -16,11 +18,13 @@ Object { }, }, "name": "Provider", + "optional": false, "range": Array [ 5, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -86,6 +90,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 30, @@ -97,16 +102,19 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 29, 30, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, }, "type": "TSFunctionType", + "typeParameters": undefined, }, "typeParameters": Object { "loc": Object { @@ -135,6 +143,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -146,11 +155,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": true, "range": Array [ diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot index e029fb99516..a46af1bf983 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types parenthesized-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -90,6 +94,7 @@ Object { }, ], }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot index 8e22e5de774..49cd9577c3a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 27, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -67,11 +71,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 7, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -102,6 +108,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 18, @@ -113,11 +120,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 13, 18, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -184,6 +193,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot index 87577d72d64..a005225eba2 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 20, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -67,11 +71,13 @@ Object { }, }, "name": "Array", + "optional": false, "range": Array [ 7, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -130,6 +136,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot index 3f0393901da..ce1d4841241 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 8, @@ -56,6 +59,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -67,11 +71,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 7, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -95,6 +101,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot index 36df58b13db..cca9f93240b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types template-literal-type-1.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -16,11 +18,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -96,6 +100,7 @@ Object { ], "type": "TSLiteralType", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot index f8832d8c8ad..0988b939ff3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types template-literal-type-2.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 6, @@ -16,11 +18,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 5, 6, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -138,6 +142,7 @@ Object { }, ], }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot index c4d2582a33c..f1600354bd4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types template-literal-type-3.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -16,11 +18,13 @@ Object { }, }, "name": "Color", + "optional": false, "range": Array [ 5, 10, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -128,9 +132,12 @@ Object { }, ], }, + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -142,11 +149,13 @@ Object { }, }, "name": "Quantity", + "optional": false, "range": Array [ 34, 42, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -254,9 +263,12 @@ Object { }, ], }, + "typeParameters": undefined, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -268,11 +280,13 @@ Object { }, }, "name": "SeussFish", + "optional": false, "range": Array [ 65, 74, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -386,6 +400,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -397,11 +412,13 @@ Object { }, }, "name": "Quantity", + "optional": false, "range": Array [ 80, 88, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -422,6 +439,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -433,11 +451,13 @@ Object { }, }, "name": "Color", + "optional": false, "range": Array [ 91, 96, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -445,6 +465,7 @@ Object { }, ], }, + "typeParameters": undefined, }, ], "comments": Array [], 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 44900a50b51..1a71387ccff 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 @@ -4,7 +4,9 @@ exports[`typescript types template-literal-type-4.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -16,11 +18,13 @@ Object { }, }, "name": "EnthusiasticGreeting", + "optional": false, "range": Array [ 5, 25, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -183,6 +187,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 58, @@ -194,11 +199,13 @@ Object { }, }, "name": "Uppercase", + "optional": false, "range": Array [ 49, 58, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -229,6 +236,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 60, @@ -240,11 +248,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 59, 60, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -273,6 +283,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 76, @@ -284,11 +295,13 @@ Object { }, }, "name": "Lowercase", + "optional": false, "range": Array [ 67, 76, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -319,6 +332,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 78, @@ -330,11 +344,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 77, 78, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -363,6 +379,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 95, @@ -374,11 +391,13 @@ Object { }, }, "name": "Capitalize", + "optional": false, "range": Array [ 85, 95, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -409,6 +428,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 97, @@ -420,11 +440,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 96, 97, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -453,6 +475,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 116, @@ -464,11 +487,13 @@ Object { }, }, "name": "Uncapitalize", + "optional": false, "range": Array [ 104, 116, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -499,6 +524,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 118, @@ -510,11 +536,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 117, 118, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -571,6 +599,7 @@ Object { }, }, "name": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -582,11 +611,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 26, 27, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": Array [ @@ -604,7 +635,9 @@ Object { }, }, Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -616,11 +649,13 @@ Object { }, }, "name": "HELLO", + "optional": false, "range": Array [ 128, 133, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -654,6 +689,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -665,11 +701,13 @@ Object { }, }, "name": "EnthusiasticGreeting", + "optional": false, "range": Array [ 136, 156, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": Object { "loc": Object { @@ -727,6 +765,7 @@ Object { "type": "TSTypeParameterInstantiation", }, }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot index 5543bc1a3a0..bb1c7246b8d 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot @@ -4,13 +4,17 @@ exports[`typescript types this-type-expanded.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { "accessibility": "public", "computed": false, "declare": false, + "decorators": Array [], + "definite": false, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -22,11 +26,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -38,12 +44,13 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 12, 29, ], - "readonly": undefined, + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": Object { @@ -85,7 +92,9 @@ Object { Object { "accessibility": "public", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -97,11 +106,13 @@ Object { }, }, "name": "method", + "optional": false, "range": Array [ 40, 46, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -114,6 +125,7 @@ Object { "line": 4, }, }, + "optional": false, "override": false, "range": Array [ 33, @@ -121,6 +133,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -157,6 +170,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -168,11 +182,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 85, 86, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 80, @@ -213,6 +229,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -228,6 +245,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 26, @@ -239,6 +257,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 47, 57, @@ -319,12 +338,15 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "public", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -336,11 +358,13 @@ Object { }, }, "name": "method2", + "optional": false, "range": Array [ 102, 109, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -353,6 +377,7 @@ Object { "line": 8, }, }, + "optional": false, "override": false, "range": Array [ 95, @@ -360,6 +385,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -396,6 +422,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -407,11 +434,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 143, 144, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 138, @@ -452,6 +481,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -467,6 +497,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -478,6 +509,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 110, 117, @@ -516,6 +548,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -527,11 +560,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 116, 117, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -577,12 +612,15 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "public", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -594,11 +632,13 @@ Object { }, }, "name": "method3", + "optional": false, "range": Array [ 160, 167, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -611,6 +651,7 @@ Object { "line": 12, }, }, + "optional": false, "override": false, "range": Array [ 153, @@ -618,6 +659,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -625,7 +667,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -637,11 +681,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 198, 200, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -676,6 +722,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -687,11 +734,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 214, 215, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 209, @@ -717,7 +766,9 @@ Object { 203, 215, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -736,6 +787,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -757,6 +809,7 @@ Object { "argument": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -768,11 +821,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 228, 230, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -790,6 +845,7 @@ Object { 232, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -824,6 +880,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -839,6 +896,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 27, @@ -850,6 +908,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 168, 178, @@ -930,12 +989,15 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { "accessibility": "public", "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 16, @@ -947,11 +1009,13 @@ Object { }, }, "name": "method4", + "optional": false, "range": Array [ 248, 255, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -964,6 +1028,7 @@ Object { "line": 17, }, }, + "optional": false, "override": false, "range": Array [ 241, @@ -971,6 +1036,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -978,7 +1044,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 10, @@ -990,11 +1058,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 283, 285, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": Object { "async": false, @@ -1029,6 +1099,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 25, @@ -1040,11 +1111,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 299, 300, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 294, @@ -1070,7 +1143,9 @@ Object { 288, 300, ], + "returnType": undefined, "type": "ArrowFunctionExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -1089,6 +1164,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "var", "loc": Object { "end": Object { @@ -1110,6 +1186,7 @@ Object { "argument": Object { "arguments": Array [], "callee": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -1121,11 +1198,13 @@ Object { }, }, "name": "fn", + "optional": false, "range": Array [ 313, 315, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -1143,6 +1222,7 @@ Object { 317, ], "type": "CallExpression", + "typeParameters": undefined, }, "loc": Object { "end": Object { @@ -1177,6 +1257,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -1192,6 +1273,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -1203,6 +1285,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 256, 263, @@ -1241,6 +1324,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -1252,11 +1336,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 262, 263, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1302,11 +1388,15 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -1318,11 +1408,13 @@ Object { }, }, "name": "staticMethod", + "optional": false, "range": Array [ 333, 345, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -1335,6 +1427,7 @@ Object { "line": 22, }, }, + "optional": false, "override": false, "range": Array [ 326, @@ -1342,6 +1435,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -1378,6 +1472,7 @@ Object { }, "optional": false, "property": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -1389,11 +1484,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 381, 382, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": Array [ 376, @@ -1434,6 +1531,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -1449,6 +1547,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -1460,6 +1559,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 346, 353, @@ -1498,6 +1598,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 29, @@ -1509,11 +1610,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 352, 353, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1559,11 +1662,15 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -1575,11 +1682,13 @@ Object { }, }, "name": "typeof", + "optional": false, "range": Array [ 398, 404, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -1592,6 +1701,7 @@ Object { "line": 26, }, }, + "optional": false, "override": false, "range": Array [ 391, @@ -1599,6 +1709,7 @@ Object { ], "static": true, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -1673,6 +1784,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -1688,6 +1800,7 @@ Object { }, "params": Array [ Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -1699,6 +1812,7 @@ Object { }, }, "name": "this", + "optional": false, "range": Array [ 405, 412, @@ -1737,6 +1851,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -1748,11 +1863,13 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 411, 412, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -1798,6 +1915,7 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -1817,7 +1935,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -1829,12 +1950,15 @@ Object { }, }, "name": "A", + "optional": false, "range": Array [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -1850,7 +1974,9 @@ Object { 451, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot index d937da37206..dfb9f035b1e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot @@ -4,11 +4,15 @@ exports[`typescript types this-type.src 1`] = ` Object { "body": Array [ Object { + "abstract": false, "body": Object { "body": Array [ Object { + "accessibility": undefined, "computed": false, + "decorators": Array [], "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 7, @@ -20,11 +24,13 @@ Object { }, }, "name": "clone", + "optional": false, "range": Array [ 18, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "kind": "method", "loc": Object { @@ -37,6 +43,7 @@ Object { "line": 2, }, }, + "optional": false, "override": false, "range": Array [ 18, @@ -44,6 +51,7 @@ Object { ], "static": false, "type": "MethodDefinition", + "typeParameters": undefined, "value": Object { "async": false, "body": Object { @@ -99,6 +107,7 @@ Object { ], "type": "BlockStatement", }, + "declare": false, "expression": false, "generator": false, "id": null, @@ -152,6 +161,7 @@ Object { }, }, "type": "FunctionExpression", + "typeParameters": undefined, }, }, ], @@ -171,7 +181,10 @@ Object { ], "type": "ClassBody", }, + "declare": false, + "decorators": Array [], "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -183,12 +196,15 @@ Object { }, }, "name": "Message", + "optional": false, "range": Array [ 6, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, + "implements": Array [], "loc": Object { "end": Object { "column": 1, @@ -204,7 +220,9 @@ Object { 56, ], "superClass": null, + "superTypeParameters": undefined, "type": "ClassDeclaration", + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot index 5eafe9a264a..31ef4b0b176 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 9, @@ -77,6 +80,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot index 87f7351cba2..492c7640640 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 53, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 53, @@ -60,6 +63,7 @@ Object { "type": "TSStringKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -71,11 +75,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,6 +119,7 @@ Object { "type": "TSNumberKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -124,11 +131,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -202,6 +211,7 @@ Object { ], }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 32, @@ -213,11 +223,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 31, 32, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -273,6 +285,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot index 95e5a937bed..11505c596b0 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 34, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 34, @@ -60,6 +63,7 @@ Object { "type": "TSStringKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -71,11 +75,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -146,6 +152,7 @@ Object { "type": "TSArrayType", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 23, @@ -157,11 +164,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 22, 23, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -218,6 +227,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot index b62f8aacce6..f7ba5633816 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types tuple-named-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -58,6 +62,7 @@ Object { "type": "TSStringKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 13, @@ -69,11 +74,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 12, 13, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -111,6 +118,7 @@ Object { "type": "TSStringKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -122,11 +130,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 23, 24, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -162,6 +172,7 @@ Object { ], "type": "TSTupleType", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot index 0be4c086a37..a86de6ac771 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 40, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 40, @@ -60,6 +63,7 @@ Object { "type": "TSNumberKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 9, @@ -71,11 +75,13 @@ Object { }, }, "name": "a", + "optional": false, "range": Array [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -113,6 +119,7 @@ Object { "type": "TSNumberKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -124,11 +131,13 @@ Object { }, }, "name": "b", + "optional": false, "range": Array [ 19, 20, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -166,6 +175,7 @@ Object { "type": "TSNumberKeyword", }, "label": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -177,11 +187,13 @@ Object { }, }, "name": "c", + "optional": false, "range": Array [ 30, 31, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -237,6 +249,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot index b359d09d889..ad8897ffae0 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 44, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 44, @@ -199,6 +202,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot index 44f541f18ae..5171c6f702e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 28, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 28, @@ -146,6 +149,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot index cde8005681a..6ee73194cf8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types tuple-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -107,6 +111,7 @@ Object { ], "type": "TSTupleType", }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot index 82b74518a24..95c64e15805 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 31, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 31, @@ -129,6 +132,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot index bc7f85096c5..1e9de17e771 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 22, @@ -18,6 +20,7 @@ Object { }, }, "name": "obj", + "optional": false, "range": Array [ 4, 22, @@ -52,10 +55,12 @@ Object { }, "members": Array [ Object { + "accessibility": undefined, "computed": false, - "export": undefined, + "export": false, "initializer": undefined, "key": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 12, @@ -67,11 +72,13 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 11, 12, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -83,13 +90,13 @@ Object { "line": 1, }, }, - "optional": undefined, + "optional": false, "range": Array [ 11, 20, ], - "readonly": undefined, - "static": undefined, + "readonly": false, + "static": false, "type": "TSPropertySignature", "typeAnnotation": Object { "loc": Object { @@ -153,6 +160,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot index 3b8b707334e..d983168c35e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 14, @@ -73,6 +76,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 14, @@ -84,11 +88,13 @@ Object { }, }, "name": "T", + "optional": false, "range": Array [ 13, 14, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -113,6 +119,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -133,7 +140,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -145,6 +154,7 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 20, 36, @@ -221,6 +231,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot index c708076ab55..7c6652192d3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 21, @@ -18,6 +20,7 @@ Object { }, }, "name": "self", + "optional": false, "range": Array [ 4, 21, @@ -94,6 +97,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -114,7 +118,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -126,6 +132,7 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 27, 47, @@ -181,6 +188,7 @@ Object { 47, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 24, @@ -192,11 +200,13 @@ Object { }, }, "name": "foo", + "optional": false, "range": Array [ 44, 47, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TSQualifiedName", }, @@ -237,6 +247,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot index 4215d60c393..b31a8682418 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 20, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 20, @@ -42,6 +45,7 @@ Object { "typeAnnotation": Object { "exprName": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -53,11 +57,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,6 +80,7 @@ Object { 17, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -85,11 +92,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TSQualifiedName", }, @@ -137,6 +146,7 @@ Object { ], "type": "TSTypeReference", "typeName": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 19, @@ -148,11 +158,13 @@ Object { }, }, "name": "w", + "optional": false, "range": Array [ 18, 19, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -184,6 +196,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot index 43036c5b34a..14ef83b3343 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -18,6 +20,7 @@ Object { }, }, "name": "x", + "optional": false, "range": Array [ 4, 17, @@ -42,6 +45,7 @@ Object { "typeAnnotation": Object { "exprName": Object { "left": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 15, @@ -53,11 +57,13 @@ Object { }, }, "name": "y", + "optional": false, "range": Array [ 14, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -74,6 +80,7 @@ Object { 17, ], "right": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 17, @@ -85,11 +92,13 @@ Object { }, }, "name": "z", + "optional": false, "range": Array [ 16, 17, ], "type": "Identifier", + "typeAnnotation": undefined, }, "type": "TSQualifiedName", }, @@ -130,6 +139,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot index 7caed90984d..613fbde6cd3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot @@ -6,7 +6,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 36, @@ -18,6 +20,7 @@ Object { }, }, "name": "union", + "optional": false, "range": Array [ 4, 36, @@ -129,6 +132,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -149,7 +153,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 33, @@ -161,6 +167,7 @@ Object { }, }, "name": "intersection", + "optional": false, "range": Array [ 42, 71, @@ -255,6 +262,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -275,7 +283,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -287,6 +297,7 @@ Object { }, }, "name": "precedence1", + "optional": false, "range": Array [ 77, 115, @@ -417,6 +428,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { @@ -437,7 +449,9 @@ Object { Object { "declarations": Array [ Object { + "definite": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 42, @@ -449,6 +463,7 @@ Object { }, }, "name": "precedence2", + "optional": false, "range": Array [ 121, 159, @@ -579,6 +594,7 @@ Object { "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": Object { "end": Object { diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot index 54b41ae14a4..b4b333c34ac 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot @@ -4,7 +4,9 @@ exports[`typescript types union-type.src 1`] = ` Object { "body": Array [ Object { + "declare": false, "id": Object { + "decorators": Array [], "loc": Object { "end": Object { "column": 8, @@ -16,11 +18,13 @@ Object { }, }, "name": "Foo", + "optional": false, "range": Array [ 5, 8, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": Object { "end": Object { @@ -90,6 +94,7 @@ Object { }, ], }, + "typeParameters": undefined, }, ], "comments": Array [], diff --git a/packages/typescript-estree/tools/test-utils.ts b/packages/typescript-estree/tools/test-utils.ts index c8ebbd9ceca..81121274b25 100644 --- a/packages/typescript-estree/tools/test-utils.ts +++ b/packages/typescript-estree/tools/test-utils.ts @@ -1,15 +1,9 @@ -import { join, resolve } from 'path'; - import type { ParseAndGenerateServicesResult, TSESTree, TSESTreeOptions, } from '../src'; -import { - clearCaches, - parse as parserParse, - parseAndGenerateServices, -} from '../src'; +import { parse as parserParse, parseAndGenerateServices } from '../src'; export function parseCodeAndGenerateServices( code: string, @@ -90,7 +84,7 @@ export function deeplyCopy(ast: T): T { type UnknownObject = Record; -function isObjectLike(value: unknown | null): value is UnknownObject { +function isObjectLike(value: unknown): value is UnknownObject { return ( typeof value === 'object' && !(value instanceof RegExp) && value != null ); @@ -159,41 +153,3 @@ export function omitDeep( return visit(root as UnknownObject, null); } - -interface CreateAndPrepareParseConfig { - code: string; - config: TSESTreeOptions; - projectDirectory: string; -} - -const FIXTURES_DIR = join(__dirname, '../tests/fixtures/simpleProject'); - -export function createAndPrepareParseConfig(): CreateAndPrepareParseConfig { - beforeEach(() => { - clearCaches(); - }); - - const projectDirectory = resolve(FIXTURES_DIR, '../moduleResolver'); - - const code = ` - import { something } from '__PLACEHOLDER__'; - - something(); - `; - - const config: TSESTreeOptions = { - comment: true, - filePath: resolve(projectDirectory, 'file.ts'), - loc: true, - project: './tsconfig.json', - range: true, - tokens: true, - tsconfigRootDir: projectDirectory, - }; - - return { - code, - config, - projectDirectory, - }; -} diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 4ed4dd69074..7c6579db8f0 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,209 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) +* **utils:** removed `TRuleListener` generic from the `createRule` ([#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036)) ([361f8bc](https://github.com/typescript-eslint/typescript-eslint/commit/361f8bcebe588fc7410a53e002c55118b0bfee85)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* drop support for ESLint v6 ([#5972](https://github.com/typescript-eslint/typescript-eslint/issues/5972)) ([bda806d](https://github.com/typescript-eslint/typescript-eslint/commit/bda806d78ee46133587d9383baff52d796a594e5)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* fork json schema types for better compat with ESLint rule validation ([#6963](https://github.com/typescript-eslint/typescript-eslint/issues/6963)) ([a4967f2](https://github.com/typescript-eslint/typescript-eslint/commit/a4967f2e8cc7b0432d8dfe804772e60042c5384c)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove `RuleTester` in `/utils` in favour of the new `/rule-tester` package ([#6816](https://github.com/typescript-eslint/typescript-eslint/issues/6816)) ([c33f497](https://github.com/typescript-eslint/typescript-eslint/commit/c33f497ad8aec7c123c7374f7aff3e24025fe861)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* **utils:** remove (ts-)eslint-scope types ([#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256)) ([df54175](https://github.com/typescript-eslint/typescript-eslint/commit/df541751c6510f5d15d863f515cff3748fd9e688)) +* **utils:** remove obsolete `meta.docs.suggestion` rule type ([#5967](https://github.com/typescript-eslint/typescript-eslint/issues/5967)) ([f424b2a](https://github.com/typescript-eslint/typescript-eslint/commit/f424b2a519595283be01149f0e13eb7f869bd247)) + + +### BREAKING CHANGES + +* drop support for ESLint v6 +* drops support for node v17 +* **utils:** Removes `meta.docs.suggestion` property +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/utils + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/utils diff --git a/packages/utils/README.md b/packages/utils/README.md index 8013675d962..7ba750090e9 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -5,6 +5,8 @@ [![NPM Version](https://img.shields.io/npm/v/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) [![NPM Downloads](https://img.shields.io/npm/dm/@typescript-eslint/utils.svg?style=flat-square)](https://www.npmjs.com/package/@typescript-eslint/utils) -👉 See **https://typescript-eslint.io/architecture/utils** for documentation on this package. +👉 See **https://typescript-eslint.io/packages/utils** for documentation on this package. > See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code. + + diff --git a/packages/utils/package.json b/packages/utils/package.json index db76f5badf6..deddb732b80 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,22 +1,45 @@ { "name": "@typescript-eslint/utils", - "version": "5.56.0", + "version": "6.0.0", "description": "Utilities for working with TypeScript + ESLint together", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", - "_ts3.4", + "_ts4.3", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./ast-utils": { + "types": "./dist/ast-utils/index.d.ts", + "default": "./dist/ast-utils/index.js" + }, + "./eslint-utils": { + "types": "./dist/eslint-utils/index.d.ts", + "default": "./dist/eslint-utils/index.js" + }, + "./eslint-utils/rule-tester": { + "types": "./dist/eslint-utils/rule-tester/RuleTester.d.ts", + "default": "./dist/eslint-utils/rule-tester/RuleTester.js" + }, + "./json-schema": { + "types": "./dist/json-schema.d.ts", + "default": "./dist/json-schema.js" + }, + "./ts-eslint": { + "types": "./dist/ts-eslint/index.d.ts", + "default": "./dist/ts-eslint/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,33 +49,35 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", + "postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/typescript-estree": "5.56.0", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "semver": "^7.5.4" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.56.0", + "@typescript-eslint/parser": "6.0.0", "typescript": "*" }, "funding": { @@ -60,9 +85,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } } diff --git a/packages/utils/project.json b/packages/utils/project.json index c38b32ab3a2..7874891eec9 100644 --- a/packages/utils/project.json +++ b/packages/utils/project.json @@ -5,10 +5,11 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/utils/**/*.ts"] + "lintFilePatterns": ["packages/utils/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/utils/src/ast-utils/eslint-utils/PatternMatcher.ts b/packages/utils/src/ast-utils/eslint-utils/PatternMatcher.ts index 0cf5708f82e..639677087bf 100644 --- a/packages/utils/src/ast-utils/eslint-utils/PatternMatcher.ts +++ b/packages/utils/src/ast-utils/eslint-utils/PatternMatcher.ts @@ -49,8 +49,9 @@ interface PatternMatcher { * * @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#patternmatcher-class} */ -const PatternMatcher = eslintUtils.PatternMatcher as { - new (pattern: RegExp, options?: { escaped?: boolean }): PatternMatcher; -}; +const PatternMatcher = eslintUtils.PatternMatcher as new ( + pattern: RegExp, + options?: { escaped?: boolean }, +) => PatternMatcher; export { PatternMatcher }; diff --git a/packages/utils/src/ast-utils/eslint-utils/ReferenceTracker.ts b/packages/utils/src/ast-utils/eslint-utils/ReferenceTracker.ts index 9e0841fb4de..e71c75d6d51 100644 --- a/packages/utils/src/ast-utils/eslint-utils/ReferenceTracker.ts +++ b/packages/utils/src/ast-utils/eslint-utils/ReferenceTracker.ts @@ -50,7 +50,7 @@ interface ReferenceTrackerStatic { * If this is `"strict"`, the method binds CommonJS modules to the default export. Otherwise, the method binds * CommonJS modules to both the default export and named exports. Optional. Default is `"strict"`. */ - mode?: 'strict' | 'legacy'; + mode?: 'legacy' | 'strict'; /** * The name list of Global Object. Optional. Default is `["global", "globalThis", "self", "window"]`. */ @@ -69,7 +69,7 @@ namespace ReferenceTracker { export type CALL = ReferenceTrackerStatic['CALL']; export type CONSTRUCT = ReferenceTrackerStatic['CONSTRUCT']; export type ESM = ReferenceTrackerStatic['ESM']; - export type ReferenceType = READ | CALL | CONSTRUCT; + export type ReferenceType = CALL | CONSTRUCT | READ; // eslint-disable-next-line @typescript-eslint/no-explicit-any export type TraceMap = Record>; export interface TraceMapElement { diff --git a/packages/utils/src/ast-utils/eslint-utils/astUtilities.ts b/packages/utils/src/ast-utils/eslint-utils/astUtilities.ts index e57046ca12d..797585f34a5 100644 --- a/packages/utils/src/ast-utils/eslint-utils/astUtilities.ts +++ b/packages/utils/src/ast-utils/eslint-utils/astUtilities.ts @@ -10,9 +10,9 @@ import type { TSESTree } from '../../ts-estree'; */ const getFunctionHeadLocation = eslintUtils.getFunctionHeadLocation as ( node: + | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression, + | TSESTree.FunctionExpression, sourceCode: TSESLint.SourceCode, ) => TSESTree.SourceLocation; @@ -23,9 +23,9 @@ const getFunctionHeadLocation = eslintUtils.getFunctionHeadLocation as ( */ const getFunctionNameWithKind = eslintUtils.getFunctionNameWithKind as ( node: + | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression - | TSESTree.ArrowFunctionExpression, + | TSESTree.FunctionExpression, sourceCode?: TSESLint.SourceCode, ) => string; @@ -39,8 +39,8 @@ const getFunctionNameWithKind = eslintUtils.getFunctionNameWithKind as ( const getPropertyName = eslintUtils.getPropertyName as ( node: | TSESTree.MemberExpression - | TSESTree.Property | TSESTree.MethodDefinition + | TSESTree.Property | TSESTree.PropertyDefinition, initialScope?: TSESLint.Scope.Scope, ) => string | null; diff --git a/packages/utils/src/ast-utils/eslint-utils/scopeAnalysis.ts b/packages/utils/src/ast-utils/eslint-utils/scopeAnalysis.ts index 563c51c7782..43199ce0553 100644 --- a/packages/utils/src/ast-utils/eslint-utils/scopeAnalysis.ts +++ b/packages/utils/src/ast-utils/eslint-utils/scopeAnalysis.ts @@ -10,7 +10,7 @@ import type { TSESTree } from '../../ts-estree'; */ const findVariable = eslintUtils.findVariable as ( initialScope: TSESLint.Scope.Scope, - nameOrNode: string | TSESTree.Identifier, + nameOrNode: TSESTree.Identifier | string, ) => TSESLint.Scope.Variable | null; /** diff --git a/packages/utils/src/ast-utils/helpers.ts b/packages/utils/src/ast-utils/helpers.ts index 64e7e796eed..afe8a6fede8 100644 --- a/packages/utils/src/ast-utils/helpers.ts +++ b/packages/utils/src/ast-utils/helpers.ts @@ -3,7 +3,7 @@ import type { AST_NODE_TYPES, AST_TOKEN_TYPES, TSESTree } from '../ts-estree'; type ObjectEntry = BaseType extends unknown ? [keyof BaseType, BaseType[keyof BaseType]] : never; -type ObjectEntries = Array>; +type ObjectEntries = ObjectEntry[]; export const isNodeOfType = (nodeType: NodeType) => @@ -28,12 +28,12 @@ export const isNodeOfTypeWithConditions = < conditions: Conditions, ): (( node: TSESTree.Node | null | undefined, -) => node is ExtractedNode & Conditions) => { +) => node is Conditions & ExtractedNode) => { const entries = Object.entries(conditions) as ObjectEntries; return ( node: TSESTree.Node | null | undefined, - ): node is ExtractedNode & Conditions => + ): node is Conditions & ExtractedNode => node?.type === nodeType && entries.every(([key, value]) => node[key as keyof TSESTree.Node] === value); }; @@ -47,12 +47,12 @@ export const isTokenOfTypeWithConditions = < conditions: Conditions, ): (( token: TSESTree.Token | null | undefined, -) => token is ExtractedToken & Conditions) => { +) => token is Conditions & ExtractedToken) => { const entries = Object.entries(conditions) as ObjectEntries; return ( token: TSESTree.Token | null | undefined, - ): token is ExtractedToken & Conditions => + ): token is Conditions & ExtractedToken => token?.type === tokenType && entries.every( ([key, value]) => token[key as keyof TSESTree.Token] === value, @@ -69,6 +69,6 @@ export const isNotTokenOfTypeWithConditions = conditions: Conditions, ): (( token: TSESTree.Token | null | undefined, - ) => token is Exclude) => - (token): token is Exclude => + ) => token is Exclude) => + (token): token is Exclude => !isTokenOfTypeWithConditions(tokenType, conditions)(token); diff --git a/packages/utils/src/ast-utils/predicates.ts b/packages/utils/src/ast-utils/predicates.ts index 36e08ee5c42..2d0c3831a87 100644 --- a/packages/utils/src/ast-utils/predicates.ts +++ b/packages/utils/src/ast-utils/predicates.ts @@ -116,7 +116,7 @@ const isConstructor = isNodeOfTypeWithConditions( */ function isSetter( node: TSESTree.Node | undefined, -): node is (TSESTree.MethodDefinition | TSESTree.Property) & { kind: 'set' } { +): node is { kind: 'set' } & (TSESTree.MethodDefinition | TSESTree.Property) { return ( !!node && (node.type === AST_NODE_TYPES.MethodDefinition || diff --git a/packages/utils/src/eslint-utils/RuleCreator.ts b/packages/utils/src/eslint-utils/RuleCreator.ts index dedf3043121..51784d7cf76 100644 --- a/packages/utils/src/eslint-utils/RuleCreator.ts +++ b/packages/utils/src/eslint-utils/RuleCreator.ts @@ -9,35 +9,35 @@ import { applyDefault } from './applyDefault'; // we automatically add the url export type NamedCreateRuleMetaDocs = Omit; -export type NamedCreateRuleMeta = { +export type NamedCreateRuleMeta = Omit< + RuleMetaData, + 'docs' +> & { docs: NamedCreateRuleMetaDocs; -} & Omit, 'docs'>; +}; export interface RuleCreateAndOptions< TOptions extends readonly unknown[], TMessageIds extends string, - TRuleListener extends RuleListener, > { create: ( context: Readonly>, optionsWithDefault: Readonly, - ) => TRuleListener; + ) => RuleListener; defaultOptions: Readonly; } export interface RuleWithMeta< TOptions extends readonly unknown[], TMessageIds extends string, - TRuleListener extends RuleListener, -> extends RuleCreateAndOptions { +> extends RuleCreateAndOptions { meta: RuleMetaData; } export interface RuleWithMetaAndName< TOptions extends readonly unknown[], TMessageIds extends string, - TRuleListener extends RuleListener, -> extends RuleCreateAndOptions { +> extends RuleCreateAndOptions { meta: NamedCreateRuleMeta; name: string; } @@ -54,15 +54,15 @@ export function RuleCreator(urlCreator: (ruleName: string) => string) { return function createNamedRule< TOptions extends readonly unknown[], TMessageIds extends string, - TRuleListener extends RuleListener = RuleListener, >({ name, meta, ...rule - }: Readonly< - RuleWithMetaAndName - >): RuleModule { - return createRule({ + }: Readonly>): RuleModule< + TMessageIds, + TOptions + > { + return createRule({ meta: { ...meta, docs: { @@ -84,20 +84,18 @@ export function RuleCreator(urlCreator: (ruleName: string) => string) { function createRule< TOptions extends readonly unknown[], TMessageIds extends string, - TRuleListener extends RuleListener = RuleListener, >({ create, defaultOptions, meta, -}: Readonly>): RuleModule< +}: Readonly>): RuleModule< TMessageIds, - TOptions, - TRuleListener + TOptions > { return { create( context: Readonly>, - ): TRuleListener { + ): RuleListener { const optionsWithDefault = applyDefault(defaultOptions, context.options); return create(context, optionsWithDefault); }, diff --git a/packages/utils/src/eslint-utils/batchedSingleLineTests.ts b/packages/utils/src/eslint-utils/batchedSingleLineTests.ts deleted file mode 100644 index fcd15210e48..00000000000 --- a/packages/utils/src/eslint-utils/batchedSingleLineTests.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { - InvalidTestCase, - ValidTestCase, -} from '../eslint-utils/rule-tester/RuleTester'; - -/** - * Converts a batch of single line tests into a number of separate test cases. - * This makes it easier to write tests which use the same options. - * - * Why wouldn't you just leave them as one test? - * Because it makes the test error messages harder to decipher. - * This way each line will fail separately, instead of them all failing together. - */ -function batchedSingleLineTests>( - test: ValidTestCase, -): ValidTestCase[]; -/** - * Converts a batch of single line tests into a number of separate test cases. - * This makes it easier to write tests which use the same options. - * - * Why wouldn't you just leave them as one test? - * Because it makes the test error messages harder to decipher. - * This way each line will fail separately, instead of them all failing together. - * - * Make sure you have your line numbers correct for error reporting, as it will match - * the line numbers up with the split tests! - */ -function batchedSingleLineTests< - TMessageIds extends string, - TOptions extends Readonly, ->( - test: InvalidTestCase, -): InvalidTestCase[]; -function batchedSingleLineTests< - TMessageIds extends string, - TOptions extends Readonly, ->( - options: ValidTestCase | InvalidTestCase, -): (ValidTestCase | InvalidTestCase)[] { - // -- eslint counts lines from 1 - const lineOffset = options.code.startsWith('\n') ? 2 : 1; - const output = - 'output' in options && options.output - ? options.output.trim().split('\n') - : null; - return options.code - .trim() - .split('\n') - .map((code, i) => { - const lineNum = i + lineOffset; - const errors = - 'errors' in options - ? options.errors.filter(e => e.line === lineNum) - : []; - const returnVal = { - ...options, - code, - errors: errors.map(e => ({ - ...e, - line: 1, - })), - }; - if (output?.[i]) { - return { - ...returnVal, - output: output[i], - }; - } - return returnVal; - }); -} - -export { batchedSingleLineTests }; diff --git a/packages/utils/src/eslint-utils/deepMerge.ts b/packages/utils/src/eslint-utils/deepMerge.ts index 78c2920d8d0..85412ed399d 100644 --- a/packages/utils/src/eslint-utils/deepMerge.ts +++ b/packages/utils/src/eslint-utils/deepMerge.ts @@ -5,9 +5,7 @@ type ObjectLike = Record; * @param obj an object * @returns `true` if obj is an object */ -function isObjectNotArray( - obj: unknown | unknown[], -): obj is T { +function isObjectNotArray(obj: unknown): obj is T { return typeof obj === 'object' && obj != null && !Array.isArray(obj); } diff --git a/packages/utils/src/eslint-utils/getParserServices.ts b/packages/utils/src/eslint-utils/getParserServices.ts index cb04d6cc93d..4b65afe3cf6 100644 --- a/packages/utils/src/eslint-utils/getParserServices.ts +++ b/packages/utils/src/eslint-utils/getParserServices.ts @@ -1,36 +1,83 @@ import type * as TSESLint from '../ts-eslint'; -import type { ParserServices } from '../ts-estree'; +import type { + ParserServices, + ParserServicesWithTypeInformation, +} from '../ts-estree'; const ERROR_MESSAGE = 'You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.'; /** - * Try to retrieve typescript parser service from context + * Try to retrieve type-aware parser service from context. + * This **_will_** throw if it is not available. */ function getParserServices< TMessageIds extends string, TOptions extends readonly unknown[], >( context: Readonly>, +): ParserServicesWithTypeInformation; +/** + * Try to retrieve type-aware parser service from context. + * This **_will_** throw if it is not available. + */ +function getParserServices< + TMessageIds extends string, + TOptions extends readonly unknown[], +>( + context: Readonly>, + allowWithoutFullTypeInformation: false, +): ParserServicesWithTypeInformation; +/** + * Try to retrieve type-aware parser service from context. + * This **_will not_** throw if it is not available. + */ +function getParserServices< + TMessageIds extends string, + TOptions extends readonly unknown[], +>( + context: Readonly>, + allowWithoutFullTypeInformation: true, +): ParserServices; +/** + * Try to retrieve type-aware parser service from context. + * This may or may not throw if it is not available, depending on if `allowWithoutFullTypeInformation` is `true` + */ +function getParserServices< + TMessageIds extends string, + TOptions extends readonly unknown[], +>( + context: Readonly>, + allowWithoutFullTypeInformation: boolean, +): ParserServices; + +function getParserServices( + context: Readonly>, allowWithoutFullTypeInformation = false, ): ParserServices { - // backwards compatibility check - // old versions of the parser would not return any parserServices unless parserOptions.project was set + // This check is unnecessary if the user is using the latest version of our parser. + // + // However the world isn't perfect: + // - Users often use old parser versions. + // Old versions of the parser would not return any parserServices unless parserOptions.project was set. + // - Users sometimes use parsers that aren't @typescript-eslint/parser + // Other parsers won't return the parser services we expect (if they return any at all). + // + // This check allows us to handle bad user setups whilst providing a nice user-facing + // error message explaining the problem. if ( - !context.parserServices?.program || - !context.parserServices.esTreeNodeToTSNodeMap || - !context.parserServices.tsNodeToESTreeNodeMap + context.parserServices?.esTreeNodeToTSNodeMap == null || + context.parserServices.tsNodeToESTreeNodeMap == null ) { throw new Error(ERROR_MESSAGE); } - const hasFullTypeInformation = - context.parserServices.hasFullTypeInformation ?? - /* backwards compatible */ true; - // if a rule requires full type information, then hard fail if it doesn't exist // this forces the user to supply parserOptions.project - if (!hasFullTypeInformation && !allowWithoutFullTypeInformation) { + if ( + context.parserServices.program == null && + !allowWithoutFullTypeInformation + ) { throw new Error(ERROR_MESSAGE); } diff --git a/packages/utils/src/eslint-utils/index.ts b/packages/utils/src/eslint-utils/index.ts index a3d0cb75245..baf3e82bc65 100644 --- a/packages/utils/src/eslint-utils/index.ts +++ b/packages/utils/src/eslint-utils/index.ts @@ -1,8 +1,6 @@ export * from './applyDefault'; -export * from './batchedSingleLineTests'; export * from './getParserServices'; export * from './InferTypesFromRule'; export * from './RuleCreator'; -export * from './rule-tester/RuleTester'; export * from './deepMerge'; export * from './nullThrows'; diff --git a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts b/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts deleted file mode 100644 index 623157ed858..00000000000 --- a/packages/utils/src/eslint-utils/rule-tester/RuleTester.ts +++ /dev/null @@ -1,314 +0,0 @@ -import type * as TSESLintParserType from '@typescript-eslint/parser'; -import assert from 'assert'; -import { version as eslintVersion } from 'eslint/package.json'; -import * as path from 'path'; -import * as semver from 'semver'; - -import type { ParserOptions } from '../../ts-eslint/ParserOptions'; -import type { RuleModule } from '../../ts-eslint/Rule'; -import type { RuleTesterTestFrameworkFunction } from '../../ts-eslint/RuleTester'; -import * as BaseRuleTester from '../../ts-eslint/RuleTester'; -import { deepMerge } from '../deepMerge'; -import type { DependencyConstraint } from './dependencyConstraints'; -import { satisfiesAllDependencyConstraints } from './dependencyConstraints'; - -const TS_ESLINT_PARSER = '@typescript-eslint/parser'; -const ERROR_MESSAGE = `Do not set the parser at the test level unless you want to use a parser other than ${TS_ESLINT_PARSER}`; - -type RuleTesterConfig = Omit & { - parser: typeof TS_ESLINT_PARSER; - /** - * Constraints that must pass in the current environment for any tests to run - */ - dependencyConstraints?: DependencyConstraint; -}; - -interface InvalidTestCase< - TMessageIds extends string, - TOptions extends Readonly, -> extends BaseRuleTester.InvalidTestCase { - /** - * Constraints that must pass in the current environment for the test to run - */ - dependencyConstraints?: DependencyConstraint; -} -interface ValidTestCase> - extends BaseRuleTester.ValidTestCase { - /** - * Constraints that must pass in the current environment for the test to run - */ - dependencyConstraints?: DependencyConstraint; -} -interface RunTests< - TMessageIds extends string, - TOptions extends Readonly, -> { - // RuleTester.run also accepts strings for valid cases - readonly valid: readonly (ValidTestCase | string)[]; - readonly invalid: readonly InvalidTestCase[]; -} - -type AfterAll = (fn: () => void) => void; - -function isDescribeWithSkip( - value: unknown, -): value is RuleTesterTestFrameworkFunction & { - skip: RuleTesterTestFrameworkFunction; -} { - return ( - typeof value === 'object' && - value != null && - 'skip' in value && - typeof (value as Record).skip === 'function' - ); -} - -class RuleTester extends BaseRuleTester.RuleTester { - readonly #baseOptions: RuleTesterConfig; - - static #afterAll: AfterAll | undefined; - /** - * If you supply a value to this property, the rule tester will call this instead of using the version defined on - * the global namespace. - */ - static get afterAll(): AfterAll { - return ( - this.#afterAll ?? - (typeof afterAll === 'function' ? afterAll : (): void => {}) - ); - } - static set afterAll(value: AfterAll | undefined) { - this.#afterAll = value; - } - - private get staticThis(): typeof RuleTester { - // the cast here is due to https://github.com/microsoft/TypeScript/issues/3841 - return this.constructor as typeof RuleTester; - } - - constructor(baseOptions: RuleTesterConfig) { - // eslint will hard-error if you include non-standard top-level properties - const { dependencyConstraints: _, ...baseOptionsSafeForESLint } = - baseOptions; - super({ - ...baseOptionsSafeForESLint, - parserOptions: { - ...baseOptions.parserOptions, - warnOnUnsupportedTypeScriptVersion: - baseOptions.parserOptions?.warnOnUnsupportedTypeScriptVersion ?? - false, - }, - // as of eslint 6 you have to provide an absolute path to the parser - // but that's not as clean to type, this saves us trying to manually enforce - // that contributors require.resolve everything - parser: require.resolve(baseOptions.parser), - }); - - this.#baseOptions = baseOptions; - - // make sure that the parser doesn't hold onto file handles between tests - // on linux (i.e. our CI env), there can be very a limited number of watch handles available - this.staticThis.afterAll(() => { - try { - // instead of creating a hard dependency, just use a soft require - // a bit weird, but if they're using this tooling, it'll be installed - const parser = require(TS_ESLINT_PARSER) as typeof TSESLintParserType; - parser.clearCaches(); - } catch { - // ignored on purpose - } - }); - } - private getFilename(testOptions?: ParserOptions): string { - const resolvedOptions = deepMerge( - this.#baseOptions.parserOptions, - testOptions, - ) as ParserOptions; - const filename = `file.ts${resolvedOptions.ecmaFeatures?.jsx ? 'x' : ''}`; - if (resolvedOptions.project) { - return path.join( - resolvedOptions.tsconfigRootDir != null - ? resolvedOptions.tsconfigRootDir - : process.cwd(), - filename, - ); - } - return filename; - } - - // as of eslint 6 you have to provide an absolute path to the parser - // If you don't do that at the test level, the test will fail somewhat cryptically... - // This is a lot more explicit - run>( - name: string, - rule: RuleModule, - testsReadonly: RunTests, - ): void { - if ( - this.#baseOptions.dependencyConstraints && - !satisfiesAllDependencyConstraints( - this.#baseOptions.dependencyConstraints, - ) - ) { - if (isDescribeWithSkip(this.staticThis.describe)) { - // for frameworks like mocha or jest that have a "skip" version of their function - // we can provide a nice skipped test! - this.staticThis.describe.skip(name, () => { - this.staticThis.it( - 'All tests skipped due to unsatisfied constructor dependency constraints', - () => {}, - ); - }); - } else { - // otherwise just declare an empty test - this.staticThis.describe(name, () => { - this.staticThis.it( - 'All tests skipped due to unsatisfied constructor dependency constraints', - () => { - // some frameworks error if there are no assertions - assert.equal(true, true); - }, - ); - }); - } - - // don't run any tests because we don't match the base constraint - return; - } - - const tests = { - // standardize the valid tests as objects - valid: testsReadonly.valid.map(test => { - if (typeof test === 'string') { - return { - code: test, - }; - } - return test; - }), - invalid: testsReadonly.invalid, - }; - - // convenience iterator to make it easy to loop all tests without a concat - const allTestsIterator = { - *[Symbol.iterator](): Generator, void, unknown> { - for (const test of tests.valid) { - yield test; - } - for (const test of tests.invalid) { - yield test; - } - }, - }; - - /* - Automatically add a filename to the tests to enable type-aware tests to "just work". - This saves users having to verbosely and manually add the filename to every - single test case. - Hugely helps with the string-based valid test cases as it means they don't - need to be made objects! - Also removes dependencyConstraints, which we support but ESLint core doesn't. - */ - const normalizeTest = < - T extends - | ValidTestCase - | InvalidTestCase, - >({ - dependencyConstraints: _, - ...test - }: T): Omit => { - if (test.parser === TS_ESLINT_PARSER) { - throw new Error(ERROR_MESSAGE); - } - if (!test.filename) { - return { - ...test, - filename: this.getFilename(test.parserOptions), - }; - } - return test; - }; - tests.valid = tests.valid.map(normalizeTest); - tests.invalid = tests.invalid.map(normalizeTest); - - const hasOnly = ((): boolean => { - for (const test of allTestsIterator) { - if (test.only) { - return true; - } - } - return false; - })(); - // if there is an `only: true` - don't apply constraints - assume that - // we are in "local development" mode rather than "CI validation" mode - if (!hasOnly) { - /* - Automatically skip tests that don't satisfy the dependency constraints. - */ - const hasConstraints = ((): boolean => { - for (const test of allTestsIterator) { - if ( - test.dependencyConstraints && - Object.keys(test.dependencyConstraints).length > 0 - ) { - return true; - } - } - return false; - })(); - if (hasConstraints) { - // The `only: boolean` test property was only added in ESLint v7.29.0. - if (semver.satisfies(eslintVersion, '>=7.29.0')) { - /* - Mark all satisfactory tests as `only: true`, and all other tests as - `only: false`. - When multiple tests are marked as "only", test frameworks like jest and mocha - will run all of those tests and will just skip the other tests. - - We do this instead of just omitting the tests entirely because it gives the - test framework the opportunity to log the test as skipped rather than the test - just disappearing. - */ - const maybeMarkAsOnly = < - T extends - | ValidTestCase - | InvalidTestCase, - >( - test: T, - ): T => { - return { - ...test, - only: satisfiesAllDependencyConstraints( - test.dependencyConstraints, - ), - }; - }; - - tests.valid = tests.valid.map(maybeMarkAsOnly); - tests.invalid = tests.invalid.map(maybeMarkAsOnly); - } else { - // On older versions we just fallback to raw array filtering like SAVAGES - tests.valid = tests.valid.filter(test => - satisfiesAllDependencyConstraints(test.dependencyConstraints), - ); - tests.invalid = tests.invalid.filter(test => - satisfiesAllDependencyConstraints(test.dependencyConstraints), - ); - } - } - } - - super.run(name, rule, tests); - } -} - -/** - * Simple no-op tag to mark code samples as "should not format with prettier" - * for the internal/plugin-test-formatting lint rule - */ -function noFormat(raw: TemplateStringsArray, ...keys: string[]): string { - return String.raw({ raw }, ...keys); -} - -export { noFormat, RuleTester }; -export type { InvalidTestCase, ValidTestCase, RunTests }; diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index 31328386269..e604617af99 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -2,7 +2,7 @@ import * as ASTUtils from './ast-utils'; import * as ESLintUtils from './eslint-utils'; import * as JSONSchema from './json-schema'; import * as TSESLint from './ts-eslint'; -import * as TSESLintScope from './ts-eslint-scope'; +import * as TSUtils from './ts-utils'; -export { ASTUtils, ESLintUtils, JSONSchema, TSESLint, TSESLintScope }; +export { ASTUtils, ESLintUtils, JSONSchema, TSESLint, TSUtils }; export * from './ts-estree'; diff --git a/packages/utils/src/json-schema.ts b/packages/utils/src/json-schema.ts index 8e11b8b3caa..b641637745a 100644 --- a/packages/utils/src/json-schema.ts +++ b/packages/utils/src/json-schema.ts @@ -1,24 +1,498 @@ -// Note - @types/json-schema@7.0.4 added some function declarations to the type package -// If we do export *, then it will also export these function declarations. -// This will cause typescript to not scrub the require from the build, breaking anyone who doesn't have it as a dependency - -// eslint-disable-next-line import/no-extraneous-dependencies -export { - JSONSchema4, - JSONSchema4Type, - JSONSchema4TypeName, - JSONSchema4Version, - JSONSchema6, - JSONSchema6Definition, - JSONSchema6Type, - JSONSchema6TypeName, - JSONSchema6Version, - JSONSchema7, - JSONSchema7Array, - JSONSchema7Definition, - JSONSchema7Type, - JSONSchema7TypeName, - JSONSchema7Version, - ValidationError, - ValidationResult, -} from 'json-schema'; +/** + * This is a fork of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13f63c2eb8d7479caf01ab8d72f9e3683368a8f5/types/json-schema/index.d.ts + * We intentionally fork this because: + * - ESLint ***ONLY*** supports JSONSchema v4 + * - We want to provide stricter types + */ + +//================================================================================================== +// JSON Schema Draft 04 +//================================================================================================== + +/** + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1 + */ +export type JSONSchema4TypeName = + | 'any' + | 'array' + | 'boolean' + | 'integer' + | 'null' + | 'number' + | 'object' + | 'string'; + +/** + * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5 + */ +export type JSONSchema4Type = boolean | number | string | null; + +/** + * Meta schema + * + * Recommended values: + * - 'http://json-schema.org/schema#' + * - 'http://json-schema.org/hyper-schema#' + * - 'http://json-schema.org/draft-04/schema#' + * - 'http://json-schema.org/draft-04/hyper-schema#' + * - 'http://json-schema.org/draft-03/schema#' + * - 'http://json-schema.org/draft-03/hyper-schema#' + * + * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5 + */ +export type JSONSchema4Version = string; + +/** + * JSON Schema V4 + * @see https://tools.ietf.org/html/draft-zyp-json-schema-04 + */ +export type JSONSchema4 = + | JSONSchema4AllOfSchema + | JSONSchema4AnyOfSchema + | JSONSchema4AnySchema + | JSONSchema4ArraySchema + | JSONSchema4BoleanSchema + | JSONSchema4MultiSchema + | JSONSchema4NullSchema + | JSONSchema4NumberSchema + | JSONSchema4ObjectSchema + | JSONSchema4OneOfSchema + | JSONSchema4RefSchema + | JSONSchema4StringSchema; + +interface JSONSchema4Base { + id?: string | undefined; + + $schema?: JSONSchema4Version | undefined; + + /** + * A single type, or a union of simple types + */ + type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined; + + /** + * Path to a schema defined in `definitions`/`$defs` that will form the base + * for this schema. + * + * If you are defining an "array" schema (`schema: [ ... ]`) for your rule + * then you should prefix this with `items/0` so that the validator can find + * your definitions. + * + * eg: `'#/items/0/definitions/myDef'` + * + * Otherwise if you are defining an "object" schema (`schema: { ... }`) for + * your rule you can directly reference your definitions + * + * eg: `'#/definitions/myDef'` + */ + $ref?: string | undefined; + + /** + * This attribute is a string that provides a short description of the + * instance property. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21 + */ + title?: string | undefined; + + /** + * This attribute is a string that provides a full description of the of + * purpose the instance property. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22 + */ + description?: string | undefined; + + /** + * Reusable definitions that can be referenced via `$ref` + */ + definitions?: + | { + [k: string]: JSONSchema4; + } + | undefined; + /** + * Reusable definitions that can be referenced via `$ref` + */ + $defs?: + | { + [k: string]: JSONSchema4; + } + | undefined; + + /** + * The value of this property MUST be another schema which will provide + * a base schema which the current schema will inherit from. The + * inheritance rules are such that any instance that is valid according + * to the current schema MUST be valid according to the referenced + * schema. This MAY also be an array, in which case, the instance MUST + * be valid for all the schemas in the array. A schema that extends + * another schema MAY define additional attributes, constrain existing + * attributes, or add other constraints. + * + * Conceptually, the behavior of extends can be seen as validating an + * instance against all constraints in the extending schema as well as + * the extended schema(s). + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26 + */ + extends?: string[] | string | undefined; + + /** + * The default value for the item if not present + */ + default?: JSONSchema4Type | undefined; + + /** + * This attribute indicates if the instance must have a value, and not + * be undefined. This is false by default, making the instance + * optional. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7 + */ + required?: string[] | boolean | undefined; + + /** + * (NOT) Must not be valid against the given schema + */ + not?: JSONSchema4 | undefined; + /** + * (AND) Must be valid against all of the sub-schemas + */ + allOf?: JSONSchema4[] | undefined; + /** + * (OR) Must be valid against any of the sub-schemas + */ + anyOf?: JSONSchema4[] | undefined; + /** + * (XOR) Must be valid against exactly one of the sub-schemas + */ + oneOf?: JSONSchema4[] | undefined; +} + +export interface JSONSchema4RefSchema extends JSONSchema4Base { + type?: undefined; + $ref: string; +} + +export interface JSONSchema4AllOfSchema extends JSONSchema4Base { + type?: undefined; + allOf: JSONSchema4[]; +} + +export interface JSONSchema4AnyOfSchema extends JSONSchema4Base { + type?: undefined; + anyOf: JSONSchema4[]; +} + +export interface JSONSchema4OneOfSchema extends JSONSchema4Base { + type?: undefined; + oneOf: JSONSchema4[]; +} + +export interface JSONSchema4MultiSchema + extends Omit, + Omit, + Omit, + Omit, + Omit, + Omit, + Omit { + type: JSONSchema4TypeName[]; + /** + * This provides an enumeration of all possible values that are valid + * for the instance property. This MUST be an array, and each item in + * the array represents a possible value for the instance value. If + * this attribute is defined, the instance value MUST be one of the + * values in the array in order for the schema to be valid. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 + */ + enum?: JSONSchema4Type[]; +} + +/** + * @see https://json-schema.org/understanding-json-schema/reference/object.html + */ +export interface JSONSchema4ObjectSchema extends JSONSchema4Base { + type: 'object'; + + /** + * This attribute defines a schema for all properties that are not + * explicitly defined in an object type definition. If specified, the + * value MUST be a schema or a boolean. If false is provided, no + * additional properties are allowed beyond the properties defined in + * the schema. The default value is an empty schema which allows any + * value for additional properties. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4 + */ + additionalProperties?: JSONSchema4 | boolean | undefined; + + /** + * This attribute is an object with property definitions that define the + * valid values of instance object property values. When the instance + * value is an object, the property values of the instance object MUST + * conform to the property definitions in this object. In this object, + * each property definition's value MUST be a schema, and the property's + * name MUST be the name of the instance property that it defines. The + * instance property value MUST be valid according to the schema from + * the property definition. Properties are considered unordered, the + * order of the instance properties MAY be in any order. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2 + */ + properties?: + | { + [k: string]: JSONSchema4; + } + | undefined; + + /** + * This attribute is an object that defines the schema for a set of + * property names of an object instance. The name of each property of + * this attribute's object is a regular expression pattern in the ECMA + * 262/Perl 5 format, while the value is a schema. If the pattern + * matches the name of a property on the instance object, the value of + * the instance's property MUST be valid against the pattern name's + * schema value. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3 + */ + patternProperties?: + | { + [k: string]: JSONSchema4; + } + | undefined; + + /** + * The `dependencies` keyword conditionally applies a sub-schema when a given + * property is present. This schema is applied in the same way `allOf` applies + * schemas. Nothing is merged or extended. Both schemas apply independently. + */ + dependencies?: + | { + [k: string]: JSONSchema4 | string[]; + } + | undefined; + + /** + * The maximum number of properties allowed for record-style schemas + */ + maxProperties?: number | undefined; + /** + * The minimum number of properties required for record-style schemas + */ + minProperties?: number | undefined; +} + +/** + * @see https://json-schema.org/understanding-json-schema/reference/array.html + */ +export interface JSONSchema4ArraySchema extends JSONSchema4Base { + type: 'array'; + + /** + * May only be defined when "items" is defined, and is a tuple of JSONSchemas. + * + * This provides a definition for additional items in an array instance + * when tuple definitions of the items is provided. This can be false + * to indicate additional items in the array are not allowed, or it can + * be a schema that defines the schema of the additional items. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6 + */ + additionalItems?: JSONSchema4 | boolean | undefined; + + /** + * This attribute defines the allowed items in an instance array, and + * MUST be a schema or an array of schemas. The default value is an + * empty schema which allows any value for items in the instance array. + * + * When this attribute value is a schema and the instance value is an + * array, then all the items in the array MUST be valid according to the + * schema. + * + * When this attribute value is an array of schemas and the instance + * value is an array, each position in the instance array MUST conform + * to the schema in the corresponding position for this array. This + * called tuple typing. When tuple typing is used, additional items are + * allowed, disallowed, or constrained by the "additionalItems" + * (Section 5.6) attribute using the same rules as + * "additionalProperties" (Section 5.4) for objects. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5 + */ + items?: JSONSchema4 | JSONSchema4[] | undefined; + + /** + * Defines the maximum length of an array + */ + maxItems?: number | undefined; + + /** + * Defines the minimum length of an array + */ + minItems?: number | undefined; + + /** + * Enforces that all items in the array are unique + */ + uniqueItems?: boolean | undefined; +} + +/** + * @see https://json-schema.org/understanding-json-schema/reference/string.html + */ +export interface JSONSchema4StringSchema extends JSONSchema4Base { + type: 'string'; + + /** + * The maximum allowed length for the string + */ + maxLength?: number | undefined; + + /** + * The minimum allowed length for the string + */ + minLength?: number | undefined; + + /** + * The `pattern` keyword is used to restrict a string to a particular regular + * expression. The regular expression syntax is the one defined in JavaScript + * (ECMA 262 specifically) with Unicode support. + * + * When defining the regular expressions, it’s important to note that the + * string is considered valid if the expression matches anywhere within the + * string. For example, the regular expression "p" will match any string with + * a p in it, such as "apple" not just a string that is simply "p". Therefore, + * it is usually less confusing, as a matter of course, to surround the + * regular expression in ^...$, for example, "^p$", unless there is a good + * reason not to do so. + */ + pattern?: string | undefined; + + /** + * The `format` keyword allows for basic semantic identification of certain + * kinds of string values that are commonly used. + * + * For example, because JSON doesn’t have a “DateTime” type, dates need to be + * encoded as strings. `format` allows the schema author to indicate that the + * string value should be interpreted as a date. + * + * ajv v6 provides a few built-in formats - all other strings will cause AJV + * to throw during schema compilation + */ + format?: + | 'date-time' + | 'date' + | 'email' + | 'hostname' + | 'ipv4' + | 'ipv6' + | 'json-pointer-uri-fragment' + | 'json-pointer' + | 'regex' + | 'relative-json-pointer' + | 'time' + | 'uri-reference' + | 'uri-template' + | 'uri' + | 'url' + | 'uuid' + | undefined; + + enum?: string[] | undefined; +} + +/** + * @see https://json-schema.org/understanding-json-schema/reference/numeric.html + */ +export interface JSONSchema4NumberSchema extends JSONSchema4Base { + type: 'integer' | 'number'; + + /** + * Numbers can be restricted to a multiple of a given number, using the + * `multipleOf` keyword. It may be set to any positive number. + */ + multipleOf?: number | undefined; + + /** + * The maximum allowed value for the number + */ + maximum?: number | undefined; + + /** + * The minimum allowed value for the number + */ + minimum?: number | undefined; + + /** + * The exclusive minimum allowed value for the number + * - `true` = `x < maximum` + * - `false` = `x <= maximum` + * + * Default is `false` + */ + exclusiveMaximum?: boolean | undefined; + + /** + * Indicates whether or not `minimum` is the inclusive or exclusive minimum + * - `true` = `x > minimum` + * - `false` = `x ≥ minimum` + * + * Default is `false` + */ + exclusiveMinimum?: boolean | undefined; + + /** + * This provides an enumeration of all possible values that are valid + * for the instance property. This MUST be an array, and each item in + * the array represents a possible value for the instance value. If + * this attribute is defined, the instance value MUST be one of the + * values in the array in order for the schema to be valid. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 + */ + enum?: number[] | undefined; +} + +/** + * @see https://json-schema.org/understanding-json-schema/reference/boolean.html + */ +export interface JSONSchema4BoleanSchema extends JSONSchema4Base { + type: 'boolean'; + + /** + * This provides an enumeration of all possible values that are valid + * for the instance property. This MUST be an array, and each item in + * the array represents a possible value for the instance value. If + * this attribute is defined, the instance value MUST be one of the + * values in the array in order for the schema to be valid. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 + */ + enum?: boolean[] | undefined; +} + +/** + * @see https://json-schema.org/understanding-json-schema/reference/null.html + */ +export interface JSONSchema4NullSchema extends JSONSchema4Base { + type: 'null'; + + /** + * This provides an enumeration of all possible values that are valid + * for the instance property. This MUST be an array, and each item in + * the array represents a possible value for the instance value. If + * this attribute is defined, the instance value MUST be one of the + * values in the array in order for the schema to be valid. + * + * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19 + */ + enum?: null[] | undefined; +} + +export interface JSONSchema4AnySchema extends JSONSchema4Base { + type: 'any'; +} diff --git a/packages/utils/src/ts-eslint-scope/Definition.ts b/packages/utils/src/ts-eslint-scope/Definition.ts deleted file mode 100644 index 3e35ecc9fc2..00000000000 --- a/packages/utils/src/ts-eslint-scope/Definition.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - Definition as ESLintDefinition, - ParameterDefinition as ESLintParameterDefinition, -} from 'eslint-scope/lib/definition'; - -import type { TSESTree } from '../ts-estree'; - -interface Definition { - type: string; - name: TSESTree.BindingName; - node: TSESTree.Node; - parent?: TSESTree.Node | null; - index?: number | null; - kind?: string | null; - rest?: boolean; -} -interface DefinitionConstructor { - new ( - type: string, - name: TSESTree.BindingName | TSESTree.PropertyName, - node: TSESTree.Node, - parent?: TSESTree.Node | null, - index?: number | null, - kind?: string | null, - ): Definition; -} -const Definition = ESLintDefinition as DefinitionConstructor; - -// eslint-disable-next-line @typescript-eslint/no-empty-interface -interface ParameterDefinition extends Definition {} -const ParameterDefinition = - ESLintParameterDefinition as DefinitionConstructor & { - new ( - name: TSESTree.Node, - node: TSESTree.Node, - index?: number | null, - rest?: boolean, - ): ParameterDefinition; - }; - -export { Definition, ParameterDefinition }; diff --git a/packages/utils/src/ts-eslint-scope/Options.ts b/packages/utils/src/ts-eslint-scope/Options.ts deleted file mode 100644 index 0b1600ae1cb..00000000000 --- a/packages/utils/src/ts-eslint-scope/Options.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { TSESTree } from '../ts-estree'; - -type PatternVisitorCallback = ( - pattern: TSESTree.Identifier, - info: { - rest: boolean; - topLevel: boolean; - assignments: TSESTree.AssignmentPattern[]; - }, -) => void; - -interface PatternVisitorOptions { - processRightHandNodes?: boolean; -} - -interface Visitor { - visitChildren(node?: T): void; - visit(node?: T): void; -} - -export { PatternVisitorCallback, PatternVisitorOptions, Visitor }; diff --git a/packages/utils/src/ts-eslint-scope/PatternVisitor.ts b/packages/utils/src/ts-eslint-scope/PatternVisitor.ts deleted file mode 100644 index 75840211e28..00000000000 --- a/packages/utils/src/ts-eslint-scope/PatternVisitor.ts +++ /dev/null @@ -1,39 +0,0 @@ -import ESLintPatternVisitor from 'eslint-scope/lib/pattern-visitor'; - -import type { TSESTree } from '../ts-estree'; -import type { - PatternVisitorCallback, - PatternVisitorOptions, - Visitor, -} from './Options'; -import type { ScopeManager } from './ScopeManager'; - -interface PatternVisitor extends Visitor { - options: PatternVisitorOptions; - scopeManager: ScopeManager; - parent?: TSESTree.Node; - rightHandNodes: TSESTree.Node[]; - - Identifier(pattern: TSESTree.Node): void; - Property(property: TSESTree.Node): void; - ArrayPattern(pattern: TSESTree.Node): void; - AssignmentPattern(pattern: TSESTree.Node): void; - RestElement(pattern: TSESTree.Node): void; - MemberExpression(node: TSESTree.Node): void; - SpreadElement(node: TSESTree.Node): void; - ArrayExpression(node: TSESTree.Node): void; - AssignmentExpression(node: TSESTree.Node): void; - CallExpression(node: TSESTree.Node): void; -} -const PatternVisitor = ESLintPatternVisitor as { - new ( - options: PatternVisitorOptions, - rootPattern: TSESTree.BaseNode, - callback: PatternVisitorCallback, - ): PatternVisitor; - - // static methods - isPattern(node: TSESTree.Node): boolean; -}; - -export { PatternVisitor }; diff --git a/packages/utils/src/ts-eslint-scope/README.md b/packages/utils/src/ts-eslint-scope/README.md deleted file mode 100644 index 6cabba14fbf..00000000000 --- a/packages/utils/src/ts-eslint-scope/README.md +++ /dev/null @@ -1,3 +0,0 @@ -These will need to be removed in the next major as `eslint-scope` v6+ no longer export their internals. - -Issue: https://github.com/typescript-eslint/typescript-eslint/issues/4041 diff --git a/packages/utils/src/ts-eslint-scope/Reference.ts b/packages/utils/src/ts-eslint-scope/Reference.ts deleted file mode 100644 index d2dd6554977..00000000000 --- a/packages/utils/src/ts-eslint-scope/Reference.ts +++ /dev/null @@ -1,43 +0,0 @@ -import ESLintReference from 'eslint-scope/lib/reference'; - -import type { TSESTree } from '../ts-estree'; -import type { Scope } from './Scope'; -import type { Variable } from './Variable'; - -export type ReferenceFlag = 0x1 | 0x2 | 0x3; - -interface Reference { - identifier: TSESTree.Identifier; - from: Scope; - resolved: Variable | null; - writeExpr: TSESTree.Node | null; - init: boolean; - - partial: boolean; - __maybeImplicitGlobal: boolean; - tainted?: boolean; - typeMode?: boolean; - - isWrite(): boolean; - isRead(): boolean; - isWriteOnly(): boolean; - isReadOnly(): boolean; - isReadWrite(): boolean; -} -const Reference = ESLintReference as { - new ( - identifier: TSESTree.Identifier, - scope: Scope, - flag?: ReferenceFlag, - writeExpr?: TSESTree.Node | null, - maybeImplicitGlobal?: boolean, - partial?: boolean, - init?: boolean, - ): Reference; - - READ: 0x1; - WRITE: 0x2; - RW: 0x3; -}; - -export { Reference }; diff --git a/packages/utils/src/ts-eslint-scope/Referencer.ts b/packages/utils/src/ts-eslint-scope/Referencer.ts deleted file mode 100644 index 3bd6b27b20d..00000000000 --- a/packages/utils/src/ts-eslint-scope/Referencer.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import ESLintReferencer from 'eslint-scope/lib/referencer'; - -import type { TSESTree } from '../ts-estree'; -import type { - PatternVisitorCallback, - PatternVisitorOptions, - Visitor, -} from './Options'; -import type { Scope } from './Scope'; -import type { ScopeManager } from './ScopeManager'; - -interface Referencer extends Visitor { - isInnerMethodDefinition: boolean; - options: any; - scopeManager: SM; - parent?: TSESTree.Node; - - currentScope(): Scope; - close(node: TSESTree.Node): void; - pushInnerMethodDefinition(isInnerMethodDefinition: boolean): boolean; - popInnerMethodDefinition(isInnerMethodDefinition: boolean): void; - - referencingDefaultValue( - pattern: any, - assignments: any, - maybeImplicitGlobal: any, - init: boolean, - ): void; - visitPattern( - node: TSESTree.Node, - options: PatternVisitorOptions, - callback: PatternVisitorCallback, - ): void; - visitFunction(node: TSESTree.Node): void; - visitClass(node: TSESTree.Node): void; - visitProperty(node: TSESTree.Node): void; - visitForIn(node: TSESTree.Node): void; - visitVariableDeclaration( - variableTargetScope: any, - type: any, - node: TSESTree.Node, - index: any, - ): void; - - AssignmentExpression(node: TSESTree.Node): void; - CatchClause(node: TSESTree.Node): void; - Program(node: TSESTree.Program): void; - Identifier(node: TSESTree.Identifier): void; - UpdateExpression(node: TSESTree.Node): void; - MemberExpression(node: TSESTree.Node): void; - Property(node: TSESTree.Node): void; - MethodDefinition(node: TSESTree.Node): void; - BreakStatement(): void; - ContinueStatement(): void; - LabeledStatement(node: TSESTree.Node): void; - ForStatement(node: TSESTree.Node): void; - ClassExpression(node: TSESTree.Node): void; - ClassDeclaration(node: TSESTree.Node): void; - CallExpression(node: TSESTree.Node): void; - BlockStatement(node: TSESTree.Node): void; - ThisExpression(): void; - WithStatement(node: TSESTree.Node): void; - VariableDeclaration(node: TSESTree.Node): void; - SwitchStatement(node: TSESTree.Node): void; - FunctionDeclaration(node: TSESTree.Node): void; - FunctionExpression(node: TSESTree.Node): void; - ForOfStatement(node: TSESTree.Node): void; - ForInStatement(node: TSESTree.Node): void; - ArrowFunctionExpression(node: TSESTree.Node): void; - ImportDeclaration(node: TSESTree.Node): void; - visitExportDeclaration(node: TSESTree.Node): void; - ExportDeclaration(node: TSESTree.Node): void; - ExportNamedDeclaration(node: TSESTree.Node): void; - ExportSpecifier(node: TSESTree.Node): void; - MetaProperty(): void; -} -const Referencer = ESLintReferencer as { - new (options: any, scopeManager: SM): Referencer; -}; - -export { Referencer }; diff --git a/packages/utils/src/ts-eslint-scope/Scope.ts b/packages/utils/src/ts-eslint-scope/Scope.ts deleted file mode 100644 index e0f3320043a..00000000000 --- a/packages/utils/src/ts-eslint-scope/Scope.ts +++ /dev/null @@ -1,197 +0,0 @@ -/* eslint-disable @typescript-eslint/no-empty-interface, @typescript-eslint/no-explicit-any */ - -import { - BlockScope as ESLintBlockScope, - CatchScope as ESLintCatchScope, - ClassScope as ESLintClassScope, - ForScope as ESLintForScope, - FunctionExpressionNameScope as ESLintFunctionExpressionNameScope, - FunctionScope as ESLintFunctionScope, - GlobalScope as ESLintGlobalScope, - ModuleScope as ESLintModuleScope, - Scope as ESLintScope, - SwitchScope as ESLintSwitchScope, - WithScope as ESLintWithScope, -} from 'eslint-scope/lib/scope'; - -import type { TSESTree } from '../ts-estree'; -import type { Definition } from './Definition'; -import type { Reference, ReferenceFlag } from './Reference'; -import type { ScopeManager } from './ScopeManager'; -import type { Variable } from './Variable'; - -type ScopeType = - | 'block' - | 'catch' - | 'class' - | 'for' - | 'function' - | 'function-expression-name' - | 'global' - | 'module' - | 'switch' - | 'with' - | 'TDZ' - | 'enum' - | 'empty-function'; - -interface Scope { - type: ScopeType; - isStrict: boolean; - upper: Scope | null; - childScopes: Scope[]; - variableScope: Scope; - block: TSESTree.Node; - variables: Variable[]; - set: Map; - references: Reference[]; - through: Reference[]; - thisFound?: boolean; - taints: Map; - functionExpressionScope: boolean; - __left: Reference[]; - - __shouldStaticallyClose(scopeManager: ScopeManager): boolean; - __shouldStaticallyCloseForGlobal(ref: any): boolean; - __staticCloseRef(ref: any): void; - __dynamicCloseRef(ref: any): void; - __globalCloseRef(ref: any): void; - __close(scopeManager: ScopeManager): Scope; - __isValidResolution(ref: any, variable: any): variable is Variable; - __resolve(ref: Reference): boolean; - __delegateToUpperScope(ref: any): void; - __addDeclaredVariablesOfNode(variable: any, node: TSESTree.Node): void; - __defineGeneric( - name: string, - set: Map, - variables: Variable[], - node: TSESTree.Identifier, - def: Definition, - ): void; - - __define(node: TSESTree.Node, def: Definition): void; - - __referencing( - node: TSESTree.Node, - assign?: ReferenceFlag, - writeExpr?: TSESTree.Node, - maybeImplicitGlobal?: any, - partial?: any, - init?: any, - ): void; - - __detectEval(): void; - __detectThis(): void; - __isClosed(): boolean; - /** - * returns resolved {Reference} - * @method Scope#resolve - * @param {Espree.Identifier} ident - identifier to be resolved. - * @returns {Reference} reference - */ - resolve(ident: TSESTree.Node): Reference; - - /** - * returns this scope is static - * @method Scope#isStatic - * @returns {boolean} static - */ - isStatic(): boolean; - - /** - * returns this scope has materialized arguments - * @method Scope#isArgumentsMaterialized - * @returns {boolean} arguments materialized - */ - isArgumentsMaterialized(): boolean; - - /** - * returns this scope has materialized `this` reference - * @method Scope#isThisMaterialized - * @returns {boolean} this materialized - */ - isThisMaterialized(): boolean; - - isUsedName(name: any): boolean; -} -interface ScopeConstructor { - new ( - scopeManager: ScopeManager, - type: ScopeType, - upperScope: Scope | null, - block: TSESTree.Node | null, - isMethodDefinition: boolean, - ): Scope; -} -const Scope = ESLintScope as ScopeConstructor; - -interface ScopeChildConstructorWithUpperScope { - new ( - scopeManager: ScopeManager, - upperScope: Scope, - block: TSESTree.Node | null, - ): T; -} - -interface GlobalScope extends Scope {} -const GlobalScope = ESLintGlobalScope as ScopeConstructor & { - new (scopeManager: ScopeManager, block: TSESTree.Node | null): GlobalScope; -}; - -interface ModuleScope extends Scope {} -const ModuleScope = ESLintModuleScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface FunctionExpressionNameScope extends Scope {} -const FunctionExpressionNameScope = - ESLintFunctionExpressionNameScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface CatchScope extends Scope {} -const CatchScope = ESLintCatchScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface WithScope extends Scope {} -const WithScope = ESLintWithScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface BlockScope extends Scope {} -const BlockScope = ESLintBlockScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface SwitchScope extends Scope {} -const SwitchScope = ESLintSwitchScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface FunctionScope extends Scope {} -const FunctionScope = ESLintFunctionScope as ScopeConstructor & { - new ( - scopeManager: ScopeManager, - upperScope: Scope, - block: TSESTree.Node | null, - isMethodDefinition: boolean, - ): FunctionScope; -}; - -interface ForScope extends Scope {} -const ForScope = ESLintForScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -interface ClassScope extends Scope {} -const ClassScope = ESLintClassScope as ScopeConstructor & - ScopeChildConstructorWithUpperScope; - -export { - ScopeType, - Scope, - GlobalScope, - ModuleScope, - FunctionExpressionNameScope, - CatchScope, - WithScope, - BlockScope, - SwitchScope, - FunctionScope, - ForScope, - ClassScope, -}; diff --git a/packages/utils/src/ts-eslint-scope/ScopeManager.ts b/packages/utils/src/ts-eslint-scope/ScopeManager.ts deleted file mode 100644 index c7bbb2425c9..00000000000 --- a/packages/utils/src/ts-eslint-scope/ScopeManager.ts +++ /dev/null @@ -1,62 +0,0 @@ -import ESLintScopeManager from 'eslint-scope/lib/scope-manager'; - -import type { EcmaVersion } from '../ts-eslint'; -import type { TSESTree } from '../ts-estree'; -import type { Scope } from './Scope'; -import type { Variable } from './Variable'; - -interface ScopeManagerOptions { - directive?: boolean; - optimistic?: boolean; - ignoreEval?: boolean; - nodejsScope?: boolean; - sourceType?: 'module' | 'script'; - impliedStrict?: boolean; - ecmaVersion?: EcmaVersion; -} - -interface ScopeManager { - __options: ScopeManagerOptions; - __currentScope: Scope; - __nodeToScope: WeakMap; - __declaredVariables: WeakMap; - - scopes: Scope[]; - globalScope: Scope; - - __useDirective(): boolean; - __isOptimistic(): boolean; - __ignoreEval(): boolean; - __isNodejsScope(): boolean; - isModule(): boolean; - isImpliedStrict(): boolean; - isStrictModeSupported(): boolean; - - // Returns appropriate scope for this node. - __get(node: TSESTree.Node): Scope | undefined; - getDeclaredVariables(node: TSESTree.Node): Variable[]; - acquire(node: TSESTree.Node, inner?: boolean): Scope | null; - acquireAll(node: TSESTree.Node): Scope | null; - release(node: TSESTree.Node, inner?: boolean): Scope | null; - attach(): void; - detach(): void; - - __nestScope(scope: T): T; - __nestGlobalScope(node: TSESTree.Node): Scope; - __nestBlockScope(node: TSESTree.Node): Scope; - __nestFunctionScope(node: TSESTree.Node, isMethodDefinition: boolean): Scope; - __nestForScope(node: TSESTree.Node): Scope; - __nestCatchScope(node: TSESTree.Node): Scope; - __nestWithScope(node: TSESTree.Node): Scope; - __nestClassScope(node: TSESTree.Node): Scope; - __nestSwitchScope(node: TSESTree.Node): Scope; - __nestModuleScope(node: TSESTree.Node): Scope; - __nestFunctionExpressionNameScope(node: TSESTree.Node): Scope; - - __isES6(): boolean; -} -const ScopeManager = ESLintScopeManager as { - new (options: ScopeManagerOptions): ScopeManager; -}; - -export { ScopeManager, ScopeManagerOptions }; diff --git a/packages/utils/src/ts-eslint-scope/Variable.ts b/packages/utils/src/ts-eslint-scope/Variable.ts deleted file mode 100644 index 192c9f89550..00000000000 --- a/packages/utils/src/ts-eslint-scope/Variable.ts +++ /dev/null @@ -1,23 +0,0 @@ -import ESLintVariable from 'eslint-scope/lib/variable'; - -import type { TSESTree } from '../ts-estree'; -import type { Definition } from './Definition'; -import type { Reference } from './Reference'; -import type { Scope } from './Scope'; - -interface Variable { - name: string; - identifiers: TSESTree.Identifier[]; - references: Reference[]; - defs: Definition[]; - eslintUsed?: boolean; - stack?: unknown; - tainted?: boolean; - scope?: Scope; -} - -const Variable = ESLintVariable as { - new (): Variable; -}; - -export { Variable }; diff --git a/packages/utils/src/ts-eslint-scope/analyze.ts b/packages/utils/src/ts-eslint-scope/analyze.ts deleted file mode 100644 index 1543f93fa1a..00000000000 --- a/packages/utils/src/ts-eslint-scope/analyze.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { analyze as ESLintAnalyze } from 'eslint-scope'; - -import type { EcmaVersion } from '../ts-eslint'; -import type { TSESTree } from '../ts-estree'; -import type { ScopeManager } from './ScopeManager'; - -interface AnalysisOptions { - optimistic?: boolean; - directive?: boolean; - ignoreEval?: boolean; - nodejsScope?: boolean; - impliedStrict?: boolean; - fallback?: string | ((node: TSESTree.Node) => string[]); - sourceType?: 'script' | 'module'; - ecmaVersion?: EcmaVersion; -} -const analyze = ESLintAnalyze as ( - ast: TSESTree.Node, - options?: AnalysisOptions, -) => ScopeManager; - -export { analyze, AnalysisOptions }; diff --git a/packages/utils/src/ts-eslint-scope/index.ts b/packages/utils/src/ts-eslint-scope/index.ts deleted file mode 100644 index 870c34fce1b..00000000000 --- a/packages/utils/src/ts-eslint-scope/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { version as ESLintVersion } from 'eslint-scope'; - -export * from './analyze'; -export * from './Definition'; -export * from './Options'; -export * from './PatternVisitor'; -export * from './Reference'; -export * from './Referencer'; -export * from './Scope'; -export * from './ScopeManager'; -export * from './Variable'; - -export const version: string = ESLintVersion; diff --git a/packages/utils/src/ts-eslint/CLIEngine.ts b/packages/utils/src/ts-eslint/CLIEngine.ts index 9ad4f5c76ed..15a58754ec9 100644 --- a/packages/utils/src/ts-eslint/CLIEngine.ts +++ b/packages/utils/src/ts-eslint/CLIEngine.ts @@ -4,7 +4,7 @@ import { CLIEngine as ESLintCLIEngine } from 'eslint'; import type { Linter } from './Linter'; -import type { RuleListener, RuleMetaData, RuleModule } from './Rule'; +import type { RuleMetaData, RuleModule } from './Rule'; declare class CLIEngineBase { /** @@ -72,9 +72,7 @@ declare class CLIEngineBase { getRules< TMessageIds extends string = string, TOptions extends readonly unknown[] = unknown[], - // for extending base rules - TRuleListener extends RuleListener = RuleListener, - >(): Map>; + >(): Map>; //////////////////// // static members // @@ -121,7 +119,7 @@ namespace CLIEngine { globals?: string[]; ignore?: boolean; ignorePath?: string; - ignorePattern?: string | string[]; + ignorePattern?: string[] | string; useEslintrc?: boolean; parser?: string; parserOptions?: Linter.ParserOptions; diff --git a/packages/utils/src/ts-eslint/ESLint.ts b/packages/utils/src/ts-eslint/ESLint.ts index d5e0420a56f..a7aa2daec98 100644 --- a/packages/utils/src/ts-eslint/ESLint.ts +++ b/packages/utils/src/ts-eslint/ESLint.ts @@ -36,7 +36,7 @@ declare class ESLintBase { * @param patterns The lint target files. This can contain any of file paths, directory paths, and glob patterns. * @returns The promise that will be fulfilled with an array of LintResult objects. */ - lintFiles(patterns: string | string[]): Promise; + lintFiles(patterns: string[] | string): Promise; /** * This method lints the given source code text and then returns the results. * @@ -145,7 +145,7 @@ namespace ESLint { /** * The types of the rules that the eslint.lintFiles() and eslint.lintText() methods use for autofix. */ - fixTypes?: ('directive' | 'problem' | 'suggestion' | 'layout')[] | null; + fixTypes?: ('directive' | 'layout' | 'problem' | 'suggestion')[] | null; /** * If false is present, the eslint.lintFiles() method doesn't interpret glob patterns. */ @@ -379,7 +379,7 @@ namespace ESLint { * The method to convert the LintResult objects to text. * Promise return supported since 8.4.0 */ - format(results: LintResult[]): string | Promise; + format(results: LintResult[]): Promise | string; } } diff --git a/packages/utils/src/ts-eslint/Linter.ts b/packages/utils/src/ts-eslint/Linter.ts index 4e1a13aba77..59274a7e6fc 100644 --- a/packages/utils/src/ts-eslint/Linter.ts +++ b/packages/utils/src/ts-eslint/Linter.ts @@ -13,6 +13,12 @@ import type { import type { Scope } from './Scope'; import type { SourceCode } from './SourceCode'; +export type MinimalRuleModule< + TMessageIds extends string = string, + TOptions extends readonly unknown[] = [], +> = Partial, 'create'>> & + Pick, 'create'>; + declare class LinterBase { /** * Initialize the Linter. @@ -34,7 +40,7 @@ declare class LinterBase { */ defineRule( ruleId: string, - ruleModule: RuleModule | RuleCreateFunction, + ruleModule: MinimalRuleModule | RuleCreateFunction, ): void; /** @@ -44,7 +50,8 @@ declare class LinterBase { defineRules( rulesToDefine: Record< string, - RuleModule | RuleCreateFunction + | MinimalRuleModule + | RuleCreateFunction >, ): void; @@ -52,7 +59,7 @@ declare class LinterBase { * Gets an object with all loaded rules. * @returns All loaded rules */ - getRules(): Map>; + getRules(): Map>; /** * Gets the `SourceCode` object representing the parsed source. @@ -72,7 +79,7 @@ declare class LinterBase { verify( textOrSourceCode: SourceCode | string, config: Linter.Config, - filenameOrOptions?: string | Linter.VerifyOptions, + filenameOrOptions?: Linter.VerifyOptions | string, ): Linter.LintMessage[]; /** @@ -112,7 +119,7 @@ namespace Linter { } export type Severity = 0 | 1 | 2; - export type SeverityString = 'off' | 'warn' | 'error'; + export type SeverityString = 'error' | 'off' | 'warn'; export type RuleLevel = Severity | SeverityString; export type RuleLevelAndOptions = [RuleLevel, ...unknown[]]; @@ -120,7 +127,15 @@ namespace Linter { export type RuleEntry = RuleLevel | RuleLevelAndOptions; export type RulesRecord = Partial>; - export type GlobalVariableOption = 'readonly' | 'writable' | 'off' | boolean; + export type GlobalVariableOptionBase = 'off' | 'readonly' | 'writable'; + export type GlobalVariableOption = GlobalVariableOptionBase | boolean; + + export interface GlobalsConfig { + [name: string]: GlobalVariableOption; + } + export interface EnvironmentConfig { + [name: string]: boolean; + } // https://github.com/eslint/eslint/blob/v6.8.0/conf/config-schema.js interface BaseConfig { @@ -128,15 +143,15 @@ namespace Linter { /** * The environment settings. */ - env?: { [name: string]: boolean }; + env?: EnvironmentConfig; /** * The path to other config files or the package name of shareable configs. */ - extends?: string | string[]; + extends?: string[] | string; /** * The global variable settings. */ - globals?: { [name: string]: GlobalVariableOption }; + globals?: GlobalsConfig; /** * The flag that disables directive comments. */ @@ -176,15 +191,15 @@ namespace Linter { } export interface ConfigOverride extends BaseConfig { - excludedFiles?: string | string[]; - files: string | string[]; + excludedFiles?: string[] | string; + files: string[] | string; } export interface Config extends BaseConfig { /** * The glob patterns that ignore to lint. */ - ignorePatterns?: string | string[]; + ignorePatterns?: string[] | string; /** * The root flag. */ @@ -227,7 +242,7 @@ namespace Linter { /** * Adds reported errors for unused `eslint-disable` directives. */ - reportUnusedDisableDirectives?: boolean | SeverityString; + reportUnusedDisableDirectives?: SeverityString | boolean; } export interface FixOptions extends VerifyOptions { @@ -329,7 +344,7 @@ namespace Linter { preprocess?: ( text: string, filename: string, - ) => Array; + ) => (string | { text: string; filename: string })[]; /** * The function to merge messages. */ diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index ff305386321..f15e92bdb38 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -5,7 +5,7 @@ import type { Linter } from './Linter'; import type { Scope } from './Scope'; import type { SourceCode } from './SourceCode'; -export type RuleRecommendation = 'error' | 'strict' | 'warn' | false; +export type RuleRecommendation = 'recommended' | 'strict' | 'stylistic'; interface RuleMetaDataDocs { /** @@ -17,15 +17,11 @@ interface RuleMetaDataDocs { * Used by the build tools to generate the recommended and strict configs. * Set to false to not include it as a recommendation */ - recommended: 'error' | 'strict' | 'warn' | false; + recommended?: RuleRecommendation; /** * The URL of the rule's docs */ url?: string; - /** - * Specifies whether the rule can return suggestions. - */ - suggestion?: boolean; /** * Does the rule require us to create a full TypeScript Program in order for it * to type-check code. This is only used for documentation purposes. @@ -67,7 +63,7 @@ interface RuleMetaData { * - `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn’t changed. * - `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren’t specified in the AST. */ - type: 'suggestion' | 'problem' | 'layout'; + type: 'layout' | 'problem' | 'suggestion'; /** * The name of the rule this rule was replaced by, if it was deprecated. */ @@ -117,15 +113,17 @@ interface SuggestionReportDescriptor type ReportFixFunction = ( fixer: RuleFixer, -) => null | RuleFix | readonly RuleFix[] | IterableIterator; +) => IterableIterator | RuleFix | readonly RuleFix[] | null; type ReportSuggestionArray = SuggestionReportDescriptor[]; +type ReportDescriptorMessageData = Readonly>; + interface ReportDescriptorBase { /** * The parameters for the message string associated with `messageId`. */ - readonly data?: Readonly>; + readonly data?: ReportDescriptorMessageData; /** * The fixer function. */ @@ -155,18 +153,18 @@ interface ReportDescriptorNodeOptionalLoc { * An override of the location of the report */ readonly loc?: - | Readonly - | Readonly; + | Readonly + | Readonly; } interface ReportDescriptorLocOnly { /** * An override of the location of the report */ - loc: Readonly | Readonly; + loc: Readonly | Readonly; } type ReportDescriptor = ReportDescriptorWithSuggestion & - (ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly); + (ReportDescriptorLocOnly | ReportDescriptorNodeOptionalLoc); /** * Plugins can add their settings using declaration @@ -225,7 +223,7 @@ interface RuleContext< * It is a path to a directory that should be considered as the current working directory. * @since 6.6.0 */ - getCwd?(): string; + getCwd(): string; /** * Returns the filename associated with the source. @@ -264,10 +262,11 @@ interface RuleContext< // This isn't the correct signature, but it makes it easier to do custom unions within reusable listeners // never will break someone's code unless they specifically type the function argument -type RuleFunction = (node: T) => void; +type RuleFunction = ( + node: T, +) => void; -interface RuleListener { - [nodeSelector: string]: RuleFunction | undefined; +interface RuleListenerBaseSelectors { ArrayExpression?: RuleFunction; ArrayPattern?: RuleFunction; ArrowFunctionExpression?: RuleFunction; @@ -426,6 +425,19 @@ interface RuleListener { WithStatement?: RuleFunction; YieldExpression?: RuleFunction; } +type RuleListenerExitSelectors = { + [K in keyof RuleListenerBaseSelectors as `${K}:exit`]: RuleListenerBaseSelectors[K]; +}; +interface RuleListenerCatchAllBaseCase { + [nodeSelector: string]: RuleFunction | undefined; +} +// Interface to merge into for anyone that wants to add more selectors +// eslint-disable-next-line @typescript-eslint/no-empty-interface +interface RuleListenerExtension {} + +type RuleListener = RuleListenerBaseSelectors & + RuleListenerCatchAllBaseCase & + RuleListenerExitSelectors; interface RuleModule< TMessageIds extends string, @@ -449,16 +461,19 @@ interface RuleModule< */ create(context: Readonly>): TRuleListener; } +type AnyRuleModule = RuleModule; type RuleCreateFunction< TMessageIds extends string = never, TOptions extends readonly unknown[] = unknown[], - // for extending base rules - TRuleListener extends RuleListener = RuleListener, -> = (context: Readonly>) => TRuleListener; +> = (context: Readonly>) => RuleListener; +type AnyRuleCreateFunction = RuleCreateFunction; export { + AnyRuleCreateFunction, + AnyRuleModule, ReportDescriptor, + ReportDescriptorMessageData, ReportFixFunction, ReportSuggestionArray, RuleContext, @@ -467,6 +482,7 @@ export { RuleFixer, RuleFunction, RuleListener, + RuleListenerExtension, RuleMetaData, RuleMetaDataDocs, RuleModule, diff --git a/packages/utils/src/ts-eslint/RuleTester.ts b/packages/utils/src/ts-eslint/RuleTester.ts index 6c0b98b795f..5e2af43d59b 100644 --- a/packages/utils/src/ts-eslint/RuleTester.ts +++ b/packages/utils/src/ts-eslint/RuleTester.ts @@ -4,6 +4,7 @@ import type { AST_NODE_TYPES, AST_TOKEN_TYPES } from '../ts-estree'; import type { Linter } from './Linter'; import type { ParserOptions } from './ParserOptions'; import type { + ReportDescriptorMessageData, RuleCreateFunction, RuleModule, SharedConfigurationSettings, @@ -30,7 +31,7 @@ interface ValidTestCase> { /** * The additional global variables. */ - readonly globals?: Record; + readonly globals?: Record; /** * Options for the test case. */ @@ -62,7 +63,7 @@ interface SuggestionOutput { /** * The data used to fill the message template. */ - readonly data?: Readonly>; + readonly data?: ReportDescriptorMessageData; /** * NOTE: Suggestions will be applied as a stand-alone change, without triggering multi-pass fixes. * Each individual error has its own suggestion, so you have to show the correct, _isolated_ output for each suggestion. @@ -95,7 +96,7 @@ interface TestCaseError { /** * The data used to fill the message template. */ - readonly data?: Readonly>; + readonly data?: ReportDescriptorMessageData; /** * The 1-based column number of the reported end location. */ @@ -194,8 +195,8 @@ declare class RuleTesterBase { defineRule>( name: string, rule: - | RuleModule - | RuleCreateFunction, + | RuleCreateFunction + | RuleModule, ): void; } diff --git a/packages/utils/src/ts-eslint/Scope.ts b/packages/utils/src/ts-eslint/Scope.ts index bc3db012216..8a89ca02bd5 100644 --- a/packages/utils/src/ts-eslint/Scope.ts +++ b/packages/utils/src/ts-eslint/Scope.ts @@ -6,8 +6,8 @@ namespace Scope { export type ScopeManager = scopeManager.ScopeManager; export type Reference = scopeManager.Reference; export type Variable = - | scopeManager.Variable - | scopeManager.ESLintScopeVariable; + | scopeManager.ESLintScopeVariable + | scopeManager.Variable; export type Scope = scopeManager.Scope; export const ScopeType = scopeManager.ScopeType; // TODO - in the next major, clean this up with a breaking change diff --git a/packages/utils/src/ts-eslint/SourceCode.ts b/packages/utils/src/ts-eslint/SourceCode.ts index a44cdee3676..3d7f33dd93c 100644 --- a/packages/utils/src/ts-eslint/SourceCode.ts +++ b/packages/utils/src/ts-eslint/SourceCode.ts @@ -295,8 +295,8 @@ declare class SourceCodeBase extends TokenStore { * @returns True if there is a whitespace character between any of the tokens found between the two given nodes or tokens. */ isSpaceBetween?( - first: TSESTree.Token | TSESTree.Node, - second: TSESTree.Token | TSESTree.Node, + first: TSESTree.Node | TSESTree.Token, + second: TSESTree.Node | TSESTree.Token, ): boolean; /** * Determines if two nodes or tokens have at least one whitespace character @@ -410,8 +410,8 @@ namespace SourceCode { >; export type CursorWithSkipOptions = - | number | FilterPredicate + | number | { /** * The predicate function to choose tokens. @@ -428,8 +428,8 @@ namespace SourceCode { }; export type CursorWithCountOptions = - | number | FilterPredicate + | number | { /** * The predicate function to choose tokens. diff --git a/packages/utils/src/ts-estree.ts b/packages/utils/src/ts-estree.ts index 1138deddceb..212d339c4ba 100644 --- a/packages/utils/src/ts-estree.ts +++ b/packages/utils/src/ts-estree.ts @@ -7,7 +7,8 @@ export { TSESTree, } from '@typescript-eslint/types'; -// NOTE - this uses hard links inside ts-estree to avoid initialization of entire package -// via its main file (which imports typescript at runtime). -// Not every eslint-plugin written in typescript requires typescript at runtime. -export { ParserServices } from '@typescript-eslint/typescript-estree/dist/parser-options'; +export type { + ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, +} from '@typescript-eslint/typescript-estree'; diff --git a/packages/utils/src/ts-utils/index.ts b/packages/utils/src/ts-utils/index.ts new file mode 100644 index 00000000000..7561f2d5376 --- /dev/null +++ b/packages/utils/src/ts-utils/index.ts @@ -0,0 +1 @@ +export * from './isArray'; diff --git a/packages/utils/src/ts-utils/isArray.ts b/packages/utils/src/ts-utils/isArray.ts new file mode 100644 index 00000000000..dfd77652a26 --- /dev/null +++ b/packages/utils/src/ts-utils/isArray.ts @@ -0,0 +1,4 @@ +// https://github.com/microsoft/TypeScript/issues/17002 +export function isArray(arg: unknown): arg is readonly unknown[] { + return Array.isArray(arg); +} diff --git a/packages/utils/tests/eslint-utils/RuleCreator.test.ts b/packages/utils/tests/eslint-utils/RuleCreator.test.ts index 5e1c14d68c4..652aa2f1251 100644 --- a/packages/utils/tests/eslint-utils/RuleCreator.test.ts +++ b/packages/utils/tests/eslint-utils/RuleCreator.test.ts @@ -13,7 +13,7 @@ describe('RuleCreator', () => { meta: { docs: { description: 'some description', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { @@ -31,7 +31,7 @@ describe('RuleCreator', () => { docs: { description: 'some description', url: 'test/test', - recommended: 'error', + recommended: 'recommended', requiresTypeChecking: true, }, messages: { diff --git a/packages/utils/tests/eslint-utils/batchedSingleLineTests.test.ts b/packages/utils/tests/eslint-utils/batchedSingleLineTests.test.ts deleted file mode 100644 index 596bb480b94..00000000000 --- a/packages/utils/tests/eslint-utils/batchedSingleLineTests.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { ESLintUtils } from '../../src'; - -describe('batchedSingleLineTests', () => { - const FIXTURES = ` -a -b -c - `; - const errors = [ - { messageId: 'someMessage1', line: 2 }, - { messageId: 'someMessage2', line: 3 }, - { messageId: 'someMessage3', line: 4 }, - ]; - const options = [{ optionOne: 'value' }]; - - it('should work without options', () => { - expect( - ESLintUtils.batchedSingleLineTests({ - code: FIXTURES, - }), - ).toEqual([ - { code: 'a', errors: [] }, - { code: 'b', errors: [] }, - { code: 'c', errors: [] }, - ]); - }); - - it('should work with errors', () => { - expect( - ESLintUtils.batchedSingleLineTests({ - code: FIXTURES, - errors, - }), - ).toEqual([ - { code: 'a', errors: [{ messageId: 'someMessage1', line: 1 }] }, - { code: 'b', errors: [{ messageId: 'someMessage2', line: 1 }] }, - { code: 'c', errors: [{ messageId: 'someMessage3', line: 1 }] }, - ]); - }); - - it('should work with all fields', () => { - const filename = 'foo.ts'; - const parser = 'some-parser'; - - expect( - ESLintUtils.batchedSingleLineTests({ - code: FIXTURES, - errors, - options, - parser, - output: FIXTURES, - filename, - }), - ).toEqual([ - { - code: 'a', - output: 'a', - errors: [{ messageId: 'someMessage1', line: 1 }], - parser, - filename, - options, - }, - { - code: 'b', - output: 'b', - errors: [{ messageId: 'someMessage2', line: 1 }], - parser, - filename, - options, - }, - { - code: 'c', - output: 'c', - errors: [{ messageId: 'someMessage3', line: 1 }], - parser, - filename, - options, - }, - ]); - }); -}); diff --git a/packages/utils/typings/eslint-scope.d.ts b/packages/utils/typings/eslint-scope.d.ts deleted file mode 100644 index e9af4b350f6..00000000000 --- a/packages/utils/typings/eslint-scope.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* -We intentionally do not include @types/eslint-scope. - -This is to ensure that nobody accidentally uses those incorrect types -instead of the ones declared within this package -*/ - -declare module 'eslint-scope/lib/variable' { - const Variable: unknown; - export = Variable; -} -declare module 'eslint-scope/lib/definition' { - const Definition: unknown; - const ParameterDefinition: unknown; - export { Definition, ParameterDefinition }; -} -declare module 'eslint-scope/lib/pattern-visitor' { - const PatternVisitor: unknown; - export = PatternVisitor; -} -declare module 'eslint-scope/lib/referencer' { - const Referencer: unknown; - export = Referencer; -} -declare module 'eslint-scope/lib/scope' { - const Scope: unknown; - const GlobalScope: unknown; - const ModuleScope: unknown; - const FunctionExpressionNameScope: unknown; - const CatchScope: unknown; - const WithScope: unknown; - const BlockScope: unknown; - const SwitchScope: unknown; - const FunctionScope: unknown; - const ForScope: unknown; - const ClassScope: unknown; - export { - Scope, - GlobalScope, - ModuleScope, - FunctionExpressionNameScope, - CatchScope, - WithScope, - BlockScope, - SwitchScope, - FunctionScope, - ForScope, - ClassScope, - }; -} -declare module 'eslint-scope/lib/reference' { - const Reference: unknown; - export = Reference; -} -declare module 'eslint-scope/lib/scope-manager' { - const ScopeManager: unknown; - export = ScopeManager; -} -declare module 'eslint-scope' { - export const version: string; - export const analyze: unknown; -} diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index 9cf6f31fa5e..05f67945a88 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,199 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* **ast-spec:** remove more invalid properties ([#6243](https://github.com/typescript-eslint/typescript-eslint/issues/6243)) ([aa20f63](https://github.com/typescript-eslint/typescript-eslint/commit/aa20f63e8f345767bb4693c9d20f751e6998bd65)) +* rename typeParameters to typeArguments where needed ([#5384](https://github.com/typescript-eslint/typescript-eslint/issues/5384)) ([08d757b](https://github.com/typescript-eslint/typescript-eslint/commit/08d757b26b00d0accea010e61ec42b4f753f993e)) +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* create TSTypeQuery node when TSImportType has isTypeOf ([#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076)) ([2b69b65](https://github.com/typescript-eslint/typescript-eslint/commit/2b69b659d87b58468e413801d31086ae0eeafff4)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info ([#6397](https://github.com/typescript-eslint/typescript-eslint/issues/6397)) ([02a37c4](https://github.com/typescript-eslint/typescript-eslint/commit/02a37c4c79d9b83998b7ee1376be43b06e12b3a0)) + + +### BREAKING CHANGES + +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/visitor-keys + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 2a1e7dbb73b..0a1eb6eb9ce 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,22 +1,25 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "5.56.0", + "version": "6.0.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", - "keywords": [ - "eslint", - "typescript", - "estree" - ], - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, "files": [ "dist", - "_ts3.4", + "_ts4.3", "package.json", "README.md", "LICENSE" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "repository": { "type": "git", "url": "https://github.com/typescript-eslint/typescript-eslint.git", @@ -26,21 +29,24 @@ "url": "https://github.com/typescript-eslint/typescript-eslint/issues" }, "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "keywords": [ + "eslint", + "typescript", + "estree" + ], "scripts": { "build": "tsc -b tsconfig.build.json", - "postbuild": "downlevel-dts dist _ts3.4/dist", + "postbuild": "downlevel-dts dist _ts4.3/dist --to=4.3", "clean": "tsc -b tsconfig.build.json --clean", - "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" }, "devDependencies": { "@types/eslint-visitor-keys": "*" @@ -50,9 +56,9 @@ "url": "https://opencollective.com/typescript-eslint" }, "typesVersions": { - "<3.8": { + "<4.7": { "*": [ - "_ts3.4/*" + "_ts4.3/*" ] } } diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json index ab99ec943a6..7c99d3dab60 100644 --- a/packages/visitor-keys/project.json +++ b/packages/visitor-keys/project.json @@ -5,10 +5,11 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/visitor-keys/**/*.ts"] + "lintFilePatterns": ["packages/visitor-keys/**/*.{mts,cts,ts,tsx}"], + "ignorePath": ".eslintignore" } } } diff --git a/packages/visitor-keys/src/get-keys.ts b/packages/visitor-keys/src/get-keys.ts index 99a4145e55b..d50033dcae6 100644 --- a/packages/visitor-keys/src/get-keys.ts +++ b/packages/visitor-keys/src/get-keys.ts @@ -1,6 +1,6 @@ import type { TSESTree } from '@typescript-eslint/types'; import { getKeys as getKeysOriginal } from 'eslint-visitor-keys'; -const getKeys: (node: TSESTree.Node) => ReadonlyArray = getKeysOriginal; +const getKeys: (node: TSESTree.Node) => readonly string[] = getKeysOriginal; export { getKeys }; diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 80a8b8c9c78..0435304688f 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -7,18 +7,18 @@ interface VisitorKeys { type GetNodeTypeKeys = Exclude< keyof Extract, - 'type' | 'loc' | 'range' | 'parent' + 'loc' | 'parent' | 'range' | 'type' >; type KeysDefinedInESLintVisitorKeysCore = - | AST_NODE_TYPES.AssignmentExpression - | AST_NODE_TYPES.AssignmentPattern | AST_NODE_TYPES.ArrayExpression | AST_NODE_TYPES.ArrayPattern | AST_NODE_TYPES.ArrowFunctionExpression + | AST_NODE_TYPES.AssignmentExpression + | AST_NODE_TYPES.AssignmentPattern | AST_NODE_TYPES.AwaitExpression - | AST_NODE_TYPES.BlockStatement | AST_NODE_TYPES.BinaryExpression + | AST_NODE_TYPES.BlockStatement | AST_NODE_TYPES.BreakStatement | AST_NODE_TYPES.CallExpression | AST_NODE_TYPES.CatchClause @@ -36,11 +36,9 @@ type KeysDefinedInESLintVisitorKeysCore = | AST_NODE_TYPES.ExportNamedDeclaration | AST_NODE_TYPES.ExportSpecifier | AST_NODE_TYPES.ExpressionStatement - // | AST_NODE_TYPES.ExperimentalRestProperty - // | AST_NODE_TYPES.ExperimentalSpreadProperty - | AST_NODE_TYPES.ForStatement | AST_NODE_TYPES.ForInStatement | AST_NODE_TYPES.ForOfStatement + | AST_NODE_TYPES.ForStatement | AST_NODE_TYPES.FunctionDeclaration | AST_NODE_TYPES.FunctionExpression | AST_NODE_TYPES.Identifier @@ -52,20 +50,20 @@ type KeysDefinedInESLintVisitorKeysCore = | AST_NODE_TYPES.ImportSpecifier | AST_NODE_TYPES.JSXAttribute | AST_NODE_TYPES.JSXClosingElement + | AST_NODE_TYPES.JSXClosingFragment | AST_NODE_TYPES.JSXElement | AST_NODE_TYPES.JSXEmptyExpression | AST_NODE_TYPES.JSXExpressionContainer + | AST_NODE_TYPES.JSXFragment | AST_NODE_TYPES.JSXIdentifier | AST_NODE_TYPES.JSXMemberExpression | AST_NODE_TYPES.JSXNamespacedName | AST_NODE_TYPES.JSXOpeningElement + | AST_NODE_TYPES.JSXOpeningFragment | AST_NODE_TYPES.JSXSpreadAttribute | AST_NODE_TYPES.JSXText - | AST_NODE_TYPES.JSXFragment - | AST_NODE_TYPES.JSXClosingFragment - | AST_NODE_TYPES.JSXOpeningFragment - | AST_NODE_TYPES.Literal | AST_NODE_TYPES.LabeledStatement + | AST_NODE_TYPES.Literal | AST_NODE_TYPES.LogicalExpression | AST_NODE_TYPES.MemberExpression | AST_NODE_TYPES.MetaProperty @@ -83,8 +81,8 @@ type KeysDefinedInESLintVisitorKeysCore = | AST_NODE_TYPES.SpreadElement | AST_NODE_TYPES.StaticBlock | AST_NODE_TYPES.Super - | AST_NODE_TYPES.SwitchStatement | AST_NODE_TYPES.SwitchCase + | AST_NODE_TYPES.SwitchStatement | AST_NODE_TYPES.TaggedTemplateExpression | AST_NODE_TYPES.TemplateElement | AST_NODE_TYPES.TemplateLiteral @@ -101,24 +99,39 @@ type KeysDefinedInESLintVisitorKeysCore = // strictly type the arrays of keys provided to make sure we keep this config in sync with the type defs type AdditionalKeys = { - readonly // require keys for all nodes NOT defined in `eslint-visitor-keys` - [T in Exclude< + // optionally allow keys for all nodes defined in `eslint-visitor-keys` + readonly [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[]; +} & { + // require keys for all nodes NOT defined in `eslint-visitor-keys` + readonly [T in Exclude< AST_NODE_TYPES, KeysDefinedInESLintVisitorKeysCore >]: readonly GetNodeTypeKeys[]; -} & { - readonly // optionally allow keys for all nodes defined in `eslint-visitor-keys` - [T in KeysDefinedInESLintVisitorKeysCore]?: readonly GetNodeTypeKeys[]; }; -/** - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * - * The key arrays should be sorted in the order in which you would want to visit - * the child keys - don't just sort them alphabetically. +/* + ********************************** IMPORTANT NOTE ******************************** + * * + * The key arrays should be sorted in the order in which you would want to visit * + * the child keys. * + * * + * DO NOT SORT THEM ALPHABETICALLY! * + * * + * They should be sorted in the order that they appear in the source code. * + * For example: * + * * + * class Foo extends Bar { prop: 1 } * + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ClassDeclaration * + * ^^^ id ^^^ superClass * + * ^^^^^^^^^^^ body * + * * + * It would be incorrect to provide the visitor keys ['body', 'id', 'superClass'] * + * because the body comes AFTER everything else in the source code. * + * Instead the correct ordering would be ['id', 'superClass', 'body']. * + * * + ********************************************************************************** */ -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- TODO - add ignore IIFE option const SharedVisitorKeys = (() => { const FunctionType = ['typeParameters', 'params', 'returnType'] as const; const AnonymousFunction = [...FunctionType, 'body'] as const; @@ -138,7 +151,7 @@ const SharedVisitorKeys = (() => { 'id', 'typeParameters', 'superClass', - 'superTypeParameters', + 'superTypeArguments', 'implements', 'body', ], @@ -154,7 +167,7 @@ const additionalKeys: AdditionalKeys = { ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction, AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'], - CallExpression: ['callee', 'typeParameters', 'arguments'], + CallExpression: ['callee', 'typeArguments', 'arguments'], ClassDeclaration: SharedVisitorKeys.ClassDeclaration, ClassExpression: SharedVisitorKeys.ClassDeclaration, Decorator: ['expression'], @@ -167,16 +180,16 @@ const additionalKeys: AdditionalKeys = { ImportDeclaration: ['specifiers', 'source', 'assertions'], ImportExpression: ['source', 'attributes'], JSXClosingFragment: [], - JSXOpeningElement: ['name', 'typeParameters', 'attributes'], + JSXOpeningElement: ['name', 'typeArguments', 'attributes'], JSXOpeningFragment: [], JSXSpreadChild: ['expression'], - MethodDefinition: ['decorators', 'key', 'value', 'typeParameters'], - NewExpression: ['callee', 'typeParameters', 'arguments'], + MethodDefinition: ['decorators', 'key', 'value'], + NewExpression: ['callee', 'typeArguments', 'arguments'], ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], PropertyDefinition: SharedVisitorKeys.PropertyDefinition, RestElement: ['decorators', 'argument', 'typeAnnotation'], StaticBlock: ['body'], - TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], + TaggedTemplateExpression: ['tag', 'typeArguments', 'quasi'], TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition, TSAbstractKeyword: [], TSAbstractMethodDefinition: ['key', 'value'], @@ -188,7 +201,7 @@ const additionalKeys: AdditionalKeys = { TSBigIntKeyword: [], TSBooleanKeyword: [], TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType, - TSClassImplements: ['expression', 'typeParameters'], + TSClassImplements: ['expression', 'typeArguments'], TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'], TSConstructorType: SharedVisitorKeys.FunctionType, TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType, @@ -202,14 +215,14 @@ const additionalKeys: AdditionalKeys = { TSExternalModuleReference: ['expression'], TSFunctionType: SharedVisitorKeys.FunctionType, TSImportEqualsDeclaration: ['id', 'moduleReference'], - TSImportType: ['parameter', 'qualifier', 'typeParameters'], + TSImportType: ['argument', 'qualifier', 'typeArguments'], TSIndexedAccessType: ['indexType', 'objectType'], TSIndexSignature: ['parameters', 'typeAnnotation'], TSInferType: ['typeParameter'], - TSInstantiationExpression: ['expression', 'typeParameters'], + TSInstantiationExpression: ['expression', 'typeArguments'], TSInterfaceBody: ['body'], TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'], - TSInterfaceHeritage: ['expression', 'typeParameters'], + TSInterfaceHeritage: ['expression', 'typeArguments'], TSIntersectionType: ['types'], TSIntrinsicKeyword: [], TSLiteralType: ['literal'], @@ -227,7 +240,7 @@ const additionalKeys: AdditionalKeys = { TSOptionalType: ['typeAnnotation'], TSParameterProperty: ['decorators', 'parameter'], TSPrivateKeyword: [], - TSPropertySignature: ['typeAnnotation', 'key', 'initializer'], + TSPropertySignature: ['typeAnnotation', 'key'], TSProtectedKeyword: [], TSPublicKeyword: [], TSQualifiedName: ['left', 'right'], @@ -254,8 +267,8 @@ const additionalKeys: AdditionalKeys = { TSTypeParameterDeclaration: ['params'], TSTypeParameterInstantiation: ['params'], TSTypePredicate: ['typeAnnotation', 'parameterName'], - TSTypeQuery: ['exprName', 'typeParameters'], - TSTypeReference: ['typeName', 'typeParameters'], + TSTypeQuery: ['exprName', 'typeArguments'], + TSTypeReference: ['typeName', 'typeArguments'], TSUndefinedKeyword: [], TSUnionType: ['types'], TSUnknownKeyword: [], diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index 3770b44ce28..136846a7c0f 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/CHANGELOG.md @@ -3,42 +3,84 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. -# [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* update `exports` field in package.json files ([#6550](https://github.com/typescript-eslint/typescript-eslint/issues/6550)) ([53776c2](https://github.com/typescript-eslint/typescript-eslint/commit/53776c244f8bbdc852d57c7b313b0935e755ddc4)) + + +### chore + +* drop support for node v14.17, v17 ([#5971](https://github.com/typescript-eslint/typescript-eslint/issues/5971)) ([cc62015](https://github.com/typescript-eslint/typescript-eslint/commit/cc62015b8ae5f207912ff8988e2a0b3fe9a79243)) + + +### Features + +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* drop support for node v12 ([#5918](https://github.com/typescript-eslint/typescript-eslint/issues/5918)) ([7e3fe9a](https://github.com/typescript-eslint/typescript-eslint/commit/7e3fe9a67abd394b0a114f2deb466edf5c9759ac)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) + + +### BREAKING CHANGES + +* drops support for node v17 +* drops support for node v12 + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) **Note:** Version bump only for package @typescript-eslint/website-eslint +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. -# [5.55.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.1...v5.55.0) (2023-03-13) + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) **Note:** Version bump only for package @typescript-eslint/website-eslint +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. -## [5.54.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.0...v5.54.1) (2023-03-06) + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) **Note:** Version bump only for package @typescript-eslint/website-eslint +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. -# [5.54.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.53.0...v5.54.0) (2023-02-27) +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) -### Bug Fixes +**Note:** Version bump only for package @typescript-eslint/website-eslint -* **website:** corect playground build issue ([#6506](https://github.com/typescript-eslint/typescript-eslint/issues/6506)) ([6aad7d3](https://github.com/typescript-eslint/typescript-eslint/commit/6aad7d3957c28e408235eb1e5d7fedccc594280f)) +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + -# [5.53.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.52.0...v5.53.0) (2023-02-20) + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -46,7 +88,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline -# [5.52.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.51.0...v5.52.0) (2023-02-13) +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -54,7 +96,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline -# [5.51.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.50.0...v5.51.0) (2023-02-06) +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -62,7 +104,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline -# [5.50.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.49.0...v5.50.0) (2023-01-31) +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -70,7 +112,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline -# [5.49.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.2...v5.49.0) (2023-01-23) +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -78,7 +120,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline -## [5.48.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.1...v5.48.2) (2023-01-16) +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -86,7 +128,71 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline -## [5.48.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.0...v5.48.1) (2023-01-09) +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +# [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package @typescript-eslint/website-eslint @@ -94,6 +200,65 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline +# [5.55.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.1...v5.55.0) (2023-03-13) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +## [5.54.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.54.0...v5.54.1) (2023-03-06) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +# [5.54.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.53.0...v5.54.0) (2023-02-27) + + +### Bug Fixes + +* **website:** corect playground build issue ([#6506](https://github.com/typescript-eslint/typescript-eslint/issues/6506)) ([6aad7d3](https://github.com/typescript-eslint/typescript-eslint/commit/6aad7d3957c28e408235eb1e5d7fedccc594280f)) + + + + + +# [5.53.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.52.0...v5.53.0) (2023-02-20) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + +# [5.52.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.51.0...v5.52.0) (2023-02-13) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +# [5.51.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.50.0...v5.51.0) (2023-02-06) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +# [5.50.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.49.0...v5.50.0) (2023-01-31) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +# [5.49.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.2...v5.49.0) (2023-01-23) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +## [5.48.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.1...v5.48.2) (2023-01-16) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + +## [5.48.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.48.0...v5.48.1) (2023-01-09) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + # [5.48.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) (2023-01-02) **Note:** Version bump only for package @typescript-eslint/website-eslint diff --git a/packages/website-eslint/build.ts b/packages/website-eslint/build.ts new file mode 100644 index 00000000000..85fb695499b --- /dev/null +++ b/packages/website-eslint/build.ts @@ -0,0 +1,167 @@ +/* eslint-disable no-process-exit, no-console */ + +import * as fs from 'node:fs/promises'; +import { createRequire } from 'node:module'; +import * as path from 'node:path'; + +import * as esbuild from 'esbuild'; + +function requireResolved(targetPath: string): string { + return createRequire(__filename).resolve(targetPath); +} + +function normalizePath(filePath: string): string { + return filePath.replace(/\\/g, '/'); +} + +function requireMock(targetPath: string): Promise { + return fs.readFile(requireResolved(targetPath), 'utf8'); +} + +function makeFilter(filePath: string[] | string): { filter: RegExp } { + const paths = Array.isArray(filePath) ? filePath : [filePath]; + const norm = paths.map(item => + normalizePath(item).replace(/\//g, '[\\\\/]').replace(/\./g, '\\.'), + ); + return { filter: new RegExp('(' + norm.join('|') + ')$') }; +} + +function createResolve( + targetPath: string, + join: string, +): esbuild.OnResolveResult { + const resolvedPackage = requireResolved(targetPath + '/package.json'); + return { + path: path.join(resolvedPackage, '../src/', join), + }; +} + +async function buildPackage(name: string, file: string): Promise { + const eslintRoot = requireResolved('eslint/package.json'); + const linterPath = path.join(eslintRoot, '../lib/linter/linter.js'); + const rulesPath = path.join(eslintRoot, '../lib/rules/index.js'); + + await esbuild.build({ + entryPoints: { + [name]: requireResolved(file), + }, + format: 'cjs', + platform: 'browser', + bundle: true, + external: [], + minify: true, + treeShaking: true, + write: true, + target: 'es2020', + sourcemap: 'linked', + outdir: './dist/', + supported: {}, + banner: { + // https://github.com/evanw/esbuild/issues/819 + js: `define(['exports', 'vs/language/typescript/tsWorker'], function (exports) {`, + }, + footer: { + // https://github.com/evanw/esbuild/issues/819 + js: `});`, + }, + define: { + 'process.env.NODE_ENV': '"production"', + 'process.env.NODE_DEBUG': 'false', + 'process.env.IGNORE_TEST_WIN32': 'true', + 'process.env.DEBUG': 'false', + 'process.emitWarning': 'console.warn', + 'process.platform': '"browser"', + 'process.env.TIMING': 'undefined', + 'define.amd': 'false', + global: 'window', + }, + alias: { + util: requireResolved('./src/mock/util.js'), + assert: requireResolved('./src/mock/assert.js'), + path: requireResolved('./src/mock/path.js'), + typescript: requireResolved('./src/mock/typescript.js'), + 'lru-cache': requireResolved('./src/mock/lru-cache.js'), + }, + plugins: [ + { + name: 'replace-plugin', + setup(build): void { + build.onLoad( + makeFilter([ + '/eslint-utils/rule-tester/RuleTester.ts', + '/ts-eslint/ESLint.ts', + '/ts-eslint/RuleTester.ts', + '/ts-eslint/CLIEngine.ts', + ]), + async args => { + console.log('onLoad:replace', args.path); + const contents = await requireMock('./src/mock/empty.js'); + return { contents, loader: 'js' }; + }, + ); + build.onLoad( + makeFilter('/eslint/lib/unsupported-api.js'), + async args => { + console.log('onLoad:eslint:unsupported-api', args.path); + let contents = await requireMock('./src/mock/eslint-rules.js'); + // this is needed to bypass system module resolver + contents = contents.replace( + 'vt:eslint/rules', + normalizePath(rulesPath), + ); + return { contents, loader: 'js' }; + }, + ); + build.onLoad(makeFilter('/eslint/lib/api.js'), async args => { + console.log('onLoad:eslint', args.path); + let text = await requireMock('./src/mock/eslint.js'); + // this is needed to bypass system module resolver + text = text.replace('vt:eslint/linter', normalizePath(linterPath)); + return { contents: text, loader: 'js' }; + }); + build.onResolve( + makeFilter([ + '@typescript-eslint/typescript-estree', + '@typescript-eslint/typescript-estree/use-at-your-own-risk', + ]), + () => + createResolve( + '@typescript-eslint/typescript-estree', + 'use-at-your-own-risk.ts', + ), + ); + const anyAlias = /^(@typescript-eslint\/[a-z-]+)\/([a-z-]+)$/; + build.onResolve({ filter: anyAlias }, args => { + const parts = args.path.match(anyAlias); + if (parts) { + return createResolve(parts[1], `${parts[2]}/index.ts`); + } + return null; + }); + build.onResolve(makeFilter('@typescript-eslint/[a-z-]+'), args => + createResolve(args.path, 'index.ts'), + ); + build.onEnd(e => { + for (const error of e.errors) { + console.error(error); + } + for (const warning of e.warnings) { + console.warn(warning); + } + }); + }, + }, + ], + }); +} + +console.time('building eslint for web'); + +buildPackage('index', './src/index.js') + .then(() => { + console.timeEnd('building eslint for web'); + }) + .catch((e: unknown) => { + console.error(String(e)); + process.exit(1); + }); diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 1652f79ae0d..151f95a4dc6 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,38 +1,43 @@ { "name": "@typescript-eslint/website-eslint", - "version": "5.56.0", + "version": "6.0.0", "private": true, "description": "ESLint which works in browsers.", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "types": "types/index.d.ts", - "main": "dist/index.js", "files": [ "dist" ], + "type": "commonjs", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, "scripts": { - "build": "rollup --config=rollup.config.js", - "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore" + "build": "yarn tsx ./build.ts", + "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", + "lint": "nx lint", + "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/utils": "5.56.0" + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/utils": "6.0.0" }, "devDependencies": { - "@rollup/plugin-commonjs": "^23.0.0", - "@rollup/plugin-json": "^5.0.0", - "@rollup/plugin-node-resolve": "^15.0.0", - "@rollup/plugin-terser": "^0.4.0", - "@rollup/pluginutils": "^5.0.0", - "@typescript-eslint/eslint-plugin": "5.56.0", - "@typescript-eslint/parser": "5.56.0", - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/typescript-estree": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0", + "@eslint/js": "8.45.0", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/parser": "6.0.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/utils": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", + "esbuild": "~0.17.19", "eslint": "*", "esquery": "*", - "rollup": "^2.75.4", - "semver": "^7.3.7" + "semver": "^7.5.4" } } diff --git a/packages/website-eslint/project.json b/packages/website-eslint/project.json index 862c5b948f1..a8bec5aedf9 100644 --- a/packages/website-eslint/project.json +++ b/packages/website-eslint/project.json @@ -2,5 +2,18 @@ "name": "website-eslint", "$schema": "../../node_modules/nx/schemas/project-schema.json", "type": "library", - "implicitDependencies": [] + "implicitDependencies": [], + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/website-eslint/**/*.{mts,cts,ts,tsx}", + "packages/website-eslint/**/*.{mjs,cjs,js,jsx}" + ], + "ignorePath": ".eslintignore" + } + } + } } diff --git a/packages/website-eslint/rollup-plugin/replace.js b/packages/website-eslint/rollup-plugin/replace.js deleted file mode 100644 index b8f3143c905..00000000000 --- a/packages/website-eslint/rollup-plugin/replace.js +++ /dev/null @@ -1,94 +0,0 @@ -const path = require('path'); -const Module = require('module'); -const rollupPluginUtils = require('@rollup/pluginutils'); -const MagicString = require('magic-string'); - -function toAbsolute(id) { - return id.startsWith('./') ? path.resolve(id) : require.resolve(id); -} - -function log(opts, message, type = 'info') { - if (opts.verbose) { - console.log('rollup-plugin-replace > [' + type + ']', message); - } -} - -function createMatcher(it) { - if (typeof it === 'function') { - return it; - } else { - return rollupPluginUtils.createFilter(it); - } -} - -module.exports = (options = {}) => { - const aliasesCache = new Map(); - const aliases = (options.alias || []).map(item => { - return { - match: item.match, - matcher: createMatcher(item.match), - target: item.target, - absoluteTarget: toAbsolute(item.target), - }; - }); - const replaces = (options.replace || []).map(item => { - return { - match: item.match, - test: item.test, - replace: - typeof item.replace === 'string' ? () => item.replace : item.replace, - - matcher: createMatcher(item.match), - }; - }); - - return { - name: 'rollup-plugin-replace', - resolveId(id, importerPath) { - const importeePath = - id.startsWith('./') || id.startsWith('../') - ? Module.createRequire(importerPath).resolve(id) - : id; - - let result = aliasesCache.get(importeePath); - if (result) { - return result; - } - - result = aliases.find(item => item.matcher(importeePath)); - if (result) { - aliasesCache.set(importeePath, result.absoluteTarget); - log(options, `${importeePath} as ${result.target}`, 'resolve'); - return result.absoluteTarget; - } - - return null; - }, - transform(code, id) { - let hasReplacements = false; - let magicString = new MagicString(code); - - replaces.forEach(item => { - if (item.matcher && !item.matcher(id)) { - return; - } - - let match = item.test.exec(code); - let start, end; - while (match) { - hasReplacements = true; - start = match.index; - end = start + match[0].length; - magicString.overwrite(start, end, item.replace(match)); - match = item.test.global ? item.test.exec(code) : null; - } - }); - - if (!hasReplacements) { - return; - } - log(options, id, 'replace'); - return { code: magicString.toString() }; - }, - }; -}; diff --git a/packages/website-eslint/rollup.config.js b/packages/website-eslint/rollup.config.js deleted file mode 100644 index 8f17c5efe2a..00000000000 --- a/packages/website-eslint/rollup.config.js +++ /dev/null @@ -1,138 +0,0 @@ -import commonjs from '@rollup/plugin-commonjs'; -import json from '@rollup/plugin-json'; -import resolve from '@rollup/plugin-node-resolve'; -import terser from '@rollup/plugin-terser'; - -const replace = require('./rollup-plugin/replace'); - -module.exports = { - input: 'src/linter/linter.js', - output: { - format: 'amd', - interop: 'auto', - freeze: false, - sourcemap: true, - file: 'dist/index.js', - }, - external: ['vs/language/typescript/tsWorker'], - plugins: [ - terser({ - keep_classnames: true, - compress: { - global_defs: { - 'process.platform': '"browser"', - 'process.env.CI': 'undefined', - '@process.env.TSESTREE_SINGLE_RUN': 'undefined', - '@process.env.DEBUG': 'undefined', - }, - }, - }), - replace({ - // verbose: true, - alias: [ - { - // those files should be omitted, we do not want them to be exposed to web - match: [ - /eslint\/lib\/(rule-tester|eslint|cli-engine|init)\//u, - /eslint\/lib\/cli\.js$/, - /utils\/dist\/eslint-utils\/rule-tester\/RuleTester\.js$/, - /utils\/dist\/ts-eslint\/CLIEngine\.js$/, - /utils\/dist\/ts-eslint\/RuleTester\.js$/, - /typescript-estree\/dist\/create-program\/getWatchProgramsForProjects\.js/, - /typescript-estree\/dist\/create-program\/createProjectProgram\.js/, - /typescript-estree\/dist\/create-program\/createIsolatedProgram\.js/, - /typescript-estree\/dist\/clear-caches\.js/, - /utils\/dist\/ts-eslint\/ESLint\.js/, - /ajv\/lib\/definition_schema\.js/, - /stream/, - /os/, - /fs/, - ], - target: './src/mock/empty.js', - }, - { - // use window.ts instead of bundling typescript - match: /typescript$/u, - target: './src/mock/typescript.js', - }, - { - // assert for web - match: /^assert$/u, - target: './src/mock/assert.js', - }, - { - // path for web - match: /^path$/u, - target: './src/mock/path.js', - }, - { - // util for web - match: /^util$/u, - target: './src/mock/util.js', - }, - { - // semver simplified, solve issue with circular dependencies - match: /semver$/u, - target: './src/mock/semver.js', - }, - { - match: /^globby$/u, - target: './src/mock/globby.js', - }, - { - match: /^is-glob$/u, - target: './src/mock/is-glob.js', - }, - ], - replace: [ - { - // we do not want dynamic imports - match: /eslint\/lib\/linter\/rules\.js$/u, - test: /require\(this\._rules\[ruleId\]\)/u, - replace: 'null', - }, - { - // esquery has both browser and node versions, we are bundling browser version that has different export - test: /esquery\.parse\(/u, - replace: 'esquery.default.parse(', - }, - { - // esquery has both browser and node versions, we are bundling browser version that has different export - test: /esquery\.matches\(/u, - replace: 'esquery.default.matches(', - }, - { - // replace all process.env.NODE_DEBUG with false - test: /process\.env\.NODE_DEBUG/u, - replace: 'false', - }, - { - // replace all process.env.TIMING with false - test: /process\.env\.TIMING/u, - replace: 'false', - }, - { - // replace all process.env.IGNORE_TEST_WIN32 with true - test: /process\.env\.IGNORE_TEST_WIN32/u, - replace: 'true', - }, - { - // replace all process.cwd with "/" - test: /process\.cwd\(\)/u, - replace: '"/"', - }, - { - // replace all process.emitWarning with console.warn - test: /process.emitWarning/u, - replace: 'console.warn', - }, - ], - }), - resolve({ - browser: true, - preferBuiltins: false, - }), - commonjs(), - json({ preferConst: true }), - ], -}; diff --git a/packages/website-eslint/src/index.js b/packages/website-eslint/src/index.js new file mode 100644 index 00000000000..1c16db4da84 --- /dev/null +++ b/packages/website-eslint/src/index.js @@ -0,0 +1,50 @@ +/* +NOTE - this file intentionally uses deep `/use-at-your-own-risk` imports into our packages. +This is so that esbuild can properly tree-shake and only include the necessary code. +This saves us having to mock unnecessary things and reduces our bundle size. +*/ +// @ts-check + +import eslintJs from '@eslint/js'; +import * as plugin from '@typescript-eslint/eslint-plugin'; +import { analyze } from '@typescript-eslint/scope-manager'; +import { + astConverter, + getScriptKind, +} from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; +import { visitorKeys } from '@typescript-eslint/visitor-keys'; +import { Linter } from 'eslint'; +import esquery from 'esquery'; + +// don't change exports to export * +exports.getScriptKind = getScriptKind; +exports.analyze = analyze; +exports.visitorKeys = visitorKeys; +exports.astConverter = astConverter; +exports.esquery = esquery; + +exports.createLinter = function () { + const linter = new Linter(); + for (const name in plugin.rules) { + linter.defineRule(`@typescript-eslint/${name}`, plugin.rules[name]); + } + return linter; +}; + +/** @type {Record} */ +const configs = {}; + +for (const [name, value] of Object.entries(eslintJs.configs)) { + configs[`eslint:${name}`] = value; +} + +for (const [name, value] of Object.entries(plugin.configs)) { + if (value.extends && Array.isArray(value.extends)) { + value.extends = value.extends.map(name => + name.replace(/^\.\/configs\//, 'plugin:@typescript-eslint/'), + ); + } + configs[`plugin:@typescript-eslint/${name}`] = value; +} + +exports.configs = configs; diff --git a/packages/website-eslint/src/linter/linter.js b/packages/website-eslint/src/linter/linter.js deleted file mode 100644 index 41454dd4e74..00000000000 --- a/packages/website-eslint/src/linter/linter.js +++ /dev/null @@ -1,19 +0,0 @@ -import 'vs/language/typescript/tsWorker'; -import { Linter } from 'eslint'; -import rules from '@typescript-eslint/eslint-plugin/dist/rules'; -import esquery from 'esquery'; - -export function createLinter() { - const linter = new Linter(); - for (const name in rules) { - linter.defineRule(`@typescript-eslint/${name}`, rules[name]); - } - return linter; -} - -export { analyze } from '@typescript-eslint/scope-manager/dist/analyze'; -export { visitorKeys } from '@typescript-eslint/visitor-keys/dist/visitor-keys'; -export { astConverter } from '@typescript-eslint/typescript-estree/dist/ast-converter'; -export { getScriptKind } from '@typescript-eslint/typescript-estree/dist/create-program/getScriptKind'; - -export { esquery }; diff --git a/packages/website-eslint/src/mock/assert.js b/packages/website-eslint/src/mock/assert.js index 70cbf7a4fbc..223c1d75227 100644 --- a/packages/website-eslint/src/mock/assert.js +++ b/packages/website-eslint/src/mock/assert.js @@ -81,6 +81,7 @@ function assert(value, message) { } } assert.equal = function equal(actual, expected, message) { + // eslint-disable-next-line eqeqeq -- intentional inexact equality if (actual != expected) { fail(actual, expected, message, '==', equal); } @@ -96,6 +97,7 @@ assert.notStrictEqual = function notStrictEqual(actual, expected, message) { } }; assert.notEqual = function notEqual(actual, expected, message) { + // eslint-disable-next-line eqeqeq -- intentional inexact equality if (actual == expected) { fail(actual, expected, message, '!=', notEqual); } diff --git a/packages/website-eslint/src/mock/empty.js b/packages/website-eslint/src/mock/empty.js index ff8b4c56321..cb0ff5c3b54 100644 --- a/packages/website-eslint/src/mock/empty.js +++ b/packages/website-eslint/src/mock/empty.js @@ -1 +1 @@ -export default {}; +export {}; diff --git a/packages/website-eslint/src/mock/eslint-rules.js b/packages/website-eslint/src/mock/eslint-rules.js new file mode 100644 index 00000000000..e38eed4cefb --- /dev/null +++ b/packages/website-eslint/src/mock/eslint-rules.js @@ -0,0 +1 @@ +exports.builtinRules = require('vt:eslint/rules'); diff --git a/packages/website-eslint/src/mock/eslint.js b/packages/website-eslint/src/mock/eslint.js new file mode 100644 index 00000000000..bb112732ff6 --- /dev/null +++ b/packages/website-eslint/src/mock/eslint.js @@ -0,0 +1,7 @@ +class RuleTester {} +class SourceCode {} + +exports.Linter = require('vt:eslint/linter').Linter; + +exports.RuleTester = RuleTester; +exports.SourceCode = SourceCode; diff --git a/packages/website-eslint/src/mock/globby.js b/packages/website-eslint/src/mock/globby.js deleted file mode 100644 index 80c2ae2d9e1..00000000000 --- a/packages/website-eslint/src/mock/globby.js +++ /dev/null @@ -1,4 +0,0 @@ -export function sync() { - // the website config is static and doesn't use glob config - return []; -} diff --git a/packages/website-eslint/src/mock/is-glob.js b/packages/website-eslint/src/mock/is-glob.js deleted file mode 100644 index e35771f6460..00000000000 --- a/packages/website-eslint/src/mock/is-glob.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function isGlob() { - // the website config is static and doesn't use glob config - return false; -} diff --git a/packages/website-eslint/src/mock/lru-cache.js b/packages/website-eslint/src/mock/lru-cache.js new file mode 100644 index 00000000000..ed112299ab1 --- /dev/null +++ b/packages/website-eslint/src/mock/lru-cache.js @@ -0,0 +1,14 @@ +class LruCache { + constructor() { + this.cache = new Map(); + } + get(name) { + return this.cache.get(name); + } + set(name, value) { + this.cache.set(name, value); + return value; + } +} + +module.exports = LruCache; diff --git a/packages/website-eslint/src/mock/path.js b/packages/website-eslint/src/mock/path.js index a93a1a650d1..abf5e0f2466 100644 --- a/packages/website-eslint/src/mock/path.js +++ b/packages/website-eslint/src/mock/path.js @@ -52,7 +52,7 @@ function normalizeArray(parts, allowAboveRoot) { // Split a filename into [root, dir, basename, ext], unix version // 'root' is just a slash, or nothing. const splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/; const splitPath = function (filename) { return splitPathRe.exec(filename).slice(1); }; @@ -60,8 +60,8 @@ const splitPath = function (filename) { // path.resolve([from ...], to) // posix version export function resolve() { - let resolvedPath = '', - resolvedAbsolute = false; + let resolvedPath = ''; + let resolvedAbsolute = false; for (let i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { const path = i >= 0 ? arguments[i] : '/'; @@ -94,8 +94,8 @@ export function resolve() { // path.normalize(path) // posix version export function normalize(path) { - let isPathAbsolute = isAbsolute(path), - trailingSlash = path.endsWith('/'); + let isPathAbsolute = isAbsolute(path); + let trailingSlash = path.endsWith('/'); // Normalize the path path = normalizeArray( @@ -124,7 +124,7 @@ export function isAbsolute(path) { export function join() { const paths = Array.prototype.slice.call(arguments, 0); return normalize( - filter(paths, function (p, index) { + filter(paths, function (p) { if (typeof p !== 'string') { throw new TypeError('Arguments to path.join must be strings'); } @@ -142,15 +142,21 @@ export function relative(from, to) { function trim(arr) { let start = 0; for (; start < arr.length; start++) { - if (arr[start] !== '') break; + if (arr[start] !== '') { + break; + } } var end = arr.length - 1; for (; end >= 0; end--) { - if (arr[end] !== '') break; + if (arr[end] !== '') { + break; + } } - if (start > end) return []; + if (start > end) { + return []; + } return arr.slice(start, end - start + 1); } @@ -166,7 +172,7 @@ export function relative(from, to) { } } - const outputParts = []; + let outputParts = []; for (let i = samePartsLength; i < fromParts.length; i++) { outputParts.push('..'); } @@ -176,8 +182,8 @@ export function relative(from, to) { return outputParts.join('/'); } -export var sep = '/'; -export var delimiter = ':'; +export const sep = '/'; +export const delimiter = ':'; export function dirname(path) { const result = splitPath(path); @@ -224,10 +230,14 @@ export default { }; function filter(xs, f) { - if (xs.filter) return xs.filter(f); + if (xs.filter) { + return xs.filter(f); + } const res = []; for (let i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); + if (f(xs[i], i, xs)) { + res.push(xs[i]); + } } return res; } diff --git a/packages/website-eslint/src/mock/semver.js b/packages/website-eslint/src/mock/semver.js deleted file mode 100644 index a7671aaaf06..00000000000 --- a/packages/website-eslint/src/mock/semver.js +++ /dev/null @@ -1,7 +0,0 @@ -import satisfies from 'semver/functions/satisfies'; -import major from 'semver/functions/major'; - -// just in case someone adds a import * as semver usage -export { satisfies, major }; - -export default { satisfies, major }; diff --git a/packages/website-eslint/src/mock/typescript.js b/packages/website-eslint/src/mock/typescript.js index 324b844294b..0bc92bb2adc 100644 --- a/packages/website-eslint/src/mock/typescript.js +++ b/packages/website-eslint/src/mock/typescript.js @@ -1 +1,3 @@ +/* global window */ + module.exports = window.ts; diff --git a/packages/website-eslint/src/mock/util.js b/packages/website-eslint/src/mock/util.js index 3e5cd5e0e71..13e7fa4bada 100644 --- a/packages/website-eslint/src/mock/util.js +++ b/packages/website-eslint/src/mock/util.js @@ -4,4 +4,4 @@ util.inspect = function (value) { return value; }; -export default util; +module.exports = util; diff --git a/packages/website-eslint/tsconfig.json b/packages/website-eslint/tsconfig.json new file mode 100644 index 00000000000..aeafdb4d3f3 --- /dev/null +++ b/packages/website-eslint/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "allowJs": true, + // opt-in files for checking + "checkJs": false, + // build is done via esbuild + "noEmit": true, + "skipLibCheck": true + }, + "include": ["src", "types", "build.ts"], + "references": [] +} diff --git a/packages/website-eslint/types/eslint-js.d.ts b/packages/website-eslint/types/eslint-js.d.ts new file mode 100644 index 00000000000..561e55b673a --- /dev/null +++ b/packages/website-eslint/types/eslint-js.d.ts @@ -0,0 +1,6 @@ +declare module '@eslint/js' { + declare const configs: Record; + export = { + configs, + }; +} diff --git a/packages/website-eslint/types/eslint.d.ts b/packages/website-eslint/types/eslint.d.ts new file mode 100644 index 00000000000..82c78be17ef --- /dev/null +++ b/packages/website-eslint/types/eslint.d.ts @@ -0,0 +1,15 @@ +/* +VSCode has a helpful feature where it'll automatically fetch types for you for your JS node module imports. +So it means that in the IDE you'll open the file and VSCode will tell TS it can look in its cache for module +types for the `@types/eslint` package. It finds it, uses it, then will show errors because our `RuleModule` +doesn't match the `@types/eslint` `RuleModule`. + +But this behavior only happens in the IDE, not the CLI - because the CLI can't use VSCode's cache, ofc, so +it just uses `any` for the import - marking it as an untyped export. So adding this type tells TS that it +cannot use VSCode's cache ever - stubbing it out permanently. +*/ +declare module 'eslint' { + export class Linter { + defineRule(name: string, rule: unknown): void; + } +} diff --git a/packages/website-eslint/types/esquery.d.ts b/packages/website-eslint/types/esquery.d.ts new file mode 100644 index 00000000000..647cc934232 --- /dev/null +++ b/packages/website-eslint/types/esquery.d.ts @@ -0,0 +1,7 @@ +/* +the website package has the full, forked types - we just re-export the package here +so no need for us to include them here +*/ +declare module 'esquery' { + export default {}; +} diff --git a/packages/website-eslint/types/index.d.ts b/packages/website-eslint/types/index.d.ts deleted file mode 100644 index 5793d9822c2..00000000000 --- a/packages/website-eslint/types/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { TSESLint } from '@typescript-eslint/utils'; - -import { analyze } from '@typescript-eslint/scope-manager/dist/analyze'; -import { astConverter } from '@typescript-eslint/typescript-estree/dist/ast-converter'; -import { getScriptKind } from '@typescript-eslint/typescript-estree/dist/create-program/getScriptKind'; -import esquery from 'esquery'; - -export interface LintUtils { - createLinter: () => TSESLint.Linter; - analyze: typeof analyze; - visitorKeys: TSESLint.SourceCode.VisitorKeys; - astConverter: typeof astConverter; - getScriptKind: typeof getScriptKind; - esquery: typeof esquery; -} diff --git a/packages/website/.eslintrc.js b/packages/website/.eslintrc.js deleted file mode 100644 index 323ce34a38d..00000000000 --- a/packages/website/.eslintrc.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - extends: [ - '../../.eslintrc.js', - 'plugin:jsx-a11y/recommended', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - ], - plugins: ['jsx-a11y', 'react', 'react-hooks'], - overrides: [ - { - files: [ - './*.config.*', - './src/pages/*.tsx', - './src/components/**/*.tsx', - './src/components/hooks/*.ts', - ], - rules: { - 'import/no-default-export': 'off', - }, - }, - ], - rules: { - 'react/jsx-no-target-blank': 'off', - 'react/no-unescaped-entities': 'off', - '@typescript-eslint/internal/prefer-ast-types-enum': 'off', - 'react/jsx-curly-brace-presence': 'error', - }, - settings: { - react: { - version: 'detect', - }, - }, -}; diff --git a/packages/website/.stylelintrc.json b/packages/website/.stylelintrc.json new file mode 100644 index 00000000000..f62c132333b --- /dev/null +++ b/packages/website/.stylelintrc.json @@ -0,0 +1,14 @@ +{ + "extends": ["stylelint-config-standard", "stylelint-config-recommended"], + "plugins": ["stylelint-order"], + "rules": { + "order/order": ["custom-properties", "declarations"], + "selector-class-pattern": null, + "no-descending-specificity": null, + "selector-pseudo-class-no-unknown": [ + true, + { "ignorePseudoClasses": ["global"] } + ] + }, + "ignoreFiles": ["dist/**/*", "node_modules/**/*", "**/*.min.css"] +} diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index 5f41cedb4b0..9136576983e 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -3,6 +3,201 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [6.0.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.62.0...v6.0.0) (2023-07-10) + + +### Bug Fixes + +* correct lint error after merge ([277fdb5](https://github.com/typescript-eslint/typescript-eslint/commit/277fdb5ac76bd761ae6f5d1052445dcff2e848a1)) + + +### Features + +* add new package `rule-tester` ([#6777](https://github.com/typescript-eslint/typescript-eslint/issues/6777)) ([2ce1c1d](https://github.com/typescript-eslint/typescript-eslint/commit/2ce1c1d22c799a1ca027674fcb9b3a7ab0107428)) +* add package.json exports for public packages ([#6458](https://github.com/typescript-eslint/typescript-eslint/issues/6458)) ([d676683](https://github.com/typescript-eslint/typescript-eslint/commit/d6766838a05259556029acaac57dc7839b68c592)) +* drop support for node v14 and test against node v20 ([#7022](https://github.com/typescript-eslint/typescript-eslint/issues/7022)) ([e6235bf](https://github.com/typescript-eslint/typescript-eslint/commit/e6235bf61b781066653581b57b7cd976c9c4f905)) +* **eslint-plugin:** apply final v6 changes to configs ([#7110](https://github.com/typescript-eslint/typescript-eslint/issues/7110)) ([c13ce0b](https://github.com/typescript-eslint/typescript-eslint/commit/c13ce0b4f7a74a6d8fecf78d25ebd8181f7a9119)) +* **eslint-plugin:** rework configs: recommended, strict, stylistic; -type-checked ([#5251](https://github.com/typescript-eslint/typescript-eslint/issues/5251)) ([5346b5b](https://github.com/typescript-eslint/typescript-eslint/commit/5346b5bbdbba81439ba761c282ba9cdcec7b45c8)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* fork json schema types for better compat with ESLint rule validation ([#6963](https://github.com/typescript-eslint/typescript-eslint/issues/6963)) ([a4967f2](https://github.com/typescript-eslint/typescript-eslint/commit/a4967f2e8cc7b0432d8dfe804772e60042c5384c)) +* improve rule schemas, add test to validate schemas, add tooling to generate schema types ([#6899](https://github.com/typescript-eslint/typescript-eslint/issues/6899)) ([acc1a43](https://github.com/typescript-eslint/typescript-eslint/commit/acc1a43e02a403ff74a54c28c2c495f00d0be038)) +* made BaseNode.parent non-optional ([#5252](https://github.com/typescript-eslint/typescript-eslint/issues/5252)) ([a4768f3](https://github.com/typescript-eslint/typescript-eslint/commit/a4768f38ef4943873c1e9443e8cd101a663ac3c0)), closes [#5036](https://github.com/typescript-eslint/typescript-eslint/issues/5036) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#3076](https://github.com/typescript-eslint/typescript-eslint/issues/3076) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889) [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) [#4863](https://github.com/typescript-eslint/typescript-eslint/issues/4863) [#5381](https://github.com/typescript-eslint/typescript-eslint/issues/5381) [#5256](https://github.com/typescript-eslint/typescript-eslint/issues/5256) [#5399](https://github.com/typescript-eslint/typescript-eslint/issues/5399) +* remove `RuleTester` in `/utils` in favour of the new `/rule-tester` package ([#6816](https://github.com/typescript-eslint/typescript-eslint/issues/6816)) ([c33f497](https://github.com/typescript-eslint/typescript-eslint/commit/c33f497ad8aec7c123c7374f7aff3e24025fe861)) +* remove moduleResolver API ([#6609](https://github.com/typescript-eslint/typescript-eslint/issues/6609)) ([f0f45a9](https://github.com/typescript-eslint/typescript-eslint/commit/f0f45a9d35453c3ec601df770092d236c72d447b)) +* remove partial type-information program ([#6066](https://github.com/typescript-eslint/typescript-eslint/issues/6066)) ([7fc062a](https://github.com/typescript-eslint/typescript-eslint/commit/7fc062abc30a73093cd943c2cb808ae373fe12d9)) +* **scope-manager:** ignore ECMA version ([#5889](https://github.com/typescript-eslint/typescript-eslint/issues/5889)) ([f2330f7](https://github.com/typescript-eslint/typescript-eslint/commit/f2330f79739eb93e3c290ccc6e810a01e097eda0)), closes [#5834](https://github.com/typescript-eslint/typescript-eslint/issues/5834) [#5882](https://github.com/typescript-eslint/typescript-eslint/issues/5882) [#5864](https://github.com/typescript-eslint/typescript-eslint/issues/5864) [#5883](https://github.com/typescript-eslint/typescript-eslint/issues/5883) +* **typescript-estree:** add type checker wrapper APIs to ParserServicesWithTypeInformation ([#6404](https://github.com/typescript-eslint/typescript-eslint/issues/6404)) ([62d5755](https://github.com/typescript-eslint/typescript-eslint/commit/62d57559564fb08512eafe03a2c1b167c4377601)) +* **typescript-estree:** added allowInvalidAST option to not throw on invalid tokens ([#6247](https://github.com/typescript-eslint/typescript-eslint/issues/6247)) ([a3b177d](https://github.com/typescript-eslint/typescript-eslint/commit/a3b177d59adaf8ea76b205befc8b12d86447f1fb)) +* **typescript-estree:** allow providing code as a ts.SourceFile ([#5892](https://github.com/typescript-eslint/typescript-eslint/issues/5892)) ([af41b7f](https://github.com/typescript-eslint/typescript-eslint/commit/af41b7fa7b9b8f3023fdabd40846598d5d4d4f61)) +* **typescript-estree:** deprecate createDefaultProgram ([#5890](https://github.com/typescript-eslint/typescript-eslint/issues/5890)) ([426d6b6](https://github.com/typescript-eslint/typescript-eslint/commit/426d6b647e6df3e312d1cef3e28dadaef6675fd3)) +* **typescript-estree:** warn on deprecated AST property accesses ([#6525](https://github.com/typescript-eslint/typescript-eslint/issues/6525)) ([79c058d](https://github.com/typescript-eslint/typescript-eslint/commit/79c058d69f723ed18a3a7631370009359510d128)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.62.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.61.0...v5.62.0) (2023-07-10) + +**Note:** Version bump only for package website + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.61.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.1...v5.61.0) (2023-07-03) + + +### Features + +* support TypeScript 5.1 ([#7088](https://github.com/typescript-eslint/typescript-eslint/issues/7088)) ([4bf2d73](https://github.com/typescript-eslint/typescript-eslint/commit/4bf2d7360eaf74c9ef87b196ff4c459b8f50800b)) + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +## [5.60.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.60.0...v5.60.1) (2023-06-26) + +**Note:** Version bump only for package website + +You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website. + + + + + +# [5.60.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.11...v5.60.0) (2023-06-19) + +**Note:** Version bump only for package website + + + + + +## [5.59.11](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.10...v5.59.11) (2023-06-12) + +**Note:** Version bump only for package website + + + + + +## [5.59.10](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.9...v5.59.10) (2023-06-12) + +**Note:** Version bump only for package website + + + + + +## [5.59.9](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.8...v5.59.9) (2023-06-05) + +**Note:** Version bump only for package website + + + + + +## [5.59.8](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.7...v5.59.8) (2023-05-29) + +**Note:** Version bump only for package website + + + + + +## [5.59.7](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.6...v5.59.7) (2023-05-22) + +**Note:** Version bump only for package website + + + + + +## [5.59.6](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.5...v5.59.6) (2023-05-15) + +**Note:** Version bump only for package website + + + + + +## [5.59.5](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.4...v5.59.5) (2023-05-08) + +**Note:** Version bump only for package website + + + + + +## [5.59.4](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.3...v5.59.4) (2023-05-08) + +**Note:** Version bump only for package website + + + + + +## [5.59.3](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.2...v5.59.3) (2023-05-08) + +**Note:** Version bump only for package website + + + + + +## [5.59.2](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.1...v5.59.2) (2023-05-01) + +**Note:** Version bump only for package website + + + + + +## [5.59.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.59.0...v5.59.1) (2023-04-24) + +**Note:** Version bump only for package website + + + + + +# [5.59.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.58.0...v5.59.0) (2023-04-17) + +**Note:** Version bump only for package website + + + + + +# [5.58.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.1...v5.58.0) (2023-04-10) + +**Note:** Version bump only for package website + + + + + +## [5.57.1](https://github.com/typescript-eslint/typescript-eslint/compare/v5.57.0...v5.57.1) (2023-04-03) + +**Note:** Version bump only for package website + + + + + +# [5.57.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.56.0...v5.57.0) (2023-03-27) + +**Note:** Version bump only for package website + + + + + # [5.56.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.55.0...v5.56.0) (2023-03-20) **Note:** Version bump only for package website diff --git a/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md b/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md index 47cb9374c90..7e0bb8c43de 100644 --- a/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md +++ b/packages/website/blog/2022-12-05-asts-and-typescript-eslint.md @@ -79,7 +79,7 @@ On the other hand, TypeScript's type checking APIs require nodes in the TypeScri ### Enter TSESTree -To resolve the incompatibilities between ESTrees and the TypeScript AST typescript-eslint provides its own [`@typescript-eslint/parser` package](https://typescript-eslint.io/architecture/Parser.mdx) which: +To resolve the incompatibilities between ESTrees and the TypeScript AST typescript-eslint provides its own [`@typescript-eslint/parser` package](https://typescript-eslint.io/packages/Parser.mdx) which: 1. First parses TypeScript syntax into a TypeScript AST 1. Creates an ESTree AST based on that TypeScript AST diff --git a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md index 9b1c9c39f95..d0b2d1c36b4 100644 --- a/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md +++ b/packages/website/blog/2023-03-13-announcing-typescript-eslint-v6-beta.md @@ -4,12 +4,17 @@ authors: name: Josh Goldberg title: typescript-eslint Maintainer url: https://github.com/JoshuaKGoldberg -description: Describing what an AST (Abstract Syntax Tree) is and why it's useful for ESLint and TypeScript tooling. +description: Announcing the release of typescript-eslint's v6 beta, including its changes and timeline. slug: announcing-typescript-eslint-v6-beta tags: [breaking changes, typescript-eslint, v5, v6] title: Announcing typescript-eslint v6 Beta --- +:::caution Newer Information Available +This blog post is now out of date, as we've released typescript-eslint v6! 🚀 +Please see [Announcing typescript-eslint v6](./2023-07-09-announcing-typescript-eslint-v6.md) for the latest information. +::: + [typescript-eslint](https://typescript-eslint.io) is the tooling that enables standard JavaScript tools such as [ESLint](https://eslint.org) and [Prettier](https://prettier.io) to support TypeScript code. We've been working on a set of breaking changes and general features that we're excited to get in front of users soon. And now, after over two years of development, we're excited to say that typescript-eslint v6 is ready for public beta testing! 🎉 @@ -21,7 +26,9 @@ Our plan for typescript-eslint v6 is to: 3. Release a stable version summer of 2023 Nothing mentioned in this blog post is set in stone. -If you feel passionately about any of the choices we've made here -positively or negatively- then do let us know on [the typescript-eslint Discord's `v6` channel](https://discord.com/channels/1026804805894672454/1084245444676292688)! +If you feel passionately about any of the choices we've made here -positively or negatively- then do let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v6` channel! + + ## Trying Out v6 @@ -43,7 +50,7 @@ If you already use typescript-eslint, you'll need to first replace your package' npm i @typescript-eslint/eslint-plugin@rc-v6 @typescript-eslint/parser@rc-v6 --save-dev ``` -We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations mentioned later in this post](#configuration-breaking-changes) — especially if it's been a while since you've reworked your linter config. +We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations mentioned later in this post](#reworked-configuration-names) — especially if it's been a while since you've reworked your linter config. ## User-Facing Breaking Changes @@ -54,12 +61,12 @@ These are the changes that users of typescript-eslint -generally, any developer ### Reworked Configuration Names -The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](https://typescript-eslint.io/linting/configs). +The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](https://v6--typescript-eslint.netlify.app/linting/configs). typescript-eslint v5 provided three recommended configurations: -- [`recommended`](https://typescript-eslint.io/linting/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. -- [`recommended-requiring-type-checking`](https://typescript-eslint.io/linting/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. -- [`strict`](https://typescript-eslint.io/linting/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. +- [`recommended`](https://v6--typescript-eslint.netlify.app/linting/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. +- [`recommended-requiring-type-checking`](https://v6--typescript-eslint.netlify.app/linting/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. +- [`strict`](https://v6--typescript-eslint.netlify.app/linting/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. Those configurations worked well for most projects. However, some users correctly noted two flaws in that approach: @@ -146,6 +153,11 @@ Miscellaneous changes to all shared configurations include: ### Rule Breaking Changes +:::caution Newer Information Available +This section is now out of date, as we've released typescript-eslint v6! 🚀 +Please see [Announcing typescript-eslint v6 > Rule Breaking Changes](./2023-07-09-announcing-typescript-eslint-v6.md#rule-breaking-changes) for the latest information. +::: + Several rules were changed in significant enough ways to be considered breaking changes: - Previously deprecated rules are deleted ([chore(eslint-plugin): remove deprecated rules for v6](https://github.com/typescript-eslint/typescript-eslint/pull/6112)): @@ -153,16 +165,22 @@ Several rules were changed in significant enough ways to be considered breaking - `@typescript-eslint/no-implicit-any-catch` - `@typescript-eslint/no-parameter-properties` - `@typescript-eslint/sort-type-union-intersection-members` -- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](https://typescript-eslint.io/prefer-nullish-coalescing) rule to also check `||=` expressions. -- ⏳ [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Fixes edge case bugs in the [`@typescript-eslint/prefer-optional-chain`](https://typescript-eslint.io/prefer-optional-chain) rule around false positives, at the cost of making it require type information. +- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](https://v6--typescript-eslint.netlify.app/prefer-nullish-coalescing) rule to also check `||=` expressions. +- [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Rewrites the [`@typescript-eslint/prefer-optional-chain`](https://v6--typescript-eslint.netlify.app/prefer-optional-chain) rule to fix numerous false positives, at the cost of making it require type information. ### Tooling Breaking Changes +:::caution Newer Information Available +This section is now out of date, as we've released typescript-eslint v6! 🚀 +Please see [Announcing typescript-eslint v6 > Tooling Breaking Changes](./2023-07-09-announcing-typescript-eslint-v6.md#tooling-breaking-changes) for the latest information. +::: + - [feat(typescript-estree): deprecate createDefaultProgram](https://github.com/typescript-eslint/typescript-eslint/pull/5890): Renames `createDefaultProgram` to `deprecated__createDefaultProgram`, with associated `@deprecated` TSDoc tags and warnings. - [feat: drop support for node v12](https://github.com/typescript-eslint/typescript-eslint/pull/5918) -- [feat: bump minimum supported TS version to 4.2.4](https://github.com/typescript-eslint/typescript-eslint/pull/5915): this matches [DefinitelyTyped's 2-year support window](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window). +- [feat: drop support for node v14](https://github.com/typescript-eslint/typescript-eslint/pull/7022) +- [feat: bump minimum supported TS version to 4.3.5](https://github.com/typescript-eslint/typescript-eslint/issues/6923): this matches [DefinitelyTyped's 2-year support window](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window). - [chore: drop support for ESLint v6](https://github.com/typescript-eslint/typescript-eslint/pull/5972) -- ⏳ [feat(eslint-plugin): [prefer-readonly-parameter-types] added an optional type allowlist](https://github.com/typescript-eslint/typescript-eslint/4436): changes the public `isTypeReadonlyArrayOrTuple` function's first argument from a `checker: ts.TypeChecker` to a full `program: ts.Program` +- [feat(eslint-plugin): [prefer-readonly-parameter-types] added an optional type allowlist](https://github.com/typescript-eslint/typescript-eslint/pull/4436): changes the public `isTypeReadonlyArrayOrTuple` function's first argument from a `checker: ts.TypeChecker` to a full `program: ts.Program` ## Developer-Facing Changes @@ -171,7 +189,7 @@ If you author any ESLint plugins or other tools that interact with TypeScript sy It includes some breaking changes that you may need to accommodate for. :::tip -If you're having trouble working with the changes, please let us know on [the typescript-eslint Discord's `v6` channel](https://discord.com/channels/1026804805894672454/1084245444676292688)! +If you're having trouble working with the changes, please let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)'s `#v6` channel! ::: ### Type Checker Wrapper APIs @@ -219,12 +237,12 @@ For now, the available wrapper APIs are: We hope these wrapper APIs make it more convenient to write lint rules that rely on the awesome power of TypeScript's type checking. In the future, we may add more wrapper APIs, and may even add internal caching to those APIs to improve performance. -:::note +:::caution Newer Information Available Rules can still retrieve their full backing TypeScript type checker with `services.program.getTypeChecker()`. This can be necessary for TypeScript APIs not wrapped by the parser services. ::: -See [_Custom Rules_ on the v6 docs site preview](https://v6--typescript-eslint.netlify.app/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. +See [_Custom Rules_ on the v6 docs site preview](https://v6--typescript-eslint.netlify.app/developers/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. ### AST Breaking Changes @@ -242,10 +260,11 @@ If you author any ESLint rules that refer to the syntax mentioned by them, these - `TSIndexSignature`, `TSMethodSignature`, and `TSPropertySignatureBase` no longer have an `export` property. - `TSPropertySignatureBase` no longer has an `initializer` property. - [fix(typescript-estree): account for namespace nesting in AST conversion](https://github.com/typescript-eslint/typescript-eslint/pull/6272): Namespaces with qualified names like `Abc.Def` now use a `TSQualifiedName` node, instead of a nested body structure. +- [feat: remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration](https://github.com/typescript-eslint/typescript-eslint/pull/4863): Removes some properties from those AST node types that should generally not have existed to begin with. ### Errors on Invalid AST Parsing -:::note +:::caution Newer Information Available These changes only impact API consumers of typescript-eslint that work at parsing level. If the extent of your API usage is writing custom rules, these changes don't impact you. ::: @@ -273,23 +292,67 @@ For more information, see: - The backing issue: [Parsing: strictly enforce the produced AST matches the spec and enforce most "error recovery" parsing errors](https://github.com/typescript-eslint/typescript-eslint/issues/1852) - The implementing pull request: [feat(typescript-estree): added allowInvalidAST option to throw on invalid tokens](https://github.com/typescript-eslint/typescript-eslint/pull/6247) +### Standalone `RuleTester` package + +Previously we provided a version of ESLint's `RuleTester` class from `@typescript-eslint/utils/eslint-utils`. This version was a sub-class of the original version and was implemented in a very fragile way that made it hard to test, maintain and build new features into. + +This was also reasonably cumbersome for users to access as users had to do deep imports in order to access the class without a namespace. + +In v6 we have extracted this into its own package - `@typescript-eslint/rule-tester`. Additionally instead of being a hacky subclass it's now a complete fork of the original tooling. For the most part you should be able to update your tests as follows: + +```ts +// Remove this line +import { TSESLint } from '@typescript-eslint/utils'; +// Add this line +import { RuleTester } from '@typescript-eslint/rule-tester'; + +import rule from '../src/rules/my-rule'; + +// Remove this line +const ruleTester = new TSESLint.RuleTester({ +// Add this line +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('my-rule', rule, { /* ... */ }); +``` + +Breaking changes: + +- Previously if you set `parserOptions.ecmaFeatures.jsx = true` the rule tester would attempt to look for a fixture named `file.tsx`. Now instead the rule tester will look for a file named `react.tsx`. + - The previous behavior was incorrect because it would encourage you to have both `file.ts` and `file.tsx` and TypeScript would ignore one of those files, causing weird breakages in tests. + - You can control the default filenames by passing `defaultFilenames` to the `RuleTester` constructor. + +New features: + +- `skip: boolean` - the inverse option of `only: boolean`. When `true` we will use your test framework's test skip functionality (`it.skip`) to mark the test as skipped. This is useful during development as it enables you to control which tests run without needing to comment blocks out. +- Dependency version filtering. It's useful to test your rule against multiple versions of your dependencies to ensure it doesn't break on older versions. However in some cases certain tests will not work on older versions of some dependencies due to features that didn't exist until recently - for example a test might use newer syntax that didn't exist in an older version of TypeScript. Our rule tester includes options that allow you to declare the allowed version ranges for a test so that it is automatically skipped when necessary. + +For more information on the package, [see the `rule-tester` package documentation](/packages/rule-tester). + ### Other Developer-Facing Breaking Changes -- [feat: remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration](https://github.com/typescript-eslint/typescript-eslint/pull/4863): Removes some properties from those AST node types that should generally not have existed to begin with. +:::caution Newer Information Available +This section is now out of date, as we've released typescript-eslint v6! 🚀 +Please see [Announcing typescript-eslint v6 > Other Developer-Facing Breaking Changes](./2023-07-09-announcing-typescript-eslint-v6.md#other-developer-facing-breaking-changes) for the latest information. +::: + - [fix(utils): removed TRuleListener generic from the createRule](https://github.com/typescript-eslint/typescript-eslint/pull/5036): Makes `createRule`-created rules more portable in the type system. - [feat(utils): remove (ts-)eslint-scope types](https://github.com/typescript-eslint/typescript-eslint/pull/5256): Removes no-longer-useful `TSESLintScope` types from the `@typescript-eslint/utils` package. Use `@typescript-eslint/scope-manager` directly instead. - [fix: rename typeParameters to typeArguments where needed](https://github.com/typescript-eslint/typescript-eslint/pull/5384): corrects the names of AST properties that were called _parameters_ instead of _arguments_. - To recap the terminology: - An _argument_ is something you provide to a recipient, such as a type provided explicitly to a call expression. - A _parameter_ is how the recipient receives what you provide, such as a function declaration's generic type parameter. - - [Enhancement: Add test-only console warnings to deprecated AST properties](https://github.com/typescript-eslint/typescript-eslint/issues/6469): The properties will include a `console.log` that triggers only in test environments, to encourage developers to move off of them. +- [Enhancement: Add test-only console warnings to deprecated AST properties](https://github.com/typescript-eslint/typescript-eslint/issues/6469): The properties will include a `console.log` that triggers only in test environments, to encourage developers to move off of them. - [feat(scope-manager): ignore ECMA version](https://github.com/typescript-eslint/typescript-eslint/pull/5889): `@typescript-eslint/scope-manager` no longer includes properties referring to `ecmaVersion`, `isES6`, or other ECMA versioning options. It instead now always assumes ESNext. - [feat: remove partial type-information program](https://github.com/typescript-eslint/typescript-eslint/pull/6066): When user configurations don't provide a `parserOptions.project`, parser services will no longer include a `program` with incomplete type information. `program` will be `null` instead. -- [feat: remove experimental-utils](https://github.com/typescript-eslint/typescript-eslint/pull/6468): The `@typescript-eslint/experimental-utils` package has since been renamed to `@typescript-eslint/utils`. - As a result, the `errorOnTypeScriptSyntacticAndSemanticIssues` option will no longer be allowed if `parserOptions.project` is not provided. +- [feat: remove experimental-utils](https://github.com/typescript-eslint/typescript-eslint/pull/6468): The `@typescript-eslint/experimental-utils` package has since been renamed to `@typescript-eslint/utils`. - [feat(typescript-estree): remove optionality from AST boolean properties](https://github.com/typescript-eslint/typescript-eslint/pull/6274): Switches most AST properties marked as `?: boolean` to `: boolean`, as well as some properties marked as `?:` optional to `| undefined`. This results in more predictable AST node object shapes. - [chore(typescript-estree): remove visitor-keys backwards compat export](https://github.com/typescript-eslint/typescript-eslint/pull/6242): `visitorKeys` can now only be imported from `@typescript-eslint/visitor-keys`. Previously it was also re-exported by `@typescript-eslint/utils`. - [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458): `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. +- [feat: fork json schema types for better compat with ESLint rule validation #6963](https://github.com/typescript-eslint/typescript-eslint/pull/6963): `@typescript-eslint/utils` now exports a more strict version of `JSONSchema4` types, which are more strict in type checking rule options types ## Appreciation diff --git a/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md new file mode 100644 index 00000000000..e79664a5874 --- /dev/null +++ b/packages/website/blog/2023-07-09-announcing-typescript-eslint-v6.md @@ -0,0 +1,689 @@ +--- +authors: + - image_url: https://www.joshuakgoldberg.com/img/josh.jpg + name: Josh Goldberg + title: typescript-eslint Maintainer + url: https://github.com/JoshuaKGoldberg +description: Announcing the release of typescript-eslint's stable v6 release, including its changes and timeline. +slug: announcing-typescript-eslint-v6 +tags: [breaking changes, typescript-eslint, v5, v6] +title: Announcing typescript-eslint v6 +--- + +[typescript-eslint](https://typescript-eslint.io) is the tooling that enables standard JavaScript tools such as [ESLint](https://eslint.org) and [Prettier](https://prettier.io) to support TypeScript code. +We've been working on a set of breaking changes and general features that we're excited to get in released! 🎉 + +We'd previously blogged about v6 in [Announcing typescript-eslint v6 Beta](./2023-03-13-announcing-typescript-eslint-v6-beta.md). +This blog post contains much of the same information as that one, but updated for changes made since the beta - including a few breaking changes. + + + +> ✨ indicates a change that was not present in the v6 beta. + +## Using v6 + +Whether you're new to linting your TypeScript code or a returning user, please do upgrade to the latest major version of typescript-eslint! +V6 comes with a suite of quality-of-life improvements we think you'll appreciate. + +### As A New User + +If you don't yet use typescript-eslint, you can go through our [configuration steps on the _Getting Started_ docs](/getting-started). +It'll walk you through setting up typescript-eslint in a project. + +### As An Existing User + +If you already use typescript-eslint, you'll need to first replace your package's previous versions of `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser` with the latest versions: + +```shell +npm i @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest --save-dev +``` + +We highly recommend then basing your ESLint configuration on the reworked typescript-eslint [recommended configurations mentioned later in this post](#reworked-configuration-names) — especially if it's been a while since you've reworked your linter config. + +## User-Facing Breaking Changes + +These are the changes that users of typescript-eslint -generally, any developer running ESLint on TypeScript code- should pay attention to when upgrading typescript-eslint from v5 to v6. + +### Reworked Configuration Names + +The biggest configuration change in typescript-eslint v6 is that we've reworked the names of our [provided user configuration files](https://typescript-eslint.io/linting/configs). +typescript-eslint v5 provided three recommended configurations: + +- [`recommended`](https://typescript-eslint.io/linting/configs#recommended): Recommended rules for code correctness that you can drop in without additional configuration. +- [`recommended-requiring-type-checking`](https://typescript-eslint.io/linting/configs#recommended-requiring-type-checking): Additional recommended rules that require type information. +- [`strict`](https://typescript-eslint.io/linting/configs#strict): Additional strict rules that can also catch bugs but are more opinionated than recommended rules. + +Those configurations worked well for most projects. +However, some users correctly noted two flaws in that approach: + +- Strict rules that didn't require type checking were lumped in with those that did. +- _Stylistic_ best practices were lumped in with rules that actually find bugs. + +As a result, we've reworked the configurations provided by typescript-eslint into these two groups: + +- Functional rule configurations, for best best practices and code correctness: + - **`recommended`**: Recommended rules that you can drop in without additional configuration. + - **`recommended-type-checked`**: Additional recommended rules that require type information. + - **`strict`**: Additional strict rules that can also catch bugs but are more opinionated than recommended rules _(without type information)_. + - **`strict-type-checked`**: Additional strict rules that do require type information. +- Stylistic rule configurations, for consistent and predictable syntax usage: + - **`stylistic`**: Stylistic rules you can drop in without additional configuration. + - **`stylistic-type-checked`**: Additional stylistic rules that require type information. + +> `recommended-requiring-type-checking` is now an alias for `recommended-type-checked`. +> The alias will be removed in a future major version. + +As of v6, we recommend that projects enable two configs from the above: + +- If you are _not_ using typed linting, enable `stylistic` and either `recommended` or `strict`, depending on how intensely you'd like your lint rules to scrutinize your code. +- If you _are_ using typed linting, enable `stylistic-type-checked` and either `recommended-type-checked` or `strict-type-checked`, depending on how intensely you'd like your lint rules to scrutinize your code. + +For example, a typical project that enables typed linting might have an ESLint configuration file that changes like: + +```js title=".eslintrc.cjs" +module.exports = { + extends: [ + 'eslint:recommended', + // Removed lines start + 'plugin:@typescript-eslint/recommended', + 'plugin:@typescript-eslint/recommended-requiring-type-checking', + // Removed lines end + // Added lines start + 'plugin:@typescript-eslint/recommended-type-checked', + 'plugin:@typescript-eslint/stylistic-type-checked', + // Added lines end + ], + plugins: ['@typescript-eslint'], + parser: '@typescript-eslint/parser', + parserOptions: { + // Remove this line + project: './tsconfig.json', + // Add this line + project: true, + tsconfigRootDir: __dirname, + }, + root: true, +}; +``` + +See [our _Configurations_ linting docs](/linting/configs) for the updated documentation on configurations provided by typescript-eslint. + +For more information on these changes, see: + +- [Configs: Have recommended/strict configs include lesser configs, and simplify type checked names](https://github.com/typescript-eslint/typescript-eslint/discussions/6019) for the discussion leading up to these configuration changes. +- [feat(eslint-plugin): rework configs: recommended, strict, stylistic; -type-checked](https://github.com/typescript-eslint/typescript-eslint/pull/5251) for the pull request implementing the changes. + +### Updated Configuration Rules + +Every new major version of typescript-eslint comes with changes to which rules are enabled in the preset configurations - and with which options. +Because this release also includes a reworking of the configurations themselves, the list of changes is too large to put in this blog post. +Instead see the table in [Changes to configurations for 6.0.0](https://github.com/typescript-eslint/typescript-eslint/discussions/6014) and [Configs: Last round of "final" changes to configs for v6](https://github.com/typescript-eslint/typescript-eslint/discussions/7130) for a full description of the changes. + +:::tip +If your ESLint configuration contains many `rules` configurations, we suggest the following strategy to start anew: + +1. Remove all your rules configurations +2. Extend from the preset configs that make sense for you +3. Run ESLint on your project +4. In your ESLint configuration, turn off any rules creating errors that don't make sense for your project - with comments explaining why +5. In your ESLint configuration and/or with inline `eslint-disable` comments, turn off any rules creating too many errors for you to fix - with _"TODO"_ comments linking to tracking issues/tickets to re-enable them + +::: + +Miscellaneous changes to all shared configurations include: + +- [fix(eslint-plugin): remove valid-typeof disable in eslint-recommended](https://github.com/typescript-eslint/typescript-eslint/pull/5381): Removes the disabling of ESLint's `valid-typeof` rule from our preset configs. + + + +
+Diff patch from v5's recommended to v6's recommended and stylistic configs + +```diff +{ + '@typescript-eslint/adjacent-overload-signatures': '...', ++ '@typescript-eslint/array-type': '...', + '@typescript-eslint/ban-ts-comment': '...', ++ '@typescript-eslint/ban-tslint-comment': '...', + '@typescript-eslint/ban-types': '...', ++ '@typescript-eslint/class-literal-property-style': '...', ++ '@typescript-eslint/consistent-generic-constructors': '...', ++ '@typescript-eslint/consistent-indexed-object-style': '...', ++ '@typescript-eslint/consistent-type-assertions': '...', ++ '@typescript-eslint/consistent-type-definitions': '...', + 'no-array-constructor': '...', + '@typescript-eslint/no-array-constructor': '...', ++ '@typescript-eslint/no-confusing-non-null-assertion': '...', ++ '@typescript-eslint/no-duplicate-enum-values': '...', + 'no-empty-function': '...', + '@typescript-eslint/no-empty-function': '...', + '@typescript-eslint/no-empty-interface': '...', + '@typescript-eslint/no-explicit-any': '...', + '@typescript-eslint/no-extra-non-null-assertion': '...', +- 'no-extra-semi': '...', +- '@typescript-eslint/no-extra-semi': '...', + '@typescript-eslint/no-inferrable-types': '...', + 'no-loss-of-precision': '...', + '@typescript-eslint/no-loss-of-precision': '...', + '@typescript-eslint/no-misused-new': '...', + '@typescript-eslint/no-namespace': '...', + '@typescript-eslint/no-non-null-asserted-optional-chain': '...', +- '@typescript-eslint/no-non-null-assertion': '...', + '@typescript-eslint/no-this-alias': '...', + '@typescript-eslint/no-unnecessary-type-constraint': '...', ++ '@typescript-eslint/no-unsafe-declaration-merging': '...', + 'no-unused-vars': '...', + '@typescript-eslint/no-unused-vars': '...', + '@typescript-eslint/no-var-requires': '...', + '@typescript-eslint/prefer-as-const': '...', ++ '@typescript-eslint/prefer-for-of': '...', ++ '@typescript-eslint/prefer-function-type': '...', + '@typescript-eslint/prefer-namespace-keyword': '...', + '@typescript-eslint/triple-slash-reference': '...', +} +``` + +
+ +
+Diff patch from v5's recommended and recommended-type-checked to v6's recommended-type-checked and stylistic-type-checked configs + +```diff +{ + '@typescript-eslint/adjacent-overload-signatures': '...', ++ '@typescript-eslint/array-type': '...', + '@typescript-eslint/await-thenable': '...', + '@typescript-eslint/ban-ts-comment': '...', ++ '@typescript-eslint/ban-tslint-comment': '...', + '@typescript-eslint/ban-types': '...', ++ '@typescript-eslint/class-literal-property-style': '...', ++ '@typescript-eslint/consistent-generic-constructors': '...', ++ '@typescript-eslint/consistent-indexed-object-style': '...', ++ '@typescript-eslint/consistent-type-assertions': '...', ++ '@typescript-eslint/consistent-type-definitions': '...', ++ 'dot-notation': '...', ++ '@typescript-eslint/dot-notation': '...', + 'no-array-constructor': '...', + '@typescript-eslint/no-array-constructor': '...', ++ '@typescript-eslint/no-base-to-string': '...', ++ '@typescript-eslint/no-confusing-non-null-assertion': '...', ++ '@typescript-eslint/no-duplicate-enum-values': '...', ++ '@typescript-eslint/no-duplicate-type-constituents': '...', + 'no-empty-function': '...', + '@typescript-eslint/no-empty-function': '...', + '@typescript-eslint/no-empty-interface': '...', + '@typescript-eslint/no-explicit-any': '...', + '@typescript-eslint/no-extra-non-null-assertion': '...', +- 'no-extra-semi': '...', +- '@typescript-eslint/no-extra-semi': '...', + '@typescript-eslint/no-floating-promises': '...', + '@typescript-eslint/no-for-in-array': '...', + 'no-implied-eval': '...', + '@typescript-eslint/no-implied-eval': '...', + '@typescript-eslint/no-inferrable-types': '...', + 'no-loss-of-precision': '...', + '@typescript-eslint/no-loss-of-precision': '...', + '@typescript-eslint/no-misused-new': '...', + '@typescript-eslint/no-misused-promises': '...', + '@typescript-eslint/no-namespace': '...', + '@typescript-eslint/no-non-null-asserted-optional-chain': '...', +- '@typescript-eslint/no-non-null-assertion': '...', ++ '@typescript-eslint/no-redundant-type-constituents': '...', + '@typescript-eslint/no-this-alias': '...', + '@typescript-eslint/no-unnecessary-type-assertion': '...', + '@typescript-eslint/no-unnecessary-type-constraint': '...', + '@typescript-eslint/no-unsafe-argument': '...', + '@typescript-eslint/no-unsafe-assignment': '...', + '@typescript-eslint/no-unsafe-call': '...', ++ '@typescript-eslint/no-unsafe-declaration-merging': '...', ++ '@typescript-eslint/no-unsafe-enum-comparison': '...', + '@typescript-eslint/no-unsafe-member-access': '...', + '@typescript-eslint/no-unsafe-return': '...', + 'no-unused-vars': '...', + '@typescript-eslint/no-unused-vars': '...', + '@typescript-eslint/no-var-requires': '...', ++ '@typescript-eslint/non-nullable-type-assertion-style': '...', + '@typescript-eslint/prefer-as-const': '...', ++ '@typescript-eslint/prefer-for-of': '...', ++ '@typescript-eslint/prefer-function-type': '...', + '@typescript-eslint/prefer-namespace-keyword': '...', ++ '@typescript-eslint/prefer-nullish-coalescing': '...', ++ '@typescript-eslint/prefer-optional-chain': '...', ++ '@typescript-eslint/prefer-string-starts-ends-with': '...', + 'require-await': '...', + '@typescript-eslint/require-await': '...', + '@typescript-eslint/restrict-plus-operands': '...', + '@typescript-eslint/restrict-template-expressions': '...', + '@typescript-eslint/triple-slash-reference': '...', + '@typescript-eslint/unbound-method': '...', +} +``` + +
+ +
+Code that generated those diffs + +```js +const v5Recommended = { + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/ban-types': 'error', + 'no-array-constructor': 'off', + '@typescript-eslint/no-array-constructor': 'error', + 'no-empty-function': 'off', + '@typescript-eslint/no-empty-function': 'error', + '@typescript-eslint/no-empty-interface': 'error', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-extra-non-null-assertion': 'error', + 'no-extra-semi': 'off', + '@typescript-eslint/no-extra-semi': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + 'no-loss-of-precision': 'off', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + '@typescript-eslint/no-non-null-assertion': 'warn', + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/no-var-requires': 'error', + '@typescript-eslint/prefer-as-const': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', + '@typescript-eslint/triple-slash-reference': 'error', +}; + +const v5RecommendedRequiringTypeChecking = { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/unbound-method': 'error', +}; + +const v6Recommended = { + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/ban-types': 'error', + 'no-array-constructor': 'off', + '@typescript-eslint/no-array-constructor': 'error', + '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-extra-non-null-assertion': 'error', + 'no-loss-of-precision': 'off', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/no-var-requires': 'error', + '@typescript-eslint/prefer-as-const': 'error', + '@typescript-eslint/triple-slash-reference': 'error', +}; + +const v6RecommendedTypeChecked = { + '@typescript-eslint/await-thenable': 'error', + '@typescript-eslint/ban-ts-comment': 'error', + '@typescript-eslint/ban-types': 'error', + 'no-array-constructor': 'off', + '@typescript-eslint/no-array-constructor': 'error', + '@typescript-eslint/no-base-to-string': 'error', + '@typescript-eslint/no-duplicate-enum-values': 'error', + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-extra-non-null-assertion': 'error', + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-for-in-array': 'error', + 'no-implied-eval': 'off', + '@typescript-eslint/no-implied-eval': 'error', + 'no-loss-of-precision': 'off', + '@typescript-eslint/no-loss-of-precision': 'error', + '@typescript-eslint/no-misused-new': 'error', + '@typescript-eslint/no-misused-promises': 'error', + '@typescript-eslint/no-namespace': 'error', + '@typescript-eslint/no-non-null-asserted-optional-chain': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + '@typescript-eslint/no-this-alias': 'error', + '@typescript-eslint/no-unnecessary-type-assertion': 'error', + '@typescript-eslint/no-unnecessary-type-constraint': 'error', + '@typescript-eslint/no-unsafe-argument': 'error', + '@typescript-eslint/no-unsafe-assignment': 'error', + '@typescript-eslint/no-unsafe-call': 'error', + '@typescript-eslint/no-unsafe-declaration-merging': 'error', + '@typescript-eslint/no-unsafe-enum-comparison': 'error', + '@typescript-eslint/no-unsafe-member-access': 'error', + '@typescript-eslint/no-unsafe-return': 'error', + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': 'error', + '@typescript-eslint/no-var-requires': 'error', + '@typescript-eslint/prefer-as-const': 'error', + 'require-await': 'off', + '@typescript-eslint/require-await': 'error', + '@typescript-eslint/restrict-plus-operands': 'error', + '@typescript-eslint/restrict-template-expressions': 'error', + '@typescript-eslint/triple-slash-reference': 'error', + '@typescript-eslint/unbound-method': 'error', +}; + +const v6Stylistic = { + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/array-type': 'error', + '@typescript-eslint/ban-tslint-comment': 'error', + '@typescript-eslint/class-literal-property-style': 'error', + '@typescript-eslint/consistent-generic-constructors': 'error', + '@typescript-eslint/consistent-indexed-object-style': 'error', + '@typescript-eslint/consistent-type-assertions': 'error', + '@typescript-eslint/consistent-type-definitions': 'error', + '@typescript-eslint/no-confusing-non-null-assertion': 'error', + 'no-empty-function': 'off', + '@typescript-eslint/no-empty-function': 'error', + '@typescript-eslint/no-empty-interface': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-function-type': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', +}; + +const v6StylisticTypeChecked = { + '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/array-type': 'error', + '@typescript-eslint/ban-tslint-comment': 'error', + '@typescript-eslint/class-literal-property-style': 'error', + '@typescript-eslint/consistent-generic-constructors': 'error', + '@typescript-eslint/consistent-indexed-object-style': 'error', + '@typescript-eslint/consistent-type-assertions': 'error', + '@typescript-eslint/consistent-type-definitions': 'error', + 'dot-notation': 'off', + '@typescript-eslint/dot-notation': 'error', + '@typescript-eslint/no-confusing-non-null-assertion': 'error', + 'no-empty-function': 'off', + '@typescript-eslint/no-empty-function': 'error', + '@typescript-eslint/no-empty-interface': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + '@typescript-eslint/non-nullable-type-assertion-style': 'error', + '@typescript-eslint/prefer-for-of': 'error', + '@typescript-eslint/prefer-function-type': 'error', + '@typescript-eslint/prefer-namespace-keyword': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-optional-chain': 'error', + '@typescript-eslint/prefer-string-starts-ends-with': 'error', +}; + +function createDiffPatch(v5, v6) { + const v5Keys = new Set(Object.keys(v5)); + const v6Keys = new Set(Object.keys(v6)); + const output = ['{']; + + for (const key of Array.from(new Set([...v5Keys, ...v6Keys])).sort((a, b) => + trimSlash(a).localeCompare(trimSlash(b)), + )) { + const prefix = v5Keys.has(key) ? (v6Keys.has(key) ? ' ' : '-') : '+'; + + output.push(`${prefix} '${key}': '...',`); + } + + output.push('}'); + + return output.join('\n'); +} + +function trimSlash(text) { + return text.startsWith('@typescript-eslint/') + ? text.slice('@typescript-eslint/'.length) + : text; +} + +console.log('From v5 recommended to v6 recommended & stylistic:'); + +console.log( + createDiffPatch(v5Recommended, { ...v6Recommended, ...v6Stylistic }), +); + +console.log( + '\nFrom v5 recommended & recommended-requiring-type-checking to v6 recommended-type-checked & stylistic-type-checked:', +); + +console.log( + createDiffPatch( + { + ...v5Recommended, + ...v5RecommendedRequiringTypeChecking, + }, + { ...v6RecommendedTypeChecked, ...v6StylisticTypeChecked }, + ), +); +``` + +
+ + + +### Rule Breaking Changes + +Several rules were changed in significant enough ways to be considered breaking changes: + +- Previously deprecated rules are deleted ([chore(eslint-plugin): remove deprecated rules for v6](https://github.com/typescript-eslint/typescript-eslint/pull/6112)): + - `@typescript-eslint/no-duplicate-imports` + - `@typescript-eslint/no-implicit-any-catch` + - `@typescript-eslint/no-parameter-properties` + - `@typescript-eslint/sort-type-union-intersection-members` +- [feat(eslint-plugin): [prefer-nullish-coalescing]: add support for assignment expressions](https://github.com/typescript-eslint/typescript-eslint/pull/5234): Enhances the [`@typescript-eslint/prefer-nullish-coalescing`](https://typescript-eslint.io/prefer-nullish-coalescing) rule to also check `||=` expressions. +- [feat(eslint-plugin): [prefer-optional-chain] use type checking for strict falsiness](https://github.com/typescript-eslint/typescript-eslint/pull/6240): Fixes edge case bugs in the [`@typescript-eslint/prefer-optional-chain`](https://typescript-eslint.io/prefer-optional-chain) rule around false positives, at the cost of making it require type information. +- ✨ [feat(eslint-plugin): [restrict-plus-operands] change checkCompoundAssignments to skipCompoundAssignments](https://github.com/typescript-eslint/typescript-eslint/pull/7027): inverses the logical value of the option and renames it +- ✨ [feat(eslint-plugin): [prefer-optional-chain] handle cases where the first operands are unrelated to the rest of the chain and add type info](https://github.com/typescript-eslint/typescript-eslint/pull/6397): uses type information to make the rule more intelligent about when to flag violations + +### Tooling Breaking Changes + +- [feat(typescript-estree): deprecate createDefaultProgram](https://github.com/typescript-eslint/typescript-eslint/pull/5890): Renames `createDefaultProgram` to `deprecated__createDefaultProgram`, with associated `@deprecated` TSDoc tags and warnings. +- Drop support for Node v12 and v14 + - [feat: drop support for node v12](https://github.com/typescript-eslint/typescript-eslint/pull/5918) + - ✨ [feat: drop support for node v14 and test against node v20](https://github.com/typescript-eslint/typescript-eslint/pull/7022): as Node 14 is now EOL +- [feat: bump minimum supported TS version to 4.2.4](https://github.com/typescript-eslint/typescript-eslint/pull/5915): this matches [DefinitelyTyped's 2-year support window](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window). +- [chore: drop support for ESLint v6](https://github.com/typescript-eslint/typescript-eslint/pull/5972) +- [feat(eslint-plugin): [prefer-readonly-parameter-types] added an optional type allowlist](https://github.com/typescript-eslint/typescript-eslint/pull/4436): changes the public `isTypeReadonlyArrayOrTuple` function's first argument from a `checker: ts.TypeChecker` to a full `program: ts.Program` +- ✨ [feat: add new package `rule-tester`](https://github.com/typescript-eslint/typescript-eslint/pull/6777): creates a new `@typescript-eslint/rule-tester` package for testing rules, and updates our documentation to recommend it + +## Developer-Facing Changes + +typescript-eslint v6 comes with a suite of cleanups and improvements for developers as well. +If you author any ESLint plugins or other tools that interact with TypeScript syntax, then we recommend you try out typescript-eslint v6 soon. +It includes some breaking changes that you may need to accommodate for. + +:::tip +If you're having trouble with the changes, please let us know on [the typescript-eslint Discord](https://discord.gg/FSxKq8Tdyg)! +::: + +### Type Checker Wrapper APIs + +As described in our [ASTs and typescript-eslint](/blog/asts-and-typescript-eslint) post, ESLint rules don't natively work with AST nodes compatible with TypeScript's API. +Retrieving type information for an ESLint AST node in a custom rule requires code somewhat like: + +```ts title="custom-rule-with-v5.ts" +{ + // ... + create() { + const services = util.getParserServices(context); + const checker = services.program.getTypeChecker(); + const tsNode = services.esTreeNodeToTSNodeMap.get(esNode); + const type = checker.getTypeAtLocation(node); + + // ... + } + // ... +} +``` + +How cumbersome, just to call to a single method (`getTypeAtLocation`) on the TypeScript API! + +In typescript-eslint v6, we've added a set of wrapper APIs on the `services: ParserServices` object that act as shortcuts for commonly used TypeScript APIs including `getTypeAtLocation`: + +```ts title="custom-rule-with-v6.ts" +{ + // ... + create() { + const services = util.getParserServices(context); + const type = services.getTypeAtLocation(node); + + // ... + } + // ... +} +``` + +For now, the available wrapper APIs are: + +- `getSymbolAtLocation`: passes an ESTree's equivalent TypeScript node to `checker.getSymbolAtLocation` +- `getTypeAtLocation`: passes an ESTree node's equivalent TypeScript node to `checker.getTypeAtLocation` + +We hope these wrapper APIs make it more convenient to write lint rules that rely on the awesome power of TypeScript's type checking. +In the future, we may add more wrapper APIs, and may even add internal caching to those APIs to improve performance. + +:::note +Rules can still retrieve their full backing TypeScript type checker with `services.program.getTypeChecker()`. +This can be necessary for TypeScript APIs not wrapped by the parser services. +::: + +See [_Custom Rules_](https://typescript-eslint.io/developers/custom-rules) for the updated documentation on creating custom rules with typescript-eslint. + +### AST Breaking Changes + +These PRs changed the AST shapes generated by typescript-eslint when parsing code. +If you author any ESLint rules that refer to the syntax mentioned by them, these are relevant to you. + +- [feat: remove semantically invalid properties from TSEnumDeclaration, TSInterfaceDeclaration and TSModuleDeclaration](https://github.com/typescript-eslint/typescript-eslint/pull/4863): Removes some properties from those AST node types that should generally not have existed to begin with. +- [fix(utils): removed TRuleListener generic from the createRule](https://github.com/typescript-eslint/typescript-eslint/pull/5036): Makes `createRule`-created rules more portable in the type system. +- [feat: made BaseNode.parent non-optional](https://github.com/typescript-eslint/typescript-eslint/pull/5252): makes the `node.parent` property on AST nodes non-optional (`TSESTree.Node` instead of `TSESTree.Node | undefined`). +- [fix: rename typeParameters to typeArguments where needed](https://github.com/typescript-eslint/typescript-eslint/pull/5384): corrects the names of AST properties that were called _parameters_ instead of _arguments_. + - To recap the terminology: + - An _argument_ is something you provide to a recipient, such as a type provided explicitly to a call expression. + - A _parameter_ is how the recipient receives what you provide, such as a function declaration's generic type parameter. +- [fix(ast-spec): correct some incorrect ast types](https://github.com/typescript-eslint/typescript-eslint/pull/6257): applies the following changes to correct erroneous types of AST node properties: + - `ArrayExpressions`'s `elements` property can now include `null` (i.e. is now `(Expression | SpreadElement | null)[]`), for the case of sparse arrays (e.g. `[1, , 3]`). + - `MemberExpression`'s `object` property is now `Expression`, not `LeftHandSideExpression`. + - `ObjectLiteralElement` no longer allows for `MethodDefinition`. +- [fix(typescript-estree): wrap import = declaration in an export node](https://github.com/typescript-eslint/typescript-eslint/pull/5885): Exported `TSImportEqualsDeclaration` nodes are now wrapped in an `ExportNamedDeclaration` node instead of having `.isExport = true` property. +- [fix(ast-spec): remove more invalid properties](https://github.com/typescript-eslint/typescript-eslint/pull/6243): applies the following changes to remove invalid properties from AST nodes: + - `MethodDefinitionBase` no longer has a `typeParameters` property. + - `TSIndexSignature`, `TSMethodSignature`, and `TSPropertySignatureBase` no longer have an `export` property. + - `TSPropertySignatureBase` no longer has an `initializer` property. +- [fix(typescript-estree): account for namespace nesting in AST conversion](https://github.com/typescript-eslint/typescript-eslint/pull/6272): Namespaces with qualified names like `Abc.Def` now use a `TSQualifiedName` node, instead of a nested body structure. +- [feat(typescript-estree): remove optionality from AST boolean properties](https://github.com/typescript-eslint/typescript-eslint/pull/6274): Switches most AST properties marked as `?: boolean` to `: boolean`, as well as some properties marked as `?:` optional to `| undefined`. This results in more predictable AST node object shapes. + +### Errors on Invalid AST Parsing + +:::note +These changes only impact API consumers of typescript-eslint that work at parsing level. +If the extent of your API usage is writing custom rules, these changes don't impact you. +::: + +The `@typescript-eslint/typescript-estree` parser is by default very forgiving of invalid ASTs. +If it encounters invalid syntax, it will still attempt create an AST if possible: even if required properties of nodes don't exist. + +For example, this snippet of TypeScript code creates a `ClassDeclaration` whose `id` is `null`: + +```ts +export class {} +``` + +Invalid parsed ASTs can cause problems for downstream tools expecting AST nodes to adhere to the ESTree spec. +ESLint rules in particular tend to crash when given invalid ASTs. + +`@typescript-eslint/typescript-estree` will now throw an error when it encounters a known invalid AST such as the `export class {}` example. +This is generally the correct behavior for most parsing contexts so downstream tools don't have to work with a potentially invalid AST. + +For consumers that don't want the updated behavior of throwing on invalid ASTs, a new `allowInvalidAST` option exists to disable the throwing behavior. +Keep in mind that with it enabled, ASTs produced by typescript-eslint might not match their TSESTree type definitions. + +For more information, see: + +- The backing issue: [Parsing: strictly enforce the produced AST matches the spec and enforce most "error recovery" parsing errors](https://github.com/typescript-eslint/typescript-eslint/issues/1852) +- The implementing pull request: [feat(typescript-estree): added allowInvalidAST option to throw on invalid tokens](https://github.com/typescript-eslint/typescript-eslint/pull/6247) +- ✨ [fix: fix illegal decorator check](https://github.com/typescript-eslint/typescript-eslint/pull/6723): improves how invalid decorator syntax is parsed and reported on + +### Package Exports + +The v5 `@typescript-eslint/` packages don't use [Node.js package.json exports](https://nodejs.org/api/packages.html#package-entry-points), so anyone can import any file in any package by directly referencing a path within the dist folder. +For example: + +```ts +import * as TSESLint from '@typescript-eslint/utils/dist/ts-eslint'; +``` + +That presents a few issues for developers: + +- It can be unclear which of many potential import paths to use +- TypeScript sometimes suggests importing types or values meant to be private +- Consumers using deep import paths can be broken by internal refactors that rename files + +As of [feat: add package.json exports for public packages](https://github.com/typescript-eslint/typescript-eslint/pull/6458), `@typescript-eslint/*` packages now use `exports` to prevent importing internal file paths. +Developers must now mostly import directly from the package names, e.g.: + +```ts +import * as TSESLint from '@typescript-eslint/ts-eslint'; +``` + +See [RFC: Use package.json exports to "hide" the dist folder for packages and control our exported surface-area](https://github.com/typescript-eslint/typescript-eslint/discussions/6015) for more backing context. + +### Other Developer-Facing Breaking Changes + +- [feat(utils): remove (ts-)eslint-scope types](https://github.com/typescript-eslint/typescript-eslint/pull/5256): Removes no-longer-useful `TSESLintScope` types from the `@typescript-eslint/utils` package. Use `@typescript-eslint/scope-manager` directly instead. +- [Enhancement: Add test-only console warnings to deprecated AST properties](https://github.com/typescript-eslint/typescript-eslint/issues/6469): The properties will include a `console.log` that triggers only in test environments, to encourage developers to move off of them. +- [feat(scope-manager): ignore ECMA version](https://github.com/typescript-eslint/typescript-eslint/pull/5889): `@typescript-eslint/scope-manager` no longer includes properties referring to `ecmaVersion`, `isES6`, or other ECMA versioning options. It instead now always assumes ESNext. +- [feat: remove partial type-information program](https://github.com/typescript-eslint/typescript-eslint/pull/6066): When user configurations don't provide a `parserOptions.project`, parser services will no longer include a `program` with incomplete type information. `program` will be `null` instead. +- [feat: remove experimental-utils](https://github.com/typescript-eslint/typescript-eslint/pull/6468): The `@typescript-eslint/experimental-utils` package has since been renamed to `@typescript-eslint/utils`. + - As a result, the `errorOnTypeScriptSyntacticAndSemanticIssues` option will no longer be allowed if `parserOptions.project` is not provided. +- [chore(typescript-estree): remove visitor-keys backwards compat export](https://github.com/typescript-eslint/typescript-eslint/pull/6242): `visitorKeys` can now only be imported from `@typescript-eslint/visitor-keys`. Previously it was also re-exported by `@typescript-eslint/utils`. +- ✨ [feat: fork json schema types for better compat with ESLint rule validation](https://github.com/typescript-eslint/typescript-eslint/pull/6963): clarifies the JSON schema types exported for rule options to match ESLint's and remove an unsafe `[string: any]` index +- ✨ [feat(typescript-estree): remove parseWithNodeMaps](https://github.com/typescript-eslint/typescript-eslint/pull/7120): removed a `parseWithNodeMaps` API previously intended only for Prettier that is no longer used by Prettier +- ✨ [Consider keeping parserServices.hasFullTypeInformation for another major version?](https://github.com/typescript-eslint/typescript-eslint/issues/7124): we're removing an old, undocumented `hasFullTypeInformation` property from `parserServices`. + +## Appreciation + +We'd like to extend a sincere _thank you_ to everybody who pitched in to make typescript-eslint v6 possible. + +- Ourselves on the maintenance team: + - [Armano](https://github.com/armano2) + - [Brad Zacher](https://github.com/bradzacher) + - [James Henry](https://github.com/JamesHenry) + - [Josh Goldberg](https://github.com/JoshuaKGoldberg) + - [Joshua Chen](https://github.com/Josh-Cena) +- Community contributors whose PRs were merged into the 6.0.0 release: + + - [Bryan Mishkin](https://github.com/bmish) + - [fisker Cheung](https://github.com/fisker) + - [Juan García](https://github.com/juank1809) + - [Kevin Ball](https://github.com/kball) + - [Marek Dědič](https://github.com/marekdedic) + - [Mateusz Burzyński](https://github.com/Andarist) + +- Community projects that worked with us to try out the reworked preset configs: + - [Astro](https://github.com/withastro/astro/pull/7425) + - [Babel](https://github.com/babel/babel/pull/15716) + - [create-t3-app](https://github.com/t3-oss/create-t3-app/pull/1476) + - [trpc](https://github.com/trpc/trpc/pull/4541) + - [TypeScript](https://github.com/microsoft/TypeScript/pull/54693) + +See the [v6.0.0 milestone](https://github.com/typescript-eslint/typescript-eslint/milestone/8) for the list of issues and associated merged pull requests. + +## Supporting typescript-eslint + +If you enjoyed this blog post and/or or use typescript-eslint, please consider [supporting us on Open Collective](https://opencollective.com/typescript-eslint). +We're a small volunteer team and could use your support to make the ESLint experience on TypeScript great. +Thanks! 💖 diff --git a/packages/website/data/sponsors.json b/packages/website/data/sponsors.json index cf5059d7ea3..03ab7f5b766 100644 --- a/packages/website/data/sponsors.json +++ b/packages/website/data/sponsors.json @@ -3,37 +3,44 @@ "id": "Indeed", "image": "https://images.opencollective.com/indeed/4b8725e/logo.png", "name": "Indeed", - "totalDonations": 1005000, + "totalDonations": 2005000, "website": "https://Indeed.com" }, { "id": "Nx (by Nrwl)", "image": "https://images.opencollective.com/nx/0efbe42/logo.png", "name": "Nx (by Nrwl)", - "totalDonations": 650000, + "totalDonations": 750000, "website": "https://nx.dev" }, { "id": "ESLint", "image": "https://images.opencollective.com/eslint/96b09dc/logo.png", "name": "ESLint", - "totalDonations": 275000, + "totalDonations": 335000, "website": "https://eslint.org/" }, { "id": "Hugging Face", "image": "https://images.opencollective.com/huggingface/5c934ee/logo.png", "name": "Hugging Face", - "totalDonations": 220000, + "totalDonations": 300000, "website": "https://huggingface.co" }, { "id": "Airbnb", "image": "https://images.opencollective.com/airbnb/d327d66/logo.png", "name": "Airbnb", - "totalDonations": 160800, + "totalDonations": 180800, "website": "https://www.airbnb.com/" }, + { + "id": "Codecademy", + "image": "https://images.opencollective.com/codecademy/d56a48d/logo.png", + "name": "Codecademy", + "totalDonations": 180000, + "website": "https://codecademy.com" + }, { "id": "GitBook", "image": "https://images.opencollective.com/gitbook/d35a8e7/logo.png", @@ -42,11 +49,11 @@ "website": "https://www.gitbook.com" }, { - "id": "Codecademy", - "image": "https://images.opencollective.com/codecademy/d56a48d/logo.png", - "name": "Codecademy", - "totalDonations": 140000, - "website": "https://codecademy.com" + "id": "Sourcegraph", + "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png", + "name": "Sourcegraph", + "totalDonations": 130000, + "website": "https://about.sourcegraph.com" }, { "id": "n8n.io - n8n GmbH", @@ -69,13 +76,6 @@ "totalDonations": 114800, "website": "https://sentry.io/welcome/" }, - { - "id": "Sourcegraph", - "image": "https://images.opencollective.com/sourcegraph/67e40ff/logo.png", - "name": "Sourcegraph", - "totalDonations": 90000, - "website": "https://about.sourcegraph.com" - }, { "id": "EY Doberman", "image": "https://images.opencollective.com/ey-doberman/b269462/logo.png", @@ -90,6 +90,13 @@ "totalDonations": 70000, "website": "https://www.codiga.io" }, + { + "id": "DeepSource", + "image": "https://images.opencollective.com/deepsource/0f18cea/logo.png", + "name": "DeepSource", + "totalDonations": 60000, + "website": "https://deepsource.io/" + }, { "id": "Future Processing", "image": "https://images.opencollective.com/future-processing/1410d26/logo.png", @@ -97,6 +104,13 @@ "totalDonations": 54000, "website": "https://www.future-processing.com/" }, + { + "id": "STORIS", + "image": "https://images.opencollective.com/storis/dfb0e13/logo.png", + "name": "STORIS", + "totalDonations": 41000, + "website": "https://www.storis.com/" + }, { "id": "Whitebox", "image": "https://images.opencollective.com/whiteboxinc/ef0d11d/logo.png", @@ -104,20 +118,6 @@ "totalDonations": 40000, "website": "https://whitebox.com" }, - { - "id": "DeepSource", - "image": "https://images.opencollective.com/deepsource/0f18cea/logo.png", - "name": "DeepSource", - "totalDonations": 40000, - "website": "https://deepsource.io/" - }, - { - "id": "STORIS", - "image": "https://images.opencollective.com/storis/dfb0e13/logo.png", - "name": "STORIS", - "totalDonations": 33000, - "website": "https://www.storis.com/" - }, { "id": "Monito", "image": "https://images.opencollective.com/monito/50fc878/logo.png", @@ -146,6 +146,13 @@ "totalDonations": 22000, "website": "https://twitter.com/nevir" }, + { + "id": "David Johnston", + "image": "https://images.opencollective.com/blacksheepcode/976d69a/avatar.png", + "name": "David Johnston", + "totalDonations": 19000, + "website": "https://blacksheepcode.com" + }, { "id": "kartenmacherei", "image": "https://images.opencollective.com/kartenmacherei/21bfcfb/logo.png", @@ -153,13 +160,6 @@ "totalDonations": 18000, "website": "https://celebrate.company" }, - { - "id": "David Johnston", - "image": "https://images.opencollective.com/blacksheepcode/976d69a/avatar.png", - "name": "David Johnston", - "totalDonations": 17000, - "website": "https://blacksheepcode.com" - }, { "id": "THANKS.DEV", "image": "https://images.opencollective.com/thanks-dev/ed78b39/logo.png", @@ -167,6 +167,13 @@ "totalDonations": 14761, "website": "https://thanks.dev" }, + { + "id": "Now4real", + "image": "https://images.opencollective.com/now4real/54ca7d9/logo.png", + "name": "Now4real", + "totalDonations": 14500, + "website": "https://now4real.com/" + }, { "id": "Joe Alden", "image": "https://images.opencollective.com/joealden/44a6738/avatar.png", @@ -178,16 +185,30 @@ "id": "Evil Martians", "image": "https://images.opencollective.com/evilmartians/707ab4d/logo.png", "name": "Evil Martians", - "totalDonations": 12000, + "totalDonations": 14000, "website": "https://evilmartians.com/" }, { "id": "Balsa", "image": "https://images.opencollective.com/balsa/77de498/logo.png", "name": "Balsa", - "totalDonations": 12000, + "totalDonations": 13500, "website": "https://balsa.com" }, + { + "id": "THE PADDING", + "image": "https://images.opencollective.com/thepadding/55e79ad/logo.png", + "name": "THE PADDING", + "totalDonations": 13000, + "website": "https://paddn.com/" + }, + { + "id": "Corellium", + "image": "https://images.opencollective.com/corellium/aa8c228/logo.png", + "name": "Corellium", + "totalDonations": 12000, + "website": "https://www.corellium.com" + }, { "id": "Gianfranco Palumbo", "image": "https://images.opencollective.com/gianpaj/5d62d25/avatar.png", diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js index e2d6411e793..8e277f6f1c6 100644 --- a/packages/website/docusaurus.config.js +++ b/packages/website/docusaurus.config.js @@ -3,7 +3,6 @@ require('ts-node').register({ scope: true, scopeDir: __dirname, - swc: true, transpileOnly: true, }); diff --git a/packages/website/docusaurusConfig.ts b/packages/website/docusaurusConfig.ts index ad1900d8c17..e92be50f6ac 100644 --- a/packages/website/docusaurusConfig.ts +++ b/packages/website/docusaurusConfig.ts @@ -53,7 +53,7 @@ const pluginContentDocsOptions: PluginContentDocsOptions = { breadcrumbs: false, }; -const themeConfig: ThemeCommonConfig & AlgoliaThemeConfig = { +const themeConfig: AlgoliaThemeConfig & ThemeCommonConfig = { algolia: { appId: 'N1HUB2TU6A', apiKey: '74d42ed10d0f7b327d74d774570035c7', diff --git a/packages/website/package.json b/packages/website/package.json index d40909e8237..6b063a25612 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,62 +1,71 @@ { "name": "website", - "version": "5.56.0", + "version": "6.0.0", "private": true, "scripts": { "build": "docusaurus build", "clear": "docusaurus clear", "format": "prettier --write \"./**/*.{md,mdx,ts,js,tsx,jsx}\" --ignore-path ../../.prettierignore", + "generate-website-dts": "tsx ./tools/generate-website-dts.ts", + "stylelint": "stylelint \"src/**/*.css\"", + "stylelint:fix": "stylelint \"src/**/*.css\" --fix", "lint": "nx lint", "serve": "docusaurus serve", "start": "docusaurus start", "swizzle": "docusaurus swizzle", "test": "playwright test", - "typecheck": "tsc" + "typecheck": "tsc -b ./tsconfig.json" }, "dependencies": { - "@babel/runtime": "^7.18.3", - "@docusaurus/core": "~2.2.0", - "@docusaurus/plugin-pwa": "~2.2.0", - "@docusaurus/preset-classic": "~2.2.0", - "@docusaurus/remark-plugin-npm2yarn": "~2.2.0", - "@docusaurus/theme-common": "~2.2.0", + "@babel/runtime": "^7.22.6", + "@docusaurus/core": "~2.4.1", + "@docusaurus/plugin-pwa": "~2.4.1", + "@docusaurus/preset-classic": "~2.4.1", + "@docusaurus/remark-plugin-npm2yarn": "~2.4.1", + "@docusaurus/theme-common": "~2.4.1", "@mdx-js/react": "1.6.22", - "@typescript-eslint/parser": "5.56.0", - "@typescript-eslint/website-eslint": "5.56.0", - "clsx": "^1.1.1", + "@typescript-eslint/parser": "6.0.0", + "@typescript-eslint/website-eslint": "6.0.0", + "clsx": "^1.2.1", "eslint": "*", "json-schema": "^0.4.0", - "json-schema-to-typescript": "^12.0.0", - "json5": "^2.2.1", - "konamimojisplosion": "^0.5.1", - "lzstring.ts": "^2.0.2", + "json5": "^2.2.3", + "konamimojisplosion": "^0.5.2", + "lz-string": "^1.5.0", "prettier": "*", "prism-react-renderer": "^1.3.3", - "react": "^18.1.0", - "react-dom": "^18.1.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-split-pane": "^0.1.92", "remark-docusaurus-tabs": "^0.2.0", + "ts-node": "*", "typescript": "*" }, "resolutions": { - "react": "^18.0.0" + "react": "^18.2.0" }, "devDependencies": { - "@axe-core/playwright": "^4.4.5", - "@docusaurus/module-type-aliases": "~2.2.0", - "@playwright/test": "^1.27.1", - "@types/esquery": "^1.0.2", - "@types/react": "^18.0.9", - "@types/react-helmet": "^6.1.5", + "@axe-core/playwright": "^4.7.3", + "@docusaurus/module-type-aliases": "~2.4.1", + "@playwright/test": "^1.36.0", + "@types/react": "*", + "@types/react-helmet": "^6.1.6", "@types/react-router-dom": "^5.3.3", - "@typescript-eslint/eslint-plugin": "5.56.0", + "@typescript-eslint/eslint-plugin": "6.0.0", + "@typescript-eslint/rule-schema-to-typescript-types": "6.0.0", + "@typescript-eslint/types": "6.0.0", "copy-webpack-plugin": "^11.0.0", - "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-react": "^7.29.4", - "eslint-plugin-react-hooks": "^4.5.0", + "cross-fetch": "*", "globby": "^11.1.0", - "monaco-editor": "^0.36.0", - "webpack": "^5.74.0" + "make-dir": "*", + "monaco-editor": "~0.40.0", + "raw-loader": "^4.0.2", + "rimraf": "*", + "stylelint": "^15.10.1", + "stylelint-config-recommended": "^13.0.0", + "stylelint-config-standard": "^34.0.0", + "stylelint-order": "^6.0.3", + "webpack": "^5.88.1" }, "browserslist": { "production": [ diff --git a/packages/website/plugins/generated-rule-docs.ts b/packages/website/plugins/generated-rule-docs.ts index 2e5a3258700..9f4d013d545 100644 --- a/packages/website/plugins/generated-rule-docs.ts +++ b/packages/website/plugins/generated-rule-docs.ts @@ -1,14 +1,11 @@ -import * as eslintPlugin from '@typescript-eslint/eslint-plugin'; -import * as tseslintParser from '@typescript-eslint/parser'; +import pluginRules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; +import { compile } from '@typescript-eslint/rule-schema-to-typescript-types'; import * as fs from 'fs'; -import type { JSONSchema7 } from 'json-schema'; -import type { JSONSchema } from 'json-schema-to-typescript'; -import { compile } from 'json-schema-to-typescript'; -import * as lz from 'lzstring.ts'; +import * as lz from 'lz-string'; import type * as mdast from 'mdast'; import { EOL } from 'os'; import * as path from 'path'; -import { format } from 'prettier'; +import { format, resolveConfig } from 'prettier'; import type { Plugin } from 'unified'; import type * as unist from 'unist'; @@ -22,6 +19,19 @@ const COMPLICATED_RULE_OPTIONS = new Set([ 'member-ordering', 'naming-convention', ]); +/** + * Rules that do funky things with their defaults and require special code + * rather than just JSON.stringify-ing their defaults blob + */ +const SPECIAL_CASE_DEFAULTS = new Map([ + // + ['ban-types', '[{ /* See below for default options */ }]'], +]); + +const prettierConfig = { + ...(resolveConfig.sync(__filename) ?? {}), + filepath: path.join(__dirname, 'defaults.ts'), +}; const sourceUrlPrefix = 'https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/'; @@ -35,12 +45,12 @@ function nodeIsParent(node: unist.Node): node is unist.Parent { } export const generatedRuleDocs: Plugin = () => { - return async (root, file) => { + return (root, file) => { if (!nodeIsParent(root) || file.stem == null) { return; } - const rule = eslintPlugin.rules[file.stem]; + const rule = pluginRules[file.stem]; const meta = rule?.meta; if (!meta?.docs) { return; @@ -138,10 +148,10 @@ export const generatedRuleDocs: Plugin = () => { } } + insertIfMissing('Options'); if (meta.docs.extendsBaseRule) { insertIfMissing('How to Use'); } - insertIfMissing('Options'); return [headingIndices[0], headingIndices[1]]; })(); @@ -243,7 +253,10 @@ export const generatedRuleDocs: Plugin = () => { optionsH2Index += 2; - if (meta.schema.length === 0) { + const hasNoConfig = Array.isArray(meta.schema) + ? meta.schema.length === 0 + : Object.keys(meta.schema).length === 0; + if (hasNoConfig) { children.splice(optionsH2Index + 1, 0, { children: [ { @@ -254,21 +267,9 @@ export const generatedRuleDocs: Plugin = () => { type: 'paragraph', } as mdast.Paragraph); } else if (!COMPLICATED_RULE_OPTIONS.has(file.stem)) { - const optionsSchema: JSONSchema = - meta.schema instanceof Array - ? meta.schema[0] - : meta.schema.type === 'array' - ? { - ...(meta.schema.definitions - ? { definitions: meta.schema.definitions } - : {}), - ...(meta.schema.$defs - ? { $defs: (meta.schema as JSONSchema7).$defs } - : {}), - ...(meta.schema.prefixItems as [JSONSchema])[0], - } - : meta.schema; - + const defaults = + SPECIAL_CASE_DEFAULTS.get(file.stem) ?? + JSON.stringify(rule.defaultOptions); children.splice( optionsH2Index + 1, 0, @@ -276,11 +277,7 @@ export const generatedRuleDocs: Plugin = () => { children: [ { type: 'text', - value: `This rule accepts an options ${ - 'enum' in optionsSchema - ? 'string of the following possible values' - : 'object with the following properties' - }:`, + value: 'This rule accepts the following options', } as mdast.Text, ], type: 'paragraph', @@ -289,27 +286,10 @@ export const generatedRuleDocs: Plugin = () => { lang: 'ts', type: 'code', value: [ - ( - await compile( - { - title: `Options`, - ...optionsSchema, - }, - file.stem, - { - additionalProperties: false, - bannerComment: '', - declareExternallyReferenced: true, - }, - ) - ).replace(/^export /gm, ''), + compile(rule.meta.schema), format( - `const defaultOptions: Options = ${JSON.stringify( - rule.defaultOptions, - )};`, - { - parser: tseslintParser.parse, - }, + `const defaultOptions: Options = ${defaults};`, + prettierConfig, ), ] .join(EOL) @@ -417,7 +397,7 @@ export const generatedRuleDocs: Plugin = () => { }; function convertToPlaygroundHash(eslintrc: string): string { - return lz.LZString.compressToEncodedURIComponent(eslintrc); + return lz.compressToEncodedURIComponent(eslintrc); } function nodeIsHeading(node: unist.Node): node is mdast.Heading { diff --git a/packages/website/project.json b/packages/website/project.json index e7e7b0eabbf..4fc851bfab5 100644 --- a/packages/website/project.json +++ b/packages/website/project.json @@ -5,10 +5,14 @@ "implicitDependencies": [], "targets": { "lint": { - "executor": "@nrwl/linter:eslint", + "executor": "@nx/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["packages/website/**/*.ts"] + "lintFilePatterns": [ + "packages/website/**/*.{mts,cts,ts,tsx}", + "packages/website/**/*.{mjs,cjs,js,jsx}" + ], + "ignorePath": ".eslintignore" } } } diff --git a/packages/website/rulesMeta.ts b/packages/website/rulesMeta.ts index 8aa5f317469..e29058983e4 100644 --- a/packages/website/rulesMeta.ts +++ b/packages/website/rulesMeta.ts @@ -1,15 +1,13 @@ -import * as eslintPlugin from '@typescript-eslint/eslint-plugin'; +import rules from '@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules'; -export const rulesMeta = Object.entries(eslintPlugin.rules).map( - ([name, content]) => ({ - name, - type: content.meta.type, - docs: content.meta.docs, - fixable: content.meta.fixable, - hasSuggestions: content.meta.hasSuggestions, - deprecated: content.meta.deprecated, - replacedBy: content.meta.replacedBy, - }), -); +export const rulesMeta = Object.entries(rules).map(([name, content]) => ({ + name, + type: content.meta.type, + docs: content.meta.docs, + fixable: content.meta.fixable, + hasSuggestions: content.meta.hasSuggestions, + deprecated: content.meta.deprecated, + replacedBy: content.meta.replacedBy, +})); export type RulesMeta = typeof rulesMeta; diff --git a/packages/website/sidebars/sidebar.base.js b/packages/website/sidebars/sidebar.base.js index 2a097b02a70..d414d4803ba 100644 --- a/packages/website/sidebars/sidebar.base.js +++ b/packages/website/sidebars/sidebar.base.js @@ -1,12 +1,14 @@ +// @ts-check +/** @type {import('@docusaurus/plugin-content-docs/lib/sidebars/types.js').SidebarsConfig} */ module.exports = { docs: [ { collapsible: false, items: [ { - label: 'Linting with Type Information', - items: ['linting/typed-linting/monorepos'], collapsible: false, + items: ['linting/typed-linting/monorepos'], + label: 'Linting with Type Information', link: { id: 'linting/typed-linting', type: 'doc', @@ -15,40 +17,65 @@ module.exports = { }, 'linting/configs', { - label: 'Troubleshooting & FAQs', - link: { - id: 'linting/troubleshooting', - type: 'doc', - }, collapsible: false, - type: 'category', items: [ 'linting/troubleshooting/performance-troubleshooting', 'linting/troubleshooting/formatting', 'linting/troubleshooting/tslint', ], + label: 'Troubleshooting & FAQs', + link: { + id: 'linting/troubleshooting', + type: 'doc', + }, + type: 'category', }, ], + label: 'Getting Started', link: { id: 'getting-started', type: 'doc', }, - label: 'Getting Started', type: 'category', }, - 'custom-rules', { + collapsible: false, + items: [ + 'users/dependency-versions', + 'users/releases', + 'users/versioning', + ], + label: 'Users', + link: { + id: 'users', + type: 'doc', + }, + type: 'category', + }, + { + collapsible: false, + items: ['developers/custom-rules'], + label: 'Developers', + link: { + id: 'developers', + type: 'doc', + }, + type: 'category', + }, + { + collapsible: false, items: [ - 'architecture/eslint-plugin', - 'architecture/eslint-plugin-tslint', - 'architecture/parser', - 'architecture/scope-manager', - 'architecture/typescript-estree', - 'architecture/utils', + 'packages/eslint-plugin', + 'packages/eslint-plugin-tslint', + 'packages/parser', + 'packages/rule-tester', + 'packages/scope-manager', + 'packages/typescript-estree', + 'packages/utils', ], - label: 'Architecture', + label: 'Packages', link: { - id: 'architecture', + id: 'packages', type: 'doc', }, type: 'category', @@ -70,6 +97,7 @@ module.exports = { { items: [ 'maintenance/branding', + 'maintenance/dependency-version-upgrades', { collapsible: false, items: ['maintenance/issues/rule-deprecations'], @@ -80,18 +108,8 @@ module.exports = { }, type: 'category', }, + 'maintenance/major-release-steps', 'maintenance/pull-requests', - 'maintenance/releases', - { - collapsible: false, - items: ['maintenance/versioning/dependant-version-upgrades'], - label: 'Versioning', - link: { - id: 'maintenance/versioning', - type: 'doc', - }, - type: 'category', - }, ], label: 'Maintenance', link: { diff --git a/packages/website/src/components/ASTViewerESTree.tsx b/packages/website/src/components/ASTViewerESTree.tsx deleted file mode 100644 index 4fcc82f278b..00000000000 --- a/packages/website/src/components/ASTViewerESTree.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { TSESTree } from '@typescript-eslint/utils'; -import type * as ESQuery from 'esquery'; -import React, { useMemo } from 'react'; - -import ASTViewer from './ast/ASTViewer'; -import { serialize } from './ast/serializer/serializer'; -import { createESTreeSerializer } from './ast/serializer/serializerESTree'; -import type { ASTViewerBaseProps } from './ast/types'; - -export interface ASTESTreeViewerProps extends ASTViewerBaseProps { - readonly value: TSESTree.BaseNode; - readonly filter?: ESQuery.Selector; -} - -function tryToApplyFilter( - value: T, - filter?: ESQuery.Selector, -): T | T[] { - try { - if (window.esquery && filter) { - // @ts-expect-error - esquery requires js ast types - return window.esquery.match(value, filter); - } - } catch (e: unknown) { - // eslint-disable-next-line no-console - console.error(e); - } - return value; -} - -export default function ASTViewerESTree({ - value, - position, - onSelectNode, - filter, -}: ASTESTreeViewerProps): JSX.Element { - const model = useMemo(() => { - return serialize(tryToApplyFilter(value, filter), createESTreeSerializer()); - }, [value, filter]); - - return ( - - ); -} diff --git a/packages/website/src/components/ASTViewerScope.tsx b/packages/website/src/components/ASTViewerScope.tsx deleted file mode 100644 index e16365bfc3c..00000000000 --- a/packages/website/src/components/ASTViewerScope.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import React, { useMemo } from 'react'; - -import ASTViewer from './ast/ASTViewer'; -import { serialize } from './ast/serializer/serializer'; -import { createScopeSerializer } from './ast/serializer/serializerScope'; -import type { ASTViewerBaseProps } from './ast/types'; - -export interface ASTScopeViewerProps extends ASTViewerBaseProps { - readonly value: Record; -} - -export default function ASTViewerScope({ - value, - onSelectNode, -}: ASTScopeViewerProps): JSX.Element { - const model = useMemo( - () => serialize(value, createScopeSerializer()), - [value], - ); - - return ; -} diff --git a/packages/website/src/components/ASTViewerTS.tsx b/packages/website/src/components/ASTViewerTS.tsx deleted file mode 100644 index 30dda954a43..00000000000 --- a/packages/website/src/components/ASTViewerTS.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import type { SourceFile } from 'typescript'; - -import ASTViewer from './ast/ASTViewer'; -import { serialize } from './ast/serializer/serializer'; -import { createTsSerializer } from './ast/serializer/serializerTS'; -import type { ASTViewerBaseProps, ASTViewerModelMap } from './ast/types'; - -export interface ASTTsViewerProps extends ASTViewerBaseProps { - readonly value: SourceFile; -} - -function extractEnum( - obj: Record, -): Record { - const result: Record = {}; - const keys = Object.entries(obj); - for (const [name, value] of keys) { - if (typeof value === 'number') { - if (!(value in result)) { - result[value] = name; - } - } - } - return result; -} - -export default function ASTViewerTS({ - value, - position, - onSelectNode, -}: ASTTsViewerProps): JSX.Element { - const [model, setModel] = useState(''); - const [syntaxKind] = useState(() => extractEnum(window.ts.SyntaxKind)); - const [nodeFlags] = useState(() => extractEnum(window.ts.NodeFlags)); - const [tokenFlags] = useState(() => extractEnum(window.ts.TokenFlags)); - const [modifierFlags] = useState(() => extractEnum(window.ts.ModifierFlags)); - const [objectFlags] = useState(() => extractEnum(window.ts.ObjectFlags)); - const [symbolFlags] = useState(() => extractEnum(window.ts.SymbolFlags)); - const [flowFlags] = useState(() => extractEnum(window.ts.FlowFlags)); - const [typeFlags] = useState(() => extractEnum(window.ts.TypeFlags)); - - useEffect(() => { - const scopeSerializer = createTsSerializer( - value, - syntaxKind, - ['NodeFlags', nodeFlags], - ['TokenFlags', tokenFlags], - ['ModifierFlags', modifierFlags], - ['ObjectFlags', objectFlags], - ['SymbolFlags', symbolFlags], - ['FlowFlags', flowFlags], - ['TypeFlags', typeFlags], - ); - setModel(serialize(value, scopeSerializer)); - }, [ - value, - syntaxKind, - nodeFlags, - tokenFlags, - modifierFlags, - objectFlags, - symbolFlags, - flowFlags, - typeFlags, - ]); - - return ( - - ); -} diff --git a/packages/website/src/components/ESQueryFilter.module.css b/packages/website/src/components/ESQueryFilter.module.css index 49dbce2ed6f..bc42a7253c6 100644 --- a/packages/website/src/components/ESQueryFilter.module.css +++ b/packages/website/src/components/ESQueryFilter.module.css @@ -1,7 +1,4 @@ .searchContainer { display: flex; - margin: 0 0 0.5rem 0; - position: sticky; - top: 0; - left: 0; + margin: 0 0 0.5rem; } diff --git a/packages/website/src/components/ESQueryFilter.tsx b/packages/website/src/components/ESQueryFilter.tsx index 1e16de6205a..614825b3368 100644 --- a/packages/website/src/components/ESQueryFilter.tsx +++ b/packages/website/src/components/ESQueryFilter.tsx @@ -12,7 +12,7 @@ export interface ESQueryFilterProps { export function ESQueryFilter({ onChange, onError, -}: ESQueryFilterProps): JSX.Element { +}: ESQueryFilterProps): React.JSX.Element { const [value, setValue] = useState(''); const changeEvent = (value: string): void => { setValue(value); diff --git a/packages/website/src/components/EditorTabs.tsx b/packages/website/src/components/EditorTabs.tsx deleted file mode 100644 index 6edbee22422..00000000000 --- a/packages/website/src/components/EditorTabs.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import EditIcon from '@site/src/icons/edit.svg'; -import React from 'react'; - -import styles from './Playground.module.css'; -import type { TabType } from './types'; - -export interface FileTabsProps { - readonly tabs: TabType[]; - readonly activeTab: TabType; - readonly change: (tab: TabType) => void; - readonly showModal: () => void; -} - -export default function EditorTabs({ - tabs, - activeTab, - change, - showModal, -}: FileTabsProps): JSX.Element { - return ( -
-
- {tabs.map(item => { - return ( - - ); - })} -
- {activeTab !== 'code' && ( - - )} -
- ); -} diff --git a/packages/website/src/components/ErrorsViewer.module.css b/packages/website/src/components/ErrorsViewer.module.css index 0c227bbb4c8..4cfc2e15d18 100644 --- a/packages/website/src/components/ErrorsViewer.module.css +++ b/packages/website/src/components/ErrorsViewer.module.css @@ -22,3 +22,11 @@ .fixer { margin: 0.5rem 0 0.5rem 1.5rem; } + +.errorPre { + background: transparent; + margin: 0; + padding: 0; + white-space: break-spaces; + word-wrap: break-word; +} diff --git a/packages/website/src/components/ErrorsViewer.tsx b/packages/website/src/components/ErrorsViewer.tsx index b60d2dd9711..17481e30f94 100644 --- a/packages/website/src/components/ErrorsViewer.tsx +++ b/packages/website/src/components/ErrorsViewer.tsx @@ -5,10 +5,12 @@ import type Monaco from 'monaco-editor'; import React, { useEffect, useState } from 'react'; import styles from './ErrorsViewer.module.css'; +import type { AlertBlockProps } from './layout/AlertBlock'; +import AlertBlock from './layout/AlertBlock'; import type { ErrorGroup, ErrorItem } from './types'; export interface ErrorsViewerProps { - readonly value?: ErrorGroup[] | Error; + readonly value?: ErrorGroup[]; } export interface ErrorViewerProps { @@ -17,13 +19,7 @@ export interface ErrorViewerProps { readonly type: AlertBlockProps['type']; } -interface AlertBlockProps { - readonly type: 'danger' | 'warning' | 'note' | 'info' | 'success'; - readonly children: React.ReactNode; - readonly fixer?: boolean; -} - -interface ErrorBlockProps { +export interface ErrorBlockProps { readonly item: ErrorItem; readonly setIsLocked: (value: boolean) => void; readonly isLocked: boolean; @@ -49,7 +45,7 @@ function severityClass( return 'info'; } -function FixButton(props: FixButtonProps): JSX.Element { +function FixButton(props: FixButtonProps): React.JSX.Element { return (
- ); -} - function ErrorBlock({ item, setIsLocked, isLocked, -}: ErrorBlockProps): JSX.Element { +}: ErrorBlockProps): React.JSX.Element { return (
-
+
           {item.message} {item.location}
-        
+ {item.fixer && ( -
-
All is ok!
-
- - ); -} - export function ErrorViewer({ value, title, type, -}: ErrorViewerProps): JSX.Element { +}: ErrorViewerProps): React.JSX.Element { return (
@@ -134,24 +112,22 @@ export function ErrorViewer({

{title}

- {type === 'danger' ? value.stack : value.message} +
+            {type === 'danger' ? value?.stack : value.message}
+          
); } -export function ErrorsViewer({ value }: ErrorsViewerProps): JSX.Element { +export function ErrorsViewer({ value }: ErrorsViewerProps): React.JSX.Element { const [isLocked, setIsLocked] = useState(false); useEffect(() => { setIsLocked(false); }, [value]); - if (value && !Array.isArray(value)) { - return ; - } - return (
{value?.length ? ( @@ -170,19 +146,22 @@ export function ErrorsViewer({ value }: ErrorsViewerProps): JSX.Element { )} {items.map((item, index) => ( - +
+ +
))}
); }) ) : (
- + +
All is ok!
+
)}
diff --git a/packages/website/src/components/FinancialContributors/Sponsor.tsx b/packages/website/src/components/FinancialContributors/Sponsor.tsx index 5a9bf43e041..7b4314ac7df 100644 --- a/packages/website/src/components/FinancialContributors/Sponsor.tsx +++ b/packages/website/src/components/FinancialContributors/Sponsor.tsx @@ -9,7 +9,10 @@ interface SponsorProps { sponsor: SponsorData; } -export function Sponsor({ includeName, sponsor }: SponsorProps): JSX.Element { +export function Sponsor({ + includeName, + sponsor, +}: SponsorProps): React.JSX.Element { let children = {`${sponsor.name}; if (includeName) { diff --git a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx b/packages/website/src/components/FinancialContributors/Sponsors/index.tsx index 6c2d8874593..7267b8c71fe 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/index.tsx +++ b/packages/website/src/components/FinancialContributors/Sponsors/index.tsx @@ -20,7 +20,7 @@ export function Sponsors({ title, tier, sponsors, -}: SponsorsProps): JSX.Element { +}: SponsorsProps): React.JSX.Element { return (

{title}

diff --git a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css b/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css index 526e1ab745e..9b8d1a88b4a 100644 --- a/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css +++ b/packages/website/src/components/FinancialContributors/Sponsors/styles.module.css @@ -71,14 +71,14 @@ width: 45px; } -@media screen and (min-width: 700px) { +@media screen and (width >= 700px) { .tierArea { min-width: 500px; width: 50vw; } } -@media screen and (min-width: 1150px) { +@media screen and (width >= 1150px) { .tierArea { margin: 16px 0; width: auto; diff --git a/packages/website/src/components/FinancialContributors/index.tsx b/packages/website/src/components/FinancialContributors/index.tsx index 0460e1e8694..fedeed2b98c 100644 --- a/packages/website/src/components/FinancialContributors/index.tsx +++ b/packages/website/src/components/FinancialContributors/index.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { Sponsors } from './Sponsors'; import styles from './styles.module.css'; -export function FinancialContributors(): JSX.Element { +export function FinancialContributors(): React.JSX.Element { return ( <>

diff --git a/packages/website/src/components/FinancialContributors/styles.module.css b/packages/website/src/components/FinancialContributors/styles.module.css index 667e6a7e60c..c30c1163c34 100644 --- a/packages/website/src/components/FinancialContributors/styles.module.css +++ b/packages/website/src/components/FinancialContributors/styles.module.css @@ -32,7 +32,7 @@ --ifm-button-color: var(--ifm-color-white); } -@media screen and (min-width: 1150px) { +@media screen and (width >= 1150px) { .sponsorsContainer { display: grid; grid-template-columns: 50% 50%; diff --git a/packages/website/src/components/OptionsSelector.module.css b/packages/website/src/components/OptionsSelector.module.css deleted file mode 100644 index a990748be47..00000000000 --- a/packages/website/src/components/OptionsSelector.module.css +++ /dev/null @@ -1,75 +0,0 @@ -.optionLabel { - cursor: pointer; -} - -.optionItem, -.optionLabel { - align-items: center; - display: flex; - flex: 0 0 1.5rem; - flex-direction: row; - font-size: 0.75rem; - margin: 0 0; - padding: 0.4rem 0.8rem; - transition: background-color var(--ifm-transition-fast) - var(--ifm-transition-timing-default), - color var(--ifm-transition-fast) var(--ifm-transition-timing-default); - color: var(--ifm-font-color-secondary); - justify-content: space-between; - border: none; - background: transparent; - font-family: var(--ifm-font-family-base); - box-sizing: border-box; - line-height: var(--ifm-line-height-base); -} - -.optionLabel:hover { - background-color: var(--ifm-color-emphasis-100); - color: var(--ifm-font-color-primary); -} - -.optionInput { - display: block; - width: 90%; - padding: 0.4rem 0.6rem; - line-height: 1; - font-size: 0.8rem; - font-weight: 500; - font-family: inherit; - border-radius: 6px; - appearance: none; - color: var(--ifm-font-color-secondary); - border: 1px solid var(--ifm-color-emphasis-100); - background: var(--ifm-color-emphasis-200); - transition: border 0.3s ease; -} - -.optionInput::placeholder { - color: var(--ifm-color-emphasis-700); -} - -.optionInput:focus { - outline: none; - border-color: var(--ifm-color-primary); -} - -.optionSelect { - line-height: 1; - font-size: 0.8rem; - font-weight: 500; - border-radius: 6px; - font-family: inherit; - width: 50%; - box-shadow: none; - background-image: none; - padding: 0.4rem 0.6rem; - appearance: none; - color: var(--ifm-font-color-secondary); - border: 1px solid var(--ifm-color-emphasis-100); - background: var(--ifm-color-emphasis-200); - transition: border 0.3s ease; -} -.optionSelect:focus { - outline: none; - border-color: var(--ifm-color-primary); -} diff --git a/packages/website/src/components/OptionsSelector.tsx b/packages/website/src/components/OptionsSelector.tsx index fe573ef86ab..0233d83f75e 100644 --- a/packages/website/src/components/OptionsSelector.tsx +++ b/packages/website/src/components/OptionsSelector.tsx @@ -1,159 +1,119 @@ -/* eslint-disable jsx-a11y/label-has-associated-control */ import { NavbarSecondaryMenuFiller, useWindowSize, } from '@docusaurus/theme-common'; +import Checkbox from '@site/src/components/inputs/Checkbox'; import CopyIcon from '@site/src/icons/copy.svg'; +import IconExternalLink from '@theme/Icon/ExternalLink'; import React, { useCallback } from 'react'; -import useDebouncedToggle from './hooks/useDebouncedToggle'; -import Checkbox from './inputs/Checkbox'; +import { useClipboard } from '../hooks/useClipboard'; import Dropdown from './inputs/Dropdown'; import Tooltip from './inputs/Tooltip'; +import ActionLabel from './layout/ActionLabel'; import Expander from './layout/Expander'; +import InputLabel from './layout/InputLabel'; import { createMarkdown, createMarkdownParams } from './lib/markdown'; -import styles from './OptionsSelector.module.css'; +import { fileTypes } from './options'; import type { ConfigModel } from './types'; export interface OptionsSelectorParams { readonly state: ConfigModel; readonly setState: (cfg: Partial) => void; readonly tsVersions: readonly string[]; - readonly isLoading: boolean; } -const ASTOptions = [ - { value: false, label: 'Disabled' }, - { value: 'es', label: 'ESTree' }, - { value: 'ts', label: 'TypeScript' }, - { value: 'scope', label: 'Scope' }, -] as const; - function OptionsSelectorContent({ state, setState, tsVersions, - isLoading, -}: OptionsSelectorParams): JSX.Element { - const [copyLink, setCopyLink] = useDebouncedToggle(false); - const [copyMarkdown, setCopyMarkdown] = useDebouncedToggle(false); - - const updateTS = useCallback( - (version: string) => { - setState({ ts: version }); - }, - [setState], +}: OptionsSelectorParams): React.JSX.Element { + const [copyLink, copyLinkToClipboard] = useClipboard(() => + document.location.toString(), + ); + const [copyMarkdown, copyMarkdownToClipboard] = useClipboard(() => + createMarkdown(state), ); - - const copyLinkToClipboard = useCallback(() => { - void navigator.clipboard - .writeText(document.location.toString()) - .then(() => { - setCopyLink(true); - }); - }, [setCopyLink]); - - const copyMarkdownToClipboard = useCallback(() => { - if (isLoading) { - return; - } - void navigator.clipboard.writeText(createMarkdown(state)).then(() => { - setCopyMarkdown(true); - }); - }, [isLoading, state, setCopyMarkdown]); const openIssue = useCallback(() => { - if (isLoading) { - return; - } + const params = createMarkdownParams(state); + window .open( - `https://github.com/typescript-eslint/typescript-eslint/issues/new?${createMarkdownParams( - state, - )}`, + `https://github.com/typescript-eslint/typescript-eslint/issues/new?${params}`, '_blank', ) ?.focus(); - }, [state, isLoading]); + }, [state]); return ( <> - - - + + {process.env.ESLINT_VERSION} + {process.env.TS_ESLINT_VERSION} - - - + + + setState({ scroll })} + /> + + + setState({ showTokens })} + /> + - - - + + + + ); } -function OptionsSelector(props: OptionsSelectorParams): JSX.Element { +function OptionsSelector(props: OptionsSelectorParams): React.JSX.Element { const windowSize = useWindowSize(); if (windowSize === 'mobile') { return ( diff --git a/packages/website/src/components/Playground.module.css b/packages/website/src/components/Playground.module.css index 9f14c0eee08..e61a35bad03 100644 --- a/packages/website/src/components/Playground.module.css +++ b/packages/website/src/components/Playground.module.css @@ -16,9 +16,7 @@ .codeBlocks { display: flex; - flex-grow: 1; - flex-shrink: 1; - flex-basis: 0; + flex: 1 1 0; flex-direction: row; height: 100%; width: calc(100vw - 20rem); @@ -45,45 +43,29 @@ z-index: calc(var(--ifm-z-index-fixed) - 1); } -.tabContainer { - display: flex; - justify-content: space-between; - background: var(--playground-main-color); - border-bottom: 1px solid var(--playground-secondary-color); +.playgroundInfoHeader { + position: sticky; + top: 0; + left: 0; + z-index: 1; } .tabCode { - height: calc(100% - 32px); -} - -.tabStyle { - border: none; - border-right: 1px solid var(--playground-secondary-color); - background: var(--playground-main-color); - color: var(--ifm-color-emphasis-700); - padding: 0.5rem 1rem; - cursor: pointer; + height: calc(100% - 41px); } -.tabStyle svg { - margin-left: 0.3rem; +.hidden { + display: none; + visibility: hidden; } -.tabStyle:hover { - background: var(--playground-secondary-color); -} - -.tabStyle:disabled { - background: var(--playground-secondary-color); - color: var(--ifm-color-emphasis-900); -} - -@media only screen and (max-width: 996px) { +@media only screen and (width <= 996px) { .codeContainer { display: block; width: 100%; position: static; } + .codeBlocks { display: block; width: 100%; diff --git a/packages/website/src/components/Playground.tsx b/packages/website/src/components/Playground.tsx index 6fe79df9f24..4f3a74bd525 100644 --- a/packages/website/src/components/Playground.tsx +++ b/packages/website/src/components/Playground.tsx @@ -1,89 +1,41 @@ -import ASTViewerScope from '@site/src/components/ASTViewerScope'; -import ConfigEslint from '@site/src/components/config/ConfigEslint'; -import ConfigTypeScript from '@site/src/components/config/ConfigTypeScript'; -import { - defaultEslintConfig, - defaultTsConfig, -} from '@site/src/components/config/utils'; -import EditorTabs from '@site/src/components/EditorTabs'; -import { ErrorsViewer, ErrorViewer } from '@site/src/components/ErrorsViewer'; -import { ESQueryFilter } from '@site/src/components/ESQueryFilter'; import type { TSESTree } from '@typescript-eslint/utils'; import clsx from 'clsx'; import type * as ESQuery from 'esquery'; -import type Monaco from 'monaco-editor'; -import React, { useCallback, useReducer, useState } from 'react'; +import React, { useCallback, useState } from 'react'; import type { SourceFile } from 'typescript'; -import { useMediaQuery } from '../hooks/useMediaQuery'; -import ASTViewerESTree from './ASTViewerESTree'; -import ASTViewerTS from './ASTViewerTS'; +import ASTViewer from './ast/ASTViewer'; +import ConfigEslint from './config/ConfigEslint'; +import ConfigTypeScript from './config/ConfigTypeScript'; import { EditorEmbed } from './editor/EditorEmbed'; import { LoadingEditor } from './editor/LoadingEditor'; +import { ErrorsViewer, ErrorViewer } from './ErrorsViewer'; +import { ESQueryFilter } from './ESQueryFilter'; import useHashState from './hooks/useHashState'; +import EditorTabs from './layout/EditorTabs'; import Loader from './layout/Loader'; -import { shallowEqual } from './lib/shallowEqual'; +import { defaultConfig, detailTabs } from './options'; import OptionsSelector from './OptionsSelector'; import styles from './Playground.module.css'; import ConditionalSplitPane from './SplitPane/ConditionalSplitPane'; -import type { - ConfigModel, - ErrorGroup, - RuleDetails, - SelectedRange, - TabType, -} from './types'; +import type { ErrorGroup, RuleDetails, SelectedRange, TabType } from './types'; -function rangeReducer( - prevState: T, - action: T, -): T { - if (prevState !== action) { - if ( - !prevState || - !action || - !shallowEqual(prevState.start, action.start) || - !shallowEqual(prevState.end, action.end) - ) { - return action; - } - } - return prevState; -} -function Playground(): JSX.Element { - const [state, setState] = useHashState({ - jsx: false, - showAST: false, - sourceType: 'module', - code: '', - ts: process.env.TS_VERSION!, - tsconfig: defaultTsConfig, - eslintrc: defaultEslintConfig, - }); +function Playground(): React.JSX.Element { + const [state, setState] = useHashState(defaultConfig); const [esAst, setEsAst] = useState(); const [tsAst, setTsAST] = useState(); const [scope, setScope] = useState | null>(); - const [markers, setMarkers] = useState(); + const [markers, setMarkers] = useState(); const [ruleNames, setRuleNames] = useState([]); const [isLoading, setIsLoading] = useState(true); const [tsVersions, setTSVersion] = useState([]); - const [selectedRange, setSelectedRange] = useReducer(rangeReducer, null); - const [position, setPosition] = useState(null); + const [selectedRange, setSelectedRange] = useState(); + const [position, setPosition] = useState(); const [activeTab, setTab] = useState('code'); - const [showModal, setShowModal] = useState(false); const [esQueryFilter, setEsQueryFilter] = useState(); const [esQueryError, setEsQueryError] = useState(); - const enableSplitPanes = useMediaQuery('(min-width: 996px)'); - - const updateModal = useCallback( - (config?: Partial) => { - if (config) { - setState(config); - } - setShowModal(false); - }, - [setState], - ); + const [visualEslintRc, setVisualEslintRc] = useState(false); + const [visualTSConfig, setVisualTSConfig] = useState(false); const onLoaded = useCallback( (ruleNames: RuleDetails[], tsVersions: readonly string[]): void => { @@ -94,24 +46,35 @@ function Playground(): JSX.Element { [], ); + const activeVisualEditor = !isLoading + ? visualEslintRc && activeTab === 'eslintrc' + ? 'eslintrc' + : visualTSConfig && activeTab === 'tsconfig' + ? 'tsconfig' + : undefined + : undefined; + + const onVisualEditor = useCallback((tab: TabType): void => { + if (tab === 'tsconfig') { + setVisualTSConfig(val => !val); + } else if (tab === 'eslintrc') { + setVisualEslintRc(val => !val); + } + }, []); + + const astToShow = + state.showAST === 'ts' + ? tsAst + : state.showAST === 'scope' + ? scope + : state.showAST === 'es' + ? esAst + : undefined; + return (

- {ruleNames.length > 0 && ( - - )} -
} setShowModal(activeTab)} + showVisualEditor={activeTab !== 'code'} + showModal={onVisualEditor} /> -
+ {(activeVisualEditor === 'eslintrc' && ( + + )) || + (activeVisualEditor === 'tsconfig' && ( + + ))} +
- {state.showAST === 'es' && ( - + setState({ showAST: v })} /> - )} - {(state.showAST === 'ts' && tsAst && ( - + )} +
+ + {(state.showAST === 'es' && esQueryError && ( + )) || - (state.showAST === 'scope' && scope && ( - - )) || - (state.showAST === 'es' && esQueryError && ( - - )) || - (state.showAST === 'es' && esAst && ( - )) || }
diff --git a/packages/website/src/components/RulesTable/index.tsx b/packages/website/src/components/RulesTable/index.tsx index 7b7033abe92..f1270d34b73 100644 --- a/packages/website/src/components/RulesTable/index.tsx +++ b/packages/website/src/components/RulesTable/index.tsx @@ -1,12 +1,19 @@ import Link from '@docusaurus/Link'; +import { useHistory } from '@docusaurus/router'; import type { RulesMeta } from '@site/rulesMeta'; import { useRulesMeta } from '@site/src/hooks/useRulesMeta'; import clsx from 'clsx'; -import React, { useMemo, useState } from 'react'; +import React, { useMemo } from 'react'; +import { + type HistorySelector, + useHistorySelector, +} from '../../hooks/useHistorySelector'; import styles from './styles.module.css'; -function interpolateCode(text: string): (JSX.Element | string)[] | string { +function interpolateCode( + text: string, +): (React.JSX.Element | string)[] | string { const fragments = text.split(/`(.*?)`/); if (fragments.length === 1) { return text; @@ -14,7 +21,11 @@ function interpolateCode(text: string): (JSX.Element | string)[] | string { return fragments.map((v, i) => (i % 2 === 0 ? v : {v})); } -function RuleRow({ rule }: { rule: RulesMeta[number] }): JSX.Element | null { +function RuleRow({ + rule, +}: { + rule: RulesMeta[number]; +}): React.JSX.Element | null { if (!rule.docs?.url) { return null; } @@ -29,17 +40,21 @@ function RuleRow({ rule }: { rule: RulesMeta[number] }): JSX.Element | null {
{interpolateCode(rule.docs.description)} - - {recommended === 'strict' ? '🔒' : recommended ? '✅' : ''} + + {(() => { + switch (recommended) { + case 'recommended': + return '✅'; + case 'strict': + return '🔒'; + case 'stylistic': + return '🎨'; + default: + // for some reason the current version of babel loader won't elide this correctly + // recommended satisfies undefined; + return ''; + } + })()} void; mode: FilterMode; -}): JSX.Element { +}): React.JSX.Element { const toNextMode = (): void => setMode(filterModes[(filterModes.indexOf(mode) + 1) % filterModes.length]); return ( @@ -118,101 +133,87 @@ function match(mode: FilterMode, value: boolean): boolean | undefined { } export default function RulesTable({ - extensionRules, + ruleset, }: { - extensionRules?: boolean; -}): JSX.Element { + ruleset: 'extension-rules' | 'supported-rules'; +}): React.JSX.Element { + const [filters, changeFilter] = useRulesFilters(ruleset); + const rules = useRulesMeta(); - const [showRecommended, setShowRecommended] = useState('neutral'); - const [showStrict, setShowStrict] = useState('neutral'); - const [showFixable, setShowFixable] = useState('neutral'); - const [showHasSuggestions, setShowHasSuggestion] = - useState('neutral'); - const [showTypeCheck, setShowTypeCheck] = useState('neutral'); + const extensionRules = ruleset === 'extension-rules'; const relevantRules = useMemo( () => rules .filter(r => !!extensionRules === !!r.docs?.extendsBaseRule) .filter(r => { const opinions = [ + match(filters.recommended, r.docs?.recommended === 'recommended'), match( - showRecommended, - r.docs?.recommended === 'error' || r.docs?.recommended === 'warn', + filters.strict, + r.docs?.recommended === 'recommended' || + r.docs?.recommended === 'strict', ), - match(showStrict, r.docs?.recommended === 'strict'), - match(showFixable, !!r.fixable), - match(showHasSuggestions, !!r.hasSuggestions), - match(showTypeCheck, !!r.docs?.requiresTypeChecking), + match(filters.stylistic, r.docs?.recommended === 'stylistic'), + match(filters.fixable, !!r.fixable), + match(filters.suggestions, !!r.hasSuggestions), + match(filters.typeInformation, !!r.docs?.requiresTypeChecking), ].filter((o): o is boolean => o !== undefined); return opinions.every(o => o); }), - [ - rules, - extensionRules, - showRecommended, - showStrict, - showFixable, - showHasSuggestions, - showTypeCheck, - ], + [rules, extensionRules, filters], ); + return ( <> -
    - { - setShowRecommended(newMode); - - if (newMode === 'include' && showStrict === 'include') { - setShowStrict('exclude'); +
    + Config Group +
      + changeFilter('recommended', newMode)} + label="✅ recommended" + /> + changeFilter('strict', newMode)} + label="🔒 strict" + /> + changeFilter('stylistic', newMode)} + label="🎨 stylistic" + /> +
    +
    +
    + Metadata +
      + changeFilter('fixable', newMode)} + label="🔧 fixable" + /> + changeFilter('suggestions', newMode)} + label="💡 has suggestions" + /> + + changeFilter('typeInformation', newMode) } - }} - label="✅ recommended" - /> - { - setShowStrict(newMode); - - if (newMode === 'include' && showRecommended === 'include') { - setShowRecommended('exclude'); - } - }} - label="🔒 strict" - /> - - - -
    + label="💭 requires type information" + /> +
+
- - - + + + @@ -224,3 +225,99 @@ export default function RulesTable({ ); } + +type FilterCategory = + | 'fixable' + | 'recommended' + | 'strict' + | 'stylistic' + | 'suggestions' + | 'typeInformation'; +type FiltersState = Record; +const neutralFiltersState: FiltersState = { + recommended: 'neutral', + strict: 'neutral', + stylistic: 'neutral', + fixable: 'neutral', + suggestions: 'neutral', + typeInformation: 'neutral', +}; + +const selectSearch: HistorySelector = history => + history.location.search; +const getServerSnapshot = (): string => ''; + +function useRulesFilters( + paramsKey: string, +): [FiltersState, (category: FilterCategory, mode: FilterMode) => void] { + const history = useHistory(); + const search = useHistorySelector(selectSearch, getServerSnapshot); + + const paramValue = new URLSearchParams(search).get(paramsKey) ?? ''; + // We can't compute this in selectSearch, because we need the snapshot to be + // comparable by value. + const filtersState = useMemo( + () => parseFiltersState(paramValue), + [paramValue], + ); + + const changeFilter = (category: FilterCategory, mode: FilterMode): void => { + const newState = { ...filtersState, [category]: mode }; + + if ( + category === 'strict' && + mode === 'include' && + filtersState.recommended === 'include' + ) { + newState.recommended = 'exclude'; + } else if ( + category === 'recommended' && + mode === 'include' && + filtersState.strict === 'include' + ) { + newState.strict = 'exclude'; + } + + const searchParams = new URLSearchParams(history.location.search); + const filtersString = stringifyFiltersState(newState); + + if (filtersString) { + searchParams.set(paramsKey, filtersString); + } else { + searchParams.delete(paramsKey); + } + + history.replace({ search: searchParams.toString() }); + }; + + return [filtersState, changeFilter]; +} + +const NEGATION_SYMBOL = 'x'; + +function stringifyFiltersState(filters: FiltersState): string { + return Object.entries(filters) + .map(([key, value]) => + value === 'include' + ? key + : value === 'exclude' + ? `${NEGATION_SYMBOL}${key}` + : '', + ) + .filter(Boolean) + .join('-'); +} + +function parseFiltersState(str: string): FiltersState { + const res: FiltersState = { ...neutralFiltersState }; + + for (const part of str.split('-')) { + const exclude = part.startsWith(NEGATION_SYMBOL); + const key = exclude ? part.slice(1) : part; + if (Object.hasOwn(neutralFiltersState, key)) { + res[key] = exclude ? 'exclude' : 'include'; + } + } + + return res; +} diff --git a/packages/website/src/components/RulesTable/styles.module.css b/packages/website/src/components/RulesTable/styles.module.css index 4b0d2cd6b63..2f9aefd132d 100644 --- a/packages/website/src/components/RulesTable/styles.module.css +++ b/packages/website/src/components/RulesTable/styles.module.css @@ -1,20 +1,31 @@ :root { --gray-border: var(--ifm-color-secondary-dark); --gray-border-shadow: var(--ifm-color-secondary-dark); - --blue-bg: rgba(148, 197, 225, 0.25); + --blue-bg: rgb(148 197 225 / 25%); --blue-border: var(--ifm-color-primary-lighter); --blue-border-shadow: var(--ifm-color-primary-lightest); - --red-bg: rgba(250, 56, 62, 0.25); - --red-border: rgba(198, 10, 10, 0.4); - --red-border-shadow: rgba(255, 0, 0, 0.4); + --red-bg: rgb(250 56 62 / 25%); + --red-border: rgb(198 10 10 / 40%); + --red-border-shadow: rgb(255 0 0 / 40%); } [data-theme='dark'] { --gray-border-shadow: var(--ifm-color-secondary); - --blue-bg: rgba(35, 78, 128, 0.5); + --blue-bg: rgb(35 78 128 / 50%); --blue-border: var(--ifm-color-primary-dark); - --red-border: rgba(255, 0, 0, 0.3); - --red-border-shadow: rgb(235, 107, 107); + --red-border: rgb(255 0 0 / 30%); + --red-border-shadow: rgb(235 107 107); +} + +.checkboxListArea { + display: flex; + align-items: baseline; + gap: 0.5rem; +} + +.checkboxListArea + .checkboxListArea { + margin-top: -0.5rem; + margin-bottom: 0.5rem; } .checkboxList { @@ -49,7 +60,7 @@ } [data-theme='dark'] .checkboxLabel { - border: 2px solid #666666; + border: 2px solid #666; } .checkboxLabel:hover { @@ -62,7 +73,7 @@ } .checkboxLabel:focus-visible { - outline: 2px solid currentColor; + outline: 2px solid currentcolor; } .checkboxLabel.activated { diff --git a/packages/website/src/components/SplitPane/ConditionalSplitPane.tsx b/packages/website/src/components/SplitPane/ConditionalSplitPane.tsx index 22c9aa14b5d..ffaa10cd36a 100644 --- a/packages/website/src/components/SplitPane/ConditionalSplitPane.tsx +++ b/packages/website/src/components/SplitPane/ConditionalSplitPane.tsx @@ -1,19 +1,17 @@ +import { useWindowSize } from '@docusaurus/theme-common'; import clsx from 'clsx'; import React from 'react'; import SplitPane, { type SplitPaneProps } from 'react-split-pane'; import splitPaneStyles from './SplitPane.module.css'; -export interface ConditionalSplitPaneProps { - render: boolean; -} - function ConditionalSplitPane({ - render, children, ...props -}: ConditionalSplitPaneProps & SplitPaneProps): JSX.Element { - return render ? ( +}: SplitPaneProps): React.JSX.Element { + const windowSize = useWindowSize(); + + return windowSize !== 'mobile' ? ( (value: T, filter?: ESQuery.Selector): T | T[] { + try { + if (window.esquery && filter) { + // @ts-expect-error - esquery requires js ast types + return window.esquery.match(value, filter); + } + } catch (e: unknown) { + console.error(e); + } + return value; +} function ASTViewer({ - position, + cursorPosition, + onHoverNode, value, - onSelectNode, -}: ASTViewerProps): JSX.Element { - const [selection, setSelection] = useState(null); + filter, + enableScrolling, + hideCopyButton, + showTokens, +}: ASTViewerProps): React.JSX.Element { + const model = useMemo(() => { + if (filter) { + return tryToApplyFilter(value, filter); + } + return value; + }, [value, filter]); + + const selectedPath = useMemo(() => { + if (cursorPosition == null || !model || typeof model !== 'object') { + return 'ast'; + } + return findSelectionPath(model, cursorPosition).path.join('.'); + }, [cursorPosition, model]); useEffect(() => { - setSelection( - position - ? { - line: position.lineNumber, - column: position.column - 1, - } - : null, - ); - }, [position]); - - return typeof value === 'string' ? ( -
{value}
- ) : ( + if (enableScrolling) { + const delayed = debounce(() => { + const htmlElement = document.querySelector( + `div[data-level="${selectedPath}"] > a`, + ); + if (htmlElement) { + scrollIntoViewIfNeeded(htmlElement); + } + }, 100); + delayed(); + } + }, [selectedPath, enableScrolling]); + + return (
- + {!hideCopyButton && }
); } diff --git a/packages/website/src/components/ast/DataRenderer.tsx b/packages/website/src/components/ast/DataRenderer.tsx new file mode 100644 index 00000000000..8562b1f4ae3 --- /dev/null +++ b/packages/website/src/components/ast/DataRenderer.tsx @@ -0,0 +1,240 @@ +import clsx from 'clsx'; +import React, { useCallback, useEffect, useMemo } from 'react'; + +import { useBool } from '../../hooks/useBool'; +import Tooltip from '../inputs/Tooltip'; +import styles from './ASTViewer.module.css'; +import HiddenItem from './HiddenItem'; +import PropertyName from './PropertyName'; +import PropertyValue from './PropertyValue'; +import type { OnHoverNodeFn, ParentNodeType } from './types'; +import { + filterProperties, + getNodeType, + getRange, + getTooltipLabel, + getTypeName, + isRecord, +} from './utils'; + +export interface JsonRenderProps { + readonly field?: string; + readonly typeName?: string; + readonly nodeType?: ParentNodeType; + readonly value: T; + readonly lastElement?: boolean; + readonly level: string; + readonly onHover?: OnHoverNodeFn; + readonly selectedPath?: string; + readonly showTokens?: boolean; +} + +export interface ExpandableRenderProps + extends JsonRenderProps { + readonly data: [string, unknown][]; + readonly openBracket: string; + readonly closeBracket: string; +} + +function RenderExpandableObject({ + field, + typeName, + nodeType, + data, + lastElement, + openBracket, + closeBracket, + value, + level, + onHover, + selectedPath, + showTokens, +}: ExpandableRenderProps): React.JSX.Element { + const [expanded, toggleExpanded, setExpanded] = useBool( + () => level === 'ast' || !!selectedPath?.startsWith(level), + ); + + const isActive = useMemo( + () => level !== 'ast' && selectedPath === level, + [selectedPath, level], + ); + + const onHoverItem = useCallback( + (hover: boolean): void => { + if (onHover) { + if (hover) { + onHover(getRange(value, nodeType)); + } else { + onHover(undefined); + } + } + }, + [onHover, value, nodeType], + ); + + useEffect(() => { + const shouldOpen = !!selectedPath?.startsWith(level); + if (shouldOpen) { + setExpanded(current => current || shouldOpen); + } + }, [selectedPath, level, setExpanded]); + + const lastIndex = data.length - 1; + + return ( +
+ {field && ( + + )} + {field && : } + {typeName && ( + + )} + {typeName && } + {openBracket} + + {expanded ? ( +
+ {data.map((dataElement, index) => ( + + ))} +
+ ) : ( + + )} + + {closeBracket} + {!lastElement && ,} +
+ ); +} + +function JsonObject( + props: JsonRenderProps>, +): React.JSX.Element { + const computed = useMemo(() => { + const nodeType = getNodeType(props.value); + return { + nodeType: nodeType, + typeName: getTypeName(props.value, nodeType), + value: Object.entries(props.value).filter(item => + filterProperties(item[0], item[1], nodeType, props.showTokens), + ), + }; + }, [props.value, props.showTokens]); + + return ( + + ); +} + +function JsonArray(props: JsonRenderProps): React.JSX.Element { + return ( + + ); +} + +function JsonIterable( + props: JsonRenderProps>, +): React.JSX.Element { + return ( + + ); +} + +function JsonPrimitiveValue({ + field, + value, + nodeType, + lastElement, +}: JsonRenderProps): React.JSX.Element { + const tooltip = useMemo(() => { + if (field && nodeType) { + return getTooltipLabel(value, field, nodeType); + } + return undefined; + }, [value, field, nodeType]); + + return ( +
+ {field && {field}: } + {tooltip ? ( + + + + ) : ( + + )} + {!lastElement && ,} +
+ ); +} + +export default function DataRender( + props: JsonRenderProps, +): React.JSX.Element { + const value = props.value; + + if (Array.isArray(value)) { + return ; + } + + if (isRecord(value)) { + return ; + } + + if (value instanceof Map) { + return ; + } + + if (value instanceof Set) { + return ; + } + + return ; +} diff --git a/packages/website/src/components/ast/Elements.tsx b/packages/website/src/components/ast/Elements.tsx deleted file mode 100644 index b8a9d7c823c..00000000000 --- a/packages/website/src/components/ast/Elements.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import React, { useCallback, useEffect, useState } from 'react'; - -import styles from './ASTViewer.module.css'; -import HiddenItem from './HiddenItem'; -import ItemGroup from './ItemGroup'; -import { SimpleItem } from './SimpleItem'; -import type { - ASTViewerModelMap, - ASTViewerModelMapComplex, - ASTViewerModelMapSimple, - GenericParams, -} from './types'; -import { hasChildInRange, isArrayInRange, isInRange } from './utils'; - -export function ComplexItem({ - data, - onSelectNode, - level, - selection, -}: GenericParams): JSX.Element { - const [isExpanded, setIsExpanded] = useState(() => level === 'ast'); - const [isSelected, setIsSelected] = useState(false); - - const onHover = useCallback( - (state: boolean) => { - if (onSelectNode) { - const range = data.model.range; - if (range) { - onSelectNode(state ? range : null); - } - } - }, - [data.model.range, onSelectNode], - ); - - useEffect(() => { - const selected = selection - ? data.model.type === 'array' - ? isArrayInRange(selection, data.model) - : isInRange(selection, data.model) - : false; - - setIsSelected( - level !== 'ast' && selected && !hasChildInRange(selection, data.model), - ); - - if (selected) { - setIsExpanded(selected); - } - }, [selection, data, level]); - - return ( - setIsExpanded(!isExpanded)} - > - {data.model.type === 'array' ? '[' : '{'} - {isExpanded ? ( -
- {data.model.value.map((item, index) => ( - - ))} -
- ) : ( - - )} - {data.model.type === 'array' ? ']' : '}'} -
- ); -} - -export function ElementItem({ - level, - selection, - data, - onSelectNode, -}: GenericParams): JSX.Element { - if (data.model.type === 'array' || data.model.type === 'object') { - return ( - - ); - } else { - return ( - - ); - } -} diff --git a/packages/website/src/components/ast/HiddenItem.tsx b/packages/website/src/components/ast/HiddenItem.tsx index f309bff4a55..500f017bf9c 100644 --- a/packages/website/src/components/ast/HiddenItem.tsx +++ b/packages/website/src/components/ast/HiddenItem.tsx @@ -2,10 +2,9 @@ import React, { useEffect, useState } from 'react'; import styles from './ASTViewer.module.css'; import PropertyValue from './PropertyValue'; -import type { ASTViewerModelMap } from './types'; export interface HiddenItemProps { - readonly value: ASTViewerModelMap[]; + readonly value: [string, unknown][]; readonly level: string; readonly isArray?: boolean; } @@ -14,14 +13,14 @@ export default function HiddenItem({ value, level, isArray, -}: HiddenItemProps): JSX.Element { +}: HiddenItemProps): React.JSX.Element { const [isComplex, setIsComplex] = useState(true); const [length, setLength] = useState(0); useEffect(() => { if (isArray) { - const filtered = value.filter(item => !isNaN(Number(item.key))); - setIsComplex(filtered.some(item => item.model.type !== 'number')); + const filtered = value.filter(([key]) => !isNaN(Number(key))); + setIsComplex(filtered.some(([, item]) => typeof item !== 'number')); setLength(filtered.length); } }, [value, isArray]); @@ -29,7 +28,7 @@ export default function HiddenItem({ return ( {isArray && !isComplex ? ( - value.map((item, index) => ( + value.map(([, item], index) => ( {index > 0 && ', '} @@ -40,10 +39,10 @@ export default function HiddenItem({ {length} {length === 1 ? 'element' : 'elements'} ) : ( - value.map((item, index) => ( + value.map(([key], index) => ( {index > 0 && ', '} - {String(item.key)} + {String(key)} )) )} diff --git a/packages/website/src/components/ast/ItemGroup.tsx b/packages/website/src/components/ast/ItemGroup.tsx deleted file mode 100644 index 295037c9bfa..00000000000 --- a/packages/website/src/components/ast/ItemGroup.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { scrollIntoViewIfNeeded } from '@site/src/components/lib/scroll-into'; -import clsx from 'clsx'; -import type { MouseEvent } from 'react'; -import React, { useEffect, useRef } from 'react'; - -import styles from './ASTViewer.module.css'; -import PropertyName from './PropertyName'; -import type { ASTViewerModelMap } from './types'; - -export interface ItemGroupProps { - readonly data: ASTViewerModelMap; - readonly isSelected?: boolean; - readonly isExpanded?: boolean; - readonly canExpand?: boolean; - readonly onClick?: (e: MouseEvent) => void; - readonly onHover?: (e: boolean) => void; - readonly children: JSX.Element | false | (JSX.Element | false)[]; -} - -export default function ItemGroup({ - data, - isSelected, - isExpanded, - canExpand, - onClick, - onHover, - children, -}: ItemGroupProps): JSX.Element { - const listItem = useRef(null); - - useEffect(() => { - if (listItem.current && isSelected) { - scrollIntoViewIfNeeded(listItem.current); - } - }, [isSelected, listItem]); - - return ( -
- - {React.Children.map(children, child => child)} -
- ); -} diff --git a/packages/website/src/components/ast/PropertyName.tsx b/packages/website/src/components/ast/PropertyName.tsx index 5b8afce5d30..8943f57c0d0 100644 --- a/packages/website/src/components/ast/PropertyName.tsx +++ b/packages/website/src/components/ast/PropertyName.tsx @@ -1,72 +1,58 @@ import Link from '@docusaurus/Link'; -import type { MouseEvent } from 'react'; +import type { KeyboardEvent, MouseEvent } from 'react'; import React, { useCallback } from 'react'; -import styles from './ASTViewer.module.css'; - export interface PropertyNameProps { - readonly typeName?: string; - readonly propName?: string; - readonly onClick?: (e: MouseEvent) => void; + readonly value?: string; + readonly onClick?: () => void; readonly onHover?: (e: boolean) => void; + readonly className?: string; } -export default function PropertyName(props: PropertyNameProps): JSX.Element { - const { onClick: onClickProps, onHover } = props; - +export default function PropertyName({ + onClick: onClickProp, + onHover: onHoverProp, + className, + value, +}: PropertyNameProps): React.JSX.Element { const onClick = useCallback( (e: MouseEvent) => { e.preventDefault(); - onClickProps?.(e); + onClickProp?.(); }, - [onClickProps], + [onClickProp], ); const onMouseEnter = useCallback(() => { - onHover?.(true); - }, [onHover]); + onHoverProp?.(true); + }, [onHoverProp]); const onMouseLeave = useCallback(() => { - onHover?.(false); - }, [onHover]); + onHoverProp?.(false); + }, [onHoverProp]); + + const onKeyDown = useCallback( + (e: KeyboardEvent) => { + if (e.code === 'Space') { + e.preventDefault(); + onClickProp?.(); + } + }, + [onClickProp], + ); - return props.onClick || props.onHover ? ( - <> - {props.propName && ( - - {props.propName} - - )} - {props.propName && : } - {props.typeName && ( - - {props.typeName} - - )} - {props.typeName && } - - ) : ( - <> - {props.propName && ( - {props.propName} - )} - {props.propName && : } - {props.typeName && ( - {props.typeName} - )} - {props.typeName && } - + return ( + + {value} + ); } diff --git a/packages/website/src/components/ast/PropertyValue.tsx b/packages/website/src/components/ast/PropertyValue.tsx index 9f8061d9b0c..f3541a593b4 100644 --- a/packages/website/src/components/ast/PropertyValue.tsx +++ b/packages/website/src/components/ast/PropertyValue.tsx @@ -1,34 +1,88 @@ -import React from 'react'; +import Link from '@docusaurus/Link'; +import React, { useMemo, useState } from 'react'; import styles from './ASTViewer.module.css'; -import type { ASTViewerModelMap } from './types'; +import { objType } from './utils'; export interface PropertyValueProps { - readonly value: ASTViewerModelMap; + readonly value: unknown; } -function PropertyValue({ value }: PropertyValueProps): JSX.Element { - switch (value.model.type) { - case 'string': - return {value.model.value}; - case 'bigint': - return {value.model.value}; - case 'number': - return {value.model.value}; - case 'regexp': - return {value.model.value}; - case 'undefined': - return {value.model.value}; - case 'boolean': - return {value.model.value}; - case 'array': - case 'object': - return {value.key}; - case 'class': - case 'ref': - default: - return {value.model.value}; +interface SimpleModel { + readonly value: string; + readonly className: string; + readonly shortValue?: string; +} + +function getSimpleModel(data: unknown): SimpleModel { + if (typeof data === 'string') { + const value = JSON.stringify(data); + return { + value, + className: styles.propString, + shortValue: value.length > 250 ? value.substring(0, 200) : undefined, + }; + } else if (typeof data === 'number') { + return { + value: String(data), + className: styles.propNumber, + }; + } else if (typeof data === 'bigint') { + return { + value: `${data}n`, + className: styles.propNumber, + }; + } else if (data instanceof RegExp) { + return { + value: String(data), + className: styles.propRegExp, + }; + } else if (data == null) { + return { + value: String(data), + className: styles.propEmpty, + }; + } else if (typeof data === 'boolean') { + return { + value: data ? 'true' : 'false', + className: styles.propBoolean, + }; + } else if (data instanceof Error) { + return { + value: `Error: ${data.message}`, + className: styles.propError, + }; + } + return { + value: objType(data), + className: styles.propClass, + }; +} + +function PropertyValue({ value }: PropertyValueProps): React.JSX.Element { + const [expand, setExpand] = useState(false); + + const model = useMemo(() => getSimpleModel(value), [value]); + + if (model.shortValue) { + return ( + + {!expand ? `${model.shortValue}...` : model.value}{' '} + { + e.preventDefault(); + setExpand(expand => !expand); + }} + href="#read-more" + className={styles.propEllipsis} + > + {!expand ? '(read more)' : '(read less)'} + + + ); } + + return {model.value}; } export default PropertyValue; diff --git a/packages/website/src/components/ast/SimpleItem.tsx b/packages/website/src/components/ast/SimpleItem.tsx deleted file mode 100644 index 23a25a8a57d..00000000000 --- a/packages/website/src/components/ast/SimpleItem.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import Tooltip from '@site/src/components/inputs/Tooltip'; -import React, { useCallback } from 'react'; - -import ItemGroup from './ItemGroup'; -import PropertyValue from './PropertyValue'; -import type { ASTViewerModelMapSimple, OnSelectNodeFn } from './types'; - -export interface SimpleItemProps { - readonly data: ASTViewerModelMapSimple; - readonly onSelectNode?: OnSelectNodeFn; -} - -export function SimpleItem({ - data, - onSelectNode, -}: SimpleItemProps): JSX.Element { - const onHover = useCallback( - (state: boolean) => { - if (onSelectNode && data.model.range) { - onSelectNode(state ? data.model.range : null); - } - }, - [data.model.range, onSelectNode], - ); - - return ( - - {data.model.tooltip ? ( - - - - ) : ( - - )} - - ); -} diff --git a/packages/website/src/components/ast/selectedRange.ts b/packages/website/src/components/ast/selectedRange.ts new file mode 100644 index 00000000000..4fa89b843a5 --- /dev/null +++ b/packages/website/src/components/ast/selectedRange.ts @@ -0,0 +1,93 @@ +import type { ParentNodeType } from './types'; +import { filterProperties, isESNode, isRecord, isTSNode } from './utils'; + +function isInRange(offset: number, value: object): boolean { + const range = getRangeFromNode(value); + return !!range && offset > range[0] && offset <= range[1]; +} + +function geNodeType(value: unknown): ParentNodeType { + if (isRecord(value)) { + return isESNode(value) ? 'esNode' : isTSNode(value) ? 'tsNode' : undefined; + } + return undefined; +} + +function isIterable(key: string, value: unknown): boolean { + return filterProperties(key, value, geNodeType(value)); +} + +function getRangeFromNode(value: object): [number, number] | null { + if (isESNode(value)) { + return value.range; + } else if (isTSNode(value)) { + return [value.pos, value.end]; + } + return null; +} + +function findInObject( + iter: object, + cursorPosition: number, + visited: Set, +): { + key: string[]; + value: object; +} | null { + const children = Object.entries(iter); + for (const [name, child] of children) { + // we do not want to select parents in case if we do filter with esquery + if (visited.has(child) || name === 'parent' || !isIterable(name, child)) { + continue; + } + visited.add(iter); + + if (isRecord(child)) { + if (isInRange(cursorPosition, child)) { + return { + key: [name], + value: child, + }; + } + } else if (Array.isArray(child)) { + for (let index = 0; index < child.length; ++index) { + const arrayChild: unknown = child[index]; + // typescript array like elements have other iterable items + if (typeof index === 'number' && isRecord(arrayChild)) { + if (isInRange(cursorPosition, arrayChild)) { + return { + key: [name, String(index)], + value: arrayChild, + }; + } + } + } + } + } + return null; +} + +export function findSelectionPath( + node: object, + cursorPosition: number, +): { path: string[]; node: object | null } { + const nodePath = ['ast']; + const visited = new Set(); + let currentNode: object | null = node; + while (currentNode) { + // infinite loop guard + if (visited.has(currentNode)) { + break; + } + visited.add(currentNode); + + const result = findInObject(currentNode, cursorPosition, visited); + if (result) { + currentNode = result.value; + nodePath.push(...result.key); + } else { + return { path: nodePath, node: currentNode }; + } + } + return { path: nodePath, node: null }; +} diff --git a/packages/website/src/components/ast/serializer/serializer.ts b/packages/website/src/components/ast/serializer/serializer.ts deleted file mode 100644 index f6c75be3302..00000000000 --- a/packages/website/src/components/ast/serializer/serializer.ts +++ /dev/null @@ -1,99 +0,0 @@ -import type { - ASTViewerModelMap, - ASTViewerModelSimple, - Serializer, -} from '../types'; -import { isRecord, objType } from '../utils'; - -function getSimpleModel(data: unknown): ASTViewerModelSimple { - if (typeof data === 'string') { - return { - value: JSON.stringify(data), - type: 'string', - }; - } else if (typeof data === 'number') { - return { - value: String(data), - type: 'number', - }; - } else if (typeof data === 'bigint') { - return { - value: `${data}n`, - type: 'bigint', - }; - } else if (data instanceof RegExp) { - return { - value: String(data), - type: 'regexp', - }; - } else if (data == null) { - return { - value: String(data), - type: 'undefined', - }; - } else if (typeof data === 'boolean') { - return { - value: data ? 'true' : 'false', - type: 'boolean', - }; - } - return { - value: objType(data), - type: 'class', - }; -} - -export function serialize( - data: unknown, - serializer?: Serializer, -): ASTViewerModelMap { - function processValue( - data: [string, unknown][], - tooltip?: (data: ASTViewerModelMap) => string | undefined, - ): ASTViewerModelMap[] { - let result = data - .filter(item => !item[0].startsWith('_') && item[1] !== undefined) - .map(item => _serialize(item[1], item[0])); - if (tooltip) { - result = result.map(item => { - item.model.tooltip = tooltip(item); - return item; - }); - } - return result; - } - - function _serialize(data: unknown, key?: string): ASTViewerModelMap { - if (isRecord(data)) { - const serialized = serializer - ? serializer(data, key, processValue) - : undefined; - if (serialized) { - return { key, model: serialized }; - } - return { - key, - model: { - value: processValue(Object.entries(data)), - type: 'object', - }, - }; - } else if (Array.isArray(data)) { - return { - key, - model: { - value: processValue(Object.entries(data)), - type: 'array', - }, - }; - } - - if (typeof data === 'function' && key) { - return { key: `${key}()`, model: getSimpleModel(data()) }; - } - - return { key, model: getSimpleModel(data) }; - } - - return _serialize(data); -} diff --git a/packages/website/src/components/ast/serializer/serializerESTree.ts b/packages/website/src/components/ast/serializer/serializerESTree.ts deleted file mode 100644 index d88af8955d9..00000000000 --- a/packages/website/src/components/ast/serializer/serializerESTree.ts +++ /dev/null @@ -1,35 +0,0 @@ -import type { TSESTree } from '@typescript-eslint/utils'; - -import type { ASTViewerModel, Serializer } from '../types'; -import { isRecord } from '../utils'; - -export const propsToFilter = ['parent', 'comments', 'tokens']; - -function isESTreeNode( - value: unknown, -): value is Record & TSESTree.BaseNode { - return isRecord(value) && 'type' in value && 'loc' in value; -} - -export function createESTreeSerializer(): Serializer { - return function serializer( - data, - _key, - processValue, - ): ASTViewerModel | undefined { - if (isESTreeNode(data)) { - return { - range: { - start: data.loc.start, - end: data.loc.end, - }, - type: 'object', - name: String(data.type), - value: processValue( - Object.entries(data).filter(item => !propsToFilter.includes(item[0])), - ), - }; - } - return undefined; - }; -} diff --git a/packages/website/src/components/ast/serializer/serializerScope.ts b/packages/website/src/components/ast/serializer/serializerScope.ts deleted file mode 100644 index c41021da99a..00000000000 --- a/packages/website/src/components/ast/serializer/serializerScope.ts +++ /dev/null @@ -1,204 +0,0 @@ -import type { TSESTree } from '@typescript-eslint/utils'; - -import type { ASTViewerModel, SelectedRange, Serializer } from '../types'; -import { isRecord } from '../utils'; - -function isESTreeNode( - value: unknown, -): value is Record & TSESTree.Node { - return Boolean(value) && isRecord(value) && 'type' in value && 'loc' in value; -} - -function getClassName(value: Record): string { - // eslint-disable-next-line @typescript-eslint/ban-types - return (Object.getPrototypeOf(value) as Object).constructor.name.replace( - /\$[0-9]+$/, - '', - ); -} - -function getNodeName( - className: string, - data: Record, -): string | undefined { - const id = data.$id != null ? `$${String(data.$id)}` : ''; - - if (className === 'ImplicitLibVariable' && data.name === 'const') { - className = 'ImplicitGlobalConstTypeVariable'; - } - - return `${className}${id}`; -} - -function getRange(value: Record): SelectedRange | undefined { - if (isESTreeNode(value.block)) { - return { - start: value.block.loc.start, - end: value.block.loc.end, - }; - } else if (isESTreeNode(value.identifier)) { - return { - start: { ...value.identifier.loc.start }, - end: { ...value.identifier.loc.end }, - }; - } else if (isESTreeNode(value.node)) { - return { - start: { ...value.node.loc.start }, - end: { ...value.node.loc.end }, - }; - } else if ( - Array.isArray(value.identifiers) && - value.identifiers.length > 0 && - isESTreeNode(value.identifiers[0]) - ) { - return { - start: { ...value.identifiers[0].loc.start }, - end: { ...value.identifiers[0].loc.end }, - }; - } - - return undefined; -} - -type NodeType = - | 'Scope' - | 'Definition' - | 'Variable' - | 'ScopeManager' - | 'Reference'; - -function getNodeType(nodeName: string | undefined): NodeType | undefined { - if (nodeName) { - if (nodeName === 'ScopeManager') { - return 'ScopeManager'; - } else if (nodeName.endsWith('Scope')) { - return 'Scope'; - } else if (nodeName.endsWith('Definition')) { - return 'Definition'; - } else if (nodeName === 'Variable' || nodeName === 'ImplicitLibVariable') { - return 'Variable'; - } else if (nodeName === 'Reference') { - return 'Reference'; - } - } - return undefined; -} - -function getProps(nodeType: NodeType | undefined): string[] | undefined { - switch (nodeType) { - case 'ScopeManager': - return ['scopes', 'globalScope', 'variables']; - case 'Scope': - return [ - 'block', - 'isStrict', - 'references', - 'through', - 'set', - 'type', - 'variables', - 'variableScope', - 'functionExpressionScope', - 'childScopes', - 'upper', - ]; - case 'Definition': - return [ - 'name', - 'type', - 'node', - 'isTypeDefinition', - 'isVariableDefinition', - 'rest', - 'parent', - ]; - case 'Reference': - return [ - 'init', - 'identifier', - 'from', - 'isTypeReference', - 'isValueReference', - 'maybeImplicitGlobal', - 'isRead', - 'isWrite', - 'resolved', - 'writeExpr', - ]; - case 'Variable': - return [ - 'name', - 'identifiers', - 'references', - 'defs', - 'eslintUsed', - 'tainted', - 'scope', - 'isValueVariable', - 'isTypeVariable', - 'writeable', - ]; - } - return undefined; -} - -export function createScopeSerializer(): Serializer { - const SEEN_THINGS = new Map(); - - return function serializer( - data, - _key, - processValue, - ): ASTViewerModel | undefined { - const className = getClassName(data); - - if (className !== 'Object') { - const nodeName = getNodeName(className, data); - const nodeType = getNodeType(className); - const value = data.name != null ? `<"${String(data.name)}">` : ''; - - const uniqName = `${nodeName}${value}`; - - if (SEEN_THINGS.has(uniqName)) { - return SEEN_THINGS.get(uniqName); - } - - const result: ASTViewerModel = { - range: getRange(data), - type: 'object', - name: nodeName, - value: [], - }; - SEEN_THINGS.set(uniqName, result); - - let values: [string, unknown][]; - - const props = getProps(nodeType); - if (props) { - values = props.map(key => { - const res = data[key]; - return [key, typeof res === 'function' ? res.bind(data) : res]; - }); - } else { - values = Object.entries(data); - } - - result.value = processValue(values); - return result; - } - - if (isESTreeNode(data)) { - return { - type: 'ref', - name: data.type, - range: { - start: { ...data.loc.start }, - end: { ...data.loc.end }, - }, - value: data.type === 'Identifier' ? `<"${data.name}">` : '', - }; - } - - return undefined; - }; -} diff --git a/packages/website/src/components/ast/serializer/serializerTS.ts b/packages/website/src/components/ast/serializer/serializerTS.ts deleted file mode 100644 index fe00cbb55d1..00000000000 --- a/packages/website/src/components/ast/serializer/serializerTS.ts +++ /dev/null @@ -1,154 +0,0 @@ -import type { Node, SourceFile, Symbol as TSSymbol, Type } from 'typescript'; - -import type { ASTViewerModel, SelectedPosition, Serializer } from '../types'; -import { isRecord } from '../utils'; - -export function getLineAndCharacterFor( - pos: number, - ast: SourceFile, -): SelectedPosition { - const loc = ast.getLineAndCharacterOfPosition(pos); - return { - line: loc.line + 1, - column: loc.character, - }; -} - -export const propsToFilter = [ - 'parent', - 'nextContainer', - 'jsDoc', - 'jsDocComment', - 'lineMap', - 'externalModuleIndicator', - 'setExternalModuleIndicator', - 'bindDiagnostics', - 'transformFlags', - 'resolvedModules', - 'imports', - 'antecedent', - 'antecedents', -]; - -function isTsNode(value: unknown): value is Node { - return isRecord(value) && typeof value.kind === 'number'; -} - -function isTsType(value: unknown): value is Type { - return isRecord(value) && value.getBaseTypes != null; -} - -function isTsSymbol(value: unknown): value is TSSymbol { - return isRecord(value) && value.getDeclarations != null; -} - -function expandFlags( - allFlags: [string, Record], - flags: number, -): string { - return Object.entries(allFlags[1]) - .filter(([f, _]) => (Number(f) & flags) !== 0) - .map(([_, name]) => `${allFlags[0]}.${name}`) - .join('\n'); -} - -function prepareValue(data: Record): [string, unknown][] { - return Object.entries(data).filter(item => !propsToFilter.includes(item[0])); -} - -export function createTsSerializer( - root: SourceFile, - syntaxKind: Record, - nodeFlags: [string, Record], - tokenFlags: [string, Record], - modifierFlags: [string, Record], - objectFlags: [string, Record], - symbolFlags: [string, Record], - flowFlags: [string, Record], - typeFlags: [string, Record], -): Serializer { - const SEEN_THINGS = new WeakMap, ASTViewerModel>(); - - return function serializer( - data, - key, - processValue, - ): ASTViewerModel | undefined { - if (root) { - if (isTsNode(data)) { - if (SEEN_THINGS.has(data)) { - return SEEN_THINGS.get(data); - } - - const nodeName = syntaxKind[data.kind]; - - const result: ASTViewerModel = { - range: { - start: getLineAndCharacterFor(data.pos, root), - end: getLineAndCharacterFor(data.end, root), - }, - type: 'object', - name: nodeName, - value: [], - }; - - SEEN_THINGS.set(data, result); - - result.value = processValue(prepareValue(data), item => { - if (item.model.type === 'number') { - switch (item.key) { - case 'flags': - return expandFlags(nodeFlags, Number(item.model.value)); - case 'numericLiteralFlags': - return expandFlags(tokenFlags, Number(item.model.value)); - case 'modifierFlagsCache': - return expandFlags(modifierFlags, Number(item.model.value)); - case 'kind': - return `SyntaxKind.${syntaxKind[Number(item.model.value)]}`; - } - } - return undefined; - }); - return result; - } else if (isTsType(data)) { - return { - type: 'object', - name: '[Type]', - value: processValue(prepareValue(data), item => { - if (item.model.type === 'number') { - if (item.key === 'objectFlags') { - return expandFlags(objectFlags, Number(item.model.value)); - } else if (item.key === 'flags') { - return expandFlags(typeFlags, Number(item.model.value)); - } - } - return undefined; - }), - }; - } else if (isTsSymbol(data)) { - return { - type: 'object', - name: '[Symbol]', - value: processValue(prepareValue(data), item => { - if (item.model.type === 'number' && item.key === 'flags') { - return expandFlags(symbolFlags, Number(item.model.value)); - } - return undefined; - }), - }; - } else if (key === 'flowNode' || key === 'endFlowNode') { - return { - type: 'object', - name: '[FlowNode]', - value: processValue(prepareValue(data), item => { - if (item.model.type === 'number' && item.key === 'flags') { - return expandFlags(flowFlags, Number(item.model.value)); - } - return undefined; - }), - }; - } - } - return undefined; - }; -} diff --git a/packages/website/src/components/ast/tsUtils.ts b/packages/website/src/components/ast/tsUtils.ts new file mode 100644 index 00000000000..6d4232a58c7 --- /dev/null +++ b/packages/website/src/components/ast/tsUtils.ts @@ -0,0 +1,86 @@ +interface TsParsedEnums { + SyntaxKind: Record; + NodeFlags: Record; + TokenFlags: Record; + ModifierFlags: Record; + ObjectFlags: Record; + SymbolFlags: Record; + FlowFlags: Record; + TypeFlags: Record; + ScriptKind: Record; + TransformFlags: Record; + ScriptTarget: Record; + LanguageVariant: Record; +} + +/** + * Extract the enum values from the TypeScript enum. + * typescript enum's have duplicates, and we always want to take first one. + * e.g. SyntaxKind.EqualsToken = 63, SyntaxKind.FirstAssignment = 63 + */ +export function extractEnum( + obj: Record, +): Record { + const result: Record = {}; + const keys = Object.entries(obj); + for (const [name, value] of keys) { + if (typeof value === 'number') { + if (!(value in result)) { + result[value] = name; + } + } + } + return result; +} + +let tsEnumCache: TsParsedEnums | undefined; + +/** + * Get the TypeScript enum values. + */ +function getTsEnum(type: keyof TsParsedEnums): Record { + tsEnumCache ??= { + SyntaxKind: extractEnum(window.ts.SyntaxKind), + NodeFlags: extractEnum(window.ts.NodeFlags), + TokenFlags: extractEnum(window.ts.TokenFlags), + ModifierFlags: extractEnum(window.ts.ModifierFlags), + ObjectFlags: extractEnum(window.ts.ObjectFlags), + SymbolFlags: extractEnum(window.ts.SymbolFlags), + FlowFlags: extractEnum(window.ts.FlowFlags), + TypeFlags: extractEnum(window.ts.TypeFlags), + ScriptKind: extractEnum(window.ts.ScriptKind), + ScriptTarget: extractEnum(window.ts.ScriptTarget), + LanguageVariant: extractEnum(window.ts.LanguageVariant), + // @ts-expect-error: non public API + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + TransformFlags: extractEnum(window.ts.TransformFlags), + }; + return tsEnumCache[type]; +} + +/** + * Convert a TypeScript enum value to a string. + */ +export function tsEnumToString( + type: keyof TsParsedEnums, + value: number, +): string | undefined { + return getTsEnum(type)?.[value]; +} + +/** + * Convert a TypeScript enum flag value to a concatenated string of the flags. + */ +export function tsEnumFlagToString( + type: keyof TsParsedEnums, + value: number, +): string | undefined { + const allFlags = getTsEnum(type); + if (allFlags) { + return Object.entries(allFlags) + .filter(([f]) => (Number(f) & value) !== 0) + .map(([, name]) => `${type}.${name}`) + .join('\n'); + } + return ''; +} diff --git a/packages/website/src/components/ast/types.ts b/packages/website/src/components/ast/types.ts index 7711d597344..308a2ba9525 100644 --- a/packages/website/src/components/ast/types.ts +++ b/packages/website/src/components/ast/types.ts @@ -1,70 +1,15 @@ -import type Monaco from 'monaco-editor'; - -import type { SelectedPosition, SelectedRange } from '../types'; - -export type OnSelectNodeFn = (node: SelectedRange | null) => void; - -export type ASTViewerModelTypeSimple = - | 'ref' - | 'string' - | 'number' - | 'class' - | 'boolean' - | 'bigint' - | 'regexp' - | 'undefined'; - -export type ASTViewerModelTypeComplex = 'object' | 'array'; - -export interface ASTViewerModelBase { - name?: string; - range?: SelectedRange; - tooltip?: string; -} - -export interface ASTViewerModelSimple extends ASTViewerModelBase { - type: ASTViewerModelTypeSimple; - value: string; -} - -export interface ASTViewerModelComplex extends ASTViewerModelBase { - type: ASTViewerModelTypeComplex; - value: ASTViewerModelMap[]; -} - -export type ASTViewerModel = ASTViewerModelSimple | ASTViewerModelComplex; - -export interface ASTViewerModelMap { - key?: string; - model: T; -} - -export type ASTViewerModelMapSimple = ASTViewerModelMap; -export type ASTViewerModelMapComplex = ASTViewerModelMap; - -export interface GenericParams { - readonly data: V; - readonly level: string; - readonly selection?: SelectedPosition | null; - readonly onSelectNode?: OnSelectNodeFn; -} - -export interface ASTViewerBaseProps { - readonly position?: Monaco.Position | null; - readonly onSelectNode?: OnSelectNodeFn; -} - -export interface ASTViewerProps extends ASTViewerBaseProps { - readonly value: ASTViewerModelMap | string; -} - -export type Serializer = ( - data: Record, - key: string | undefined, - processValue: ( - data: [string, unknown][], - tooltip?: (data: ASTViewerModelMap) => string | undefined, - ) => ASTViewerModelMap[], -) => ASTViewerModel | undefined; - -export type { SelectedPosition, SelectedRange }; +export type OnHoverNodeFn = (node?: [number, number]) => void; + +export type ParentNodeType = + | 'esNode' + | 'scope' + | 'scopeDefinition' + | 'scopeManager' + | 'scopeReference' + | 'scopeVariable' + | 'tsFlow' + | 'tsNode' + | 'tsSignature' + | 'tsSymbol' + | 'tsType' + | undefined; diff --git a/packages/website/src/components/ast/utils.ts b/packages/website/src/components/ast/utils.ts index de55a5c0720..41b531f87bb 100644 --- a/packages/website/src/components/ast/utils.ts +++ b/packages/website/src/components/ast/utils.ts @@ -1,22 +1,8 @@ -import type { - ASTViewerModel, - ASTViewerModelComplex, - SelectedPosition, - SelectedRange, -} from './types'; +import type { TSESTree } from '@typescript-eslint/utils'; +import type * as ts from 'typescript'; -export function isWithinRange( - loc: SelectedPosition, - range: SelectedRange, -): boolean { - const canStart = - range.start.line < loc.line || - (range.start.line === loc.line && range.start.column < loc.column); - const canEnd = - range.end.line > loc.line || - (range.end.line === loc.line && range.end.column >= loc.column); - return canStart && canEnd; -} +import { tsEnumFlagToString, tsEnumToString } from './tsUtils'; +import type { ParentNodeType } from './types'; export function objType(obj: unknown): string { const type = Object.prototype.toString.call(obj).slice(8, -1); @@ -31,37 +17,247 @@ export function isRecord(value: unknown): value is Record { return objType(value) === 'Object'; } -export function isInRange( - position: SelectedPosition | null | undefined, - value: ASTViewerModel, -): boolean { - if (!position || !value.range) { - return false; +export function isESNode(value: object): value is TSESTree.BaseNode { + return 'type' in value && 'loc' in value && 'range' in value; +} + +export function isTSNode(value: object): value is ts.Node { + return 'kind' in value && 'pos' in value && 'flags' in value; +} + +export function getNodeType(value: unknown): ParentNodeType { + if (Boolean(value) && isRecord(value)) { + if (isESNode(value)) { + return 'esNode'; + } else if ('$id' in value && 'childScopes' in value && 'type' in value) { + return 'scope'; + } else if ( + 'scopes' in value && + 'nodeToScope' in value && + 'declaredVariables' in value + ) { + return 'scopeManager'; + } else if ( + 'references' in value && + 'identifiers' in value && + 'name' in value + ) { + return 'scopeVariable'; + } else if ('$id' in value && 'type' in value && 'node' in value) { + return 'scopeDefinition'; + } else if ( + '$id' in value && + 'resolved' in value && + 'identifier' in value && + 'from' in value + ) { + return 'scopeReference'; + } else if ('kind' in value && 'pos' in value && 'flags' in value) { + return 'tsNode'; + } else if ('getSymbol' in value) { + return 'tsType'; + } else if ('getDeclarations' in value && value.getDeclarations != null) { + return 'tsSymbol'; + } else if ('getParameters' in value && value.getParameters != null) { + return 'tsSignature'; + } else if ( + 'flags' in value && + ('antecedent' in value || 'antecedents' in value || 'consequent' in value) + ) { + return 'tsFlow'; + } } - return isWithinRange(position, value.range); + return undefined; } -export function isArrayInRange( - position: SelectedPosition | null | undefined, - value: ASTViewerModelComplex, -): boolean { - return Boolean( - position && value.value.some(item => isInRange(position, item.model)), - ); +export function ucFirst(value: string): string { + if (value.length > 0) { + return value.slice(0, 1).toUpperCase() + value.slice(1, value.length); + } + return value; } -export function hasChildInRange( - position: SelectedPosition | null | undefined, - value: ASTViewerModelComplex, +export function getTypeName( + value: Record, + valueType: ParentNodeType, +): string | undefined { + switch (valueType) { + case 'esNode': + return String(value.type); + case 'tsNode': + return tsEnumToString('SyntaxKind', Number(value.kind)); + case 'scopeManager': + return 'ScopeManager'; + case 'scope': + return `${ucFirst(String(value.type))}Scope$${String(value.$id)}`; + case 'scopeDefinition': + return `Definition#${String(value.type)}$${String(value.$id)}`; + case 'scopeVariable': + return `Variable#${String(value.name)}$${String(value.$id)}`; + case 'scopeReference': + return `Reference#${String( + isRecord(value.identifier) ? value.identifier.name : 'unknown', + )}$${String(value.$id)}`; + case 'tsType': + return '[Type]'; + case 'tsSymbol': + return `Symbol(${String(value.escapedName)})`; + case 'tsSignature': + return '[Signature]'; + case 'tsFlow': + return '[FlowNode]'; + } + return undefined; +} + +export function getTooltipLabel( + value: unknown, + propName?: string, + parentType?: ParentNodeType, +): string | undefined { + if (typeof value === 'number') { + switch (parentType) { + case 'tsNode': { + switch (propName) { + case 'flags': + return tsEnumFlagToString('NodeFlags', value); + case 'numericLiteralFlags': + return tsEnumFlagToString('TokenFlags', value); + case 'modifierFlagsCache': + return tsEnumFlagToString('ModifierFlags', value); + case 'scriptKind': + return `ScriptKind.${tsEnumToString('ScriptKind', value)}`; + case 'transformFlags': + return tsEnumFlagToString('TransformFlags', value); + case 'kind': + return `SyntaxKind.${tsEnumToString('SyntaxKind', value)}`; + case 'languageVersion': + return `ScriptTarget.${tsEnumToString('ScriptTarget', value)}`; + case 'languageVariant': + return `LanguageVariant.${tsEnumToString( + 'LanguageVariant', + value, + )}`; + } + break; + } + case 'tsType': + if (propName === 'flags') { + return tsEnumFlagToString('TypeFlags', value); + } else if (propName === 'objectFlags') { + return tsEnumFlagToString('ObjectFlags', value); + } + break; + case 'tsSymbol': + if (propName === 'flags') { + return tsEnumFlagToString('SymbolFlags', value); + } + break; + case 'tsFlow': + if (propName === 'flags') { + return tsEnumFlagToString('FlowFlags', value); + } + break; + } + } + return undefined; +} + +function getValidRange(range: unknown): [number, number] | undefined { + if ( + Array.isArray(range) && + typeof range[0] === 'number' && + typeof range[1] === 'number' + ) { + return range as [number, number]; + } + return undefined; +} + +export function getRange( + value: unknown, + valueType?: ParentNodeType, +): [number, number] | undefined { + if (Boolean(value) && isRecord(value)) { + switch (valueType) { + case 'esNode': + return getValidRange(value.range); + case 'tsNode': + return getValidRange([value.pos, value.end]); + case 'scope': + if (isRecord(value.block)) { + return getValidRange(value.block.range); + } + break; + case 'scopeVariable': + if ( + Array.isArray(value.identifiers) && + value.identifiers.length > 0 && + isRecord(value.identifiers[0]) + ) { + return getValidRange(value.identifiers[0].range); + } + break; + case 'scopeDefinition': + if (isRecord(value.node)) { + return getValidRange(value.node.range); + } + break; + case 'scopeReference': + if (isRecord(value.identifier)) { + return getValidRange(value.identifier.range); + } + break; + } + } + return undefined; +} + +export function filterProperties( + key: string, + value: unknown, + type: ParentNodeType, + showTokens?: boolean, ): boolean { - return Boolean( - position && - value.value.some(item => - item.model.type === 'object' - ? isInRange(position, item.model) - : item.model.type === 'array' - ? isArrayInRange(position, item.model) - : false, - ), - ); + if ( + value === undefined || + typeof value === 'function' || + key.startsWith('_') + ) { + return false; + } + + switch (type) { + case 'esNode': { + return key !== 'tokens' || !!showTokens; + } + case 'scopeManager': + return ( + key !== 'declaredVariables' && + key !== 'nodeToScope' && + key !== 'currentScope' + ); + case 'tsNode': + return ( + key !== 'nextContainer' && + key !== 'parseDiagnostics' && + key !== 'bindDiagnostics' && + key !== 'lineMap' && + key !== 'flowNode' && + key !== 'endFlowNode' && + key !== 'jsDocCache' && + key !== 'jsDoc' && + key !== 'symbol' + ); + case 'tsType': + return ( + key !== 'checker' && + key !== 'constructSignatures' && + key !== 'callSignatures' + ); + case 'tsSignature': + return key !== 'checker'; + } + + return true; } diff --git a/packages/website/src/components/config/ConfigEditor.module.css b/packages/website/src/components/config/ConfigEditor.module.css index 93d34e5c308..940c7a825ee 100644 --- a/packages/website/src/components/config/ConfigEditor.module.css +++ b/packages/website/src/components/config/ConfigEditor.module.css @@ -1,7 +1,3 @@ -.search { - border-radius: 0.2rem; -} - .searchResult, .searchResultGroup { align-items: center; @@ -15,7 +11,7 @@ } .searchResult { - margin: 0 0; + margin: 0; transition: background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default), color var(--ifm-transition-fast) var(--ifm-transition-timing-default); @@ -39,6 +35,7 @@ background: var(--ifm-color-emphasis-100); } +.searchResult:nth-child(even):hover, .searchResult:hover { background: var(--ifm-color-emphasis-200); } @@ -61,6 +58,9 @@ column-gap: 0.5rem; margin-bottom: 0.5rem; justify-content: flex-end; + position: sticky; + top: 0; + left: 0; } .textarea { diff --git a/packages/website/src/components/config/ConfigEditor.tsx b/packages/website/src/components/config/ConfigEditor.tsx index 361ac95b667..f34b7662413 100644 --- a/packages/website/src/components/config/ConfigEditor.tsx +++ b/packages/website/src/components/config/ConfigEditor.tsx @@ -1,10 +1,8 @@ -import Dropdown from '@site/src/components/inputs/Dropdown'; -import Modal from '@site/src/components/modals/Modal'; import clsx from 'clsx'; -import React, { useCallback, useEffect, useReducer, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; -import useFocus from '../hooks/useFocus'; import Checkbox from '../inputs/Checkbox'; +import Dropdown from '../inputs/Dropdown'; import Text from '../inputs/Text'; import styles from './ConfigEditor.module.css'; @@ -26,50 +24,8 @@ export type ConfigEditorValues = Record; export interface ConfigEditorProps { readonly options: ConfigOptionsType[]; readonly values: ConfigEditorValues; - readonly isOpen: boolean; - readonly header: string; - readonly onClose: (config: ConfigEditorValues) => void; -} - -function reducerObject( - state: ConfigEditorValues, - action: - | { type: 'init'; config?: ConfigEditorValues } - | { - type: 'set'; - name: string; - value: unknown; - } - | { - type: 'toggle'; - checked: boolean; - default: unknown[] | undefined; - name: string; - }, -): ConfigEditorValues { - switch (action.type) { - case 'init': { - return action.config ?? {}; - } - case 'set': { - const newState = { ...state }; - if (action.value === '') { - delete newState[action.name]; - } else { - newState[action.name] = action.value; - } - return newState; - } - case 'toggle': { - const newState = { ...state }; - if (action.checked) { - newState[action.name] = action.default ? action.default[0] : true; - } else if (action.name in newState) { - delete newState[action.name]; - } - return newState; - } - } + readonly onChange: (config: ConfigEditorValues) => void; + readonly className?: string; } function filterConfig( @@ -88,94 +44,104 @@ function isDefault(value: unknown, defaults?: unknown[]): boolean { return defaults ? defaults.includes(value) : value === true; } -function ConfigEditor(props: ConfigEditorProps): JSX.Element { - const { onClose: onCloseProps, isOpen, values } = props; - const [filter, setFilter] = useState(''); - const [config, setConfig] = useReducer(reducerObject, {}); - const [filterInput, setFilterFocus] = useFocus(); +interface ConfigEditorFieldProps { + readonly item: ConfigOptionsField; + readonly value: unknown; + readonly onChange: (name: string, value: unknown) => void; +} + +function ConfigEditorField({ + item, + value, + onChange, +}: ConfigEditorFieldProps): React.JSX.Element { + return ( + + ); +} - const onClose = useCallback(() => { - onCloseProps(config); - }, [onCloseProps, config]); +function ConfigEditor({ + onChange: onChangeProp, + values, + options, + className, +}: ConfigEditorProps): React.JSX.Element { + const [filter, setFilter] = useState(''); - useEffect(() => { - setConfig({ type: 'init', config: values }); - }, [values]); + const filteredOptions = useMemo(() => { + return filterConfig(options, filter); + }, [options, filter]); - useEffect(() => { - if (isOpen) { - setFilterFocus(); - } - }, [isOpen, setFilterFocus]); + const onChange = useCallback( + (name: string, value: unknown): void => { + const newConfig = { ...values }; + if (value === '' || value == null) { + delete newConfig[name]; + } else { + newConfig[name] = value; + } + onChangeProp(newConfig); + }, + [values, onChangeProp], + ); return ( - +
-
- {filterConfig(props.options, filter).map(group => ( -
-

{group.heading}

-
- {group.fields.map(item => ( - - ))} -
+ {filteredOptions.map(group => ( +
+

{group.heading}

+
+ {group.fields.map(item => ( + + ))}
- ))} -
- +
+ ))} +
); } diff --git a/packages/website/src/components/config/ConfigEslint.tsx b/packages/website/src/components/config/ConfigEslint.tsx index fe6222df2e3..d32636e61b1 100644 --- a/packages/website/src/components/config/ConfigEslint.tsx +++ b/packages/website/src/components/config/ConfigEslint.tsx @@ -1,99 +1,71 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { ensureObject, parseJSONObject, toJson } from '../lib/json'; import { shallowEqual } from '../lib/shallowEqual'; -import type { ConfigModel, EslintRC, RuleDetails, RuleEntry } from '../types'; -import type { ConfigOptionsType } from './ConfigEditor'; +import type { ConfigModel, RuleDetails } from '../types'; +import type { ConfigOptionsField, ConfigOptionsType } from './ConfigEditor'; import ConfigEditor from './ConfigEditor'; -import { parseESLintRC, toJson } from './utils'; export interface ConfigEslintProps { - readonly isOpen: boolean; - readonly onClose: (value?: Partial) => void; + readonly onChange: (value: Partial) => void; readonly ruleOptions: RuleDetails[]; readonly config?: string; + readonly className?: string; } -function checkSeverity(value: unknown): boolean { - if (typeof value === 'string' || typeof value === 'number') { - return [0, 1, 2, 'off', 'warn', 'error'].includes(value); - } - return false; -} - -function checkOptions(rule: [string, unknown]): rule is [string, RuleEntry] { - if (Array.isArray(rule[1])) { - return rule[1].length > 0 && checkSeverity(rule[1][0]); - } - return checkSeverity(rule[1]); -} +function ConfigEslint(props: ConfigEslintProps): React.JSX.Element { + const { config, onChange: onChangeProp, ruleOptions, className } = props; -function ConfigEslint(props: ConfigEslintProps): JSX.Element { - const { isOpen, config, onClose: onCloseProps, ruleOptions } = props; - const [options, updateOptions] = useState([]); - const [configObject, updateConfigObject] = useState(); + const [configObject, updateConfigObject] = useState>( + () => ({}), + ); useEffect(() => { - if (isOpen) { - updateConfigObject(parseESLintRC(config)); - } - }, [isOpen, config]); + updateConfigObject(oldConfig => { + const newConfig = ensureObject(parseJSONObject(config).rules); + if (shallowEqual(oldConfig, newConfig)) { + return oldConfig; + } + return newConfig; + }); + }, [config]); - useEffect(() => { - updateOptions([ + const options = useMemo((): ConfigOptionsType[] => { + const mappedRules: ConfigOptionsField[] = ruleOptions.map(item => ({ + key: item.name, + label: item.description, + type: 'boolean', + defaults: ['error', 2, 'warn', 1, ['error'], ['warn'], [2], [1]], + })); + + return [ { heading: 'Rules', - fields: ruleOptions - .filter(item => item.name.startsWith('@typescript')) - .map(item => ({ - key: item.name, - label: item.description, - type: 'boolean', - defaults: ['error', 2, 'warn', 1, ['error'], ['warn'], [2], [1]], - })), + fields: mappedRules.filter(item => item.key.startsWith('@typescript')), }, { heading: 'Core rules', - fields: ruleOptions - .filter(item => !item.name.startsWith('@typescript')) - .map(item => ({ - key: item.name, - label: item.description, - type: 'boolean', - defaults: ['error', 2, 'warn', 1, ['error'], ['warn'], [2], [1]], - })), + fields: mappedRules.filter(item => !item.key.startsWith('@typescript')), }, - ]); + ]; }, [ruleOptions]); - const onClose = useCallback( + const onChange = useCallback( (newConfig: Record) => { - const cfg = Object.fromEntries( - Object.entries(newConfig) - .map<[string, unknown]>(([name, value]) => - Array.isArray(value) && value.length === 1 - ? [name, value[0]] - : [name, value], - ) - .filter(checkOptions), - ); - if (!shallowEqual(cfg, configObject?.rules)) { - onCloseProps({ - eslintrc: toJson({ ...(configObject ?? {}), rules: cfg }), - }); - } else { - onCloseProps(); - } + const parsed = parseJSONObject(config); + parsed.rules = newConfig; + updateConfigObject(newConfig); + onChangeProp({ eslintrc: toJson(parsed) }); }, - [onCloseProps, configObject], + [config, onChangeProp], ); return ( ); } diff --git a/packages/website/src/components/config/ConfigTypeScript.tsx b/packages/website/src/components/config/ConfigTypeScript.tsx index 40cd634ffb1..7a7a66b174d 100644 --- a/packages/website/src/components/config/ConfigTypeScript.tsx +++ b/packages/website/src/components/config/ConfigTypeScript.tsx @@ -1,83 +1,81 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { ensureObject, parseJSONObject, toJson } from '../lib/json'; +import { getTypescriptOptions } from '../lib/jsonSchema'; import { shallowEqual } from '../lib/shallowEqual'; -import type { ConfigModel, TSConfig } from '../types'; +import type { ConfigModel } from '../types'; import type { ConfigOptionsType } from './ConfigEditor'; import ConfigEditor from './ConfigEditor'; -import { getTypescriptOptions, parseTSConfig, toJson } from './utils'; interface ConfigTypeScriptProps { - readonly isOpen: boolean; - readonly onClose: (config?: Partial) => void; + readonly onChange: (config: Partial) => void; readonly config?: string; + readonly className?: string; } -function ConfigTypeScript(props: ConfigTypeScriptProps): JSX.Element { - const { onClose: onCloseProps, isOpen, config } = props; - const [tsConfigOptions, updateOptions] = useState([]); - const [configObject, updateConfigObject] = useState(); +function ConfigTypeScript(props: ConfigTypeScriptProps): React.JSX.Element { + const { config, onChange: onChangeProp, className } = props; - useEffect(() => { - if (isOpen) { - updateConfigObject(parseTSConfig(config)); - } - }, [isOpen, config]); + const [configObject, updateConfigObject] = useState>( + () => ({}), + ); useEffect(() => { - if (window.ts) { - updateOptions( - Object.values( - getTypescriptOptions().reduce>( - (group, item) => { - const category = item.category!.message; - group[category] = group[category] ?? { - heading: category, - fields: [], - }; - if (item.type === 'boolean') { - group[category].fields.push({ - key: item.name, - type: 'boolean', - label: item.description!.message, - }); - } else if (item.type instanceof Map) { - group[category].fields.push({ - key: item.name, - type: 'string', - label: item.description!.message, - enum: ['', ...Array.from(item.type.keys())], - }); - } - return group; - }, - {}, - ), - ), - ); - } - }, [isOpen]); + updateConfigObject(oldConfig => { + const newConfig = ensureObject(parseJSONObject(config).compilerOptions); + if (shallowEqual(oldConfig, newConfig)) { + return oldConfig; + } + return newConfig; + }); + }, [config]); - const onClose = useCallback( + const options = useMemo((): ConfigOptionsType[] => { + return Object.values( + getTypescriptOptions().reduce>( + (group, item) => { + const category = item.category!.message; + group[category] = group[category] ?? { + heading: category, + fields: [], + }; + if (item.type === 'boolean') { + group[category].fields.push({ + key: item.name, + type: 'boolean', + label: item.description!.message, + }); + } else if (item.type instanceof Map) { + group[category].fields.push({ + key: item.name, + type: 'string', + label: item.description!.message, + enum: ['', ...Array.from(item.type.keys())], + }); + } + return group; + }, + {}, + ), + ); + }, []); + + const onChange = useCallback( (newConfig: Record) => { - const cfg = { ...newConfig }; - if (!shallowEqual(cfg, configObject?.compilerOptions)) { - onCloseProps({ - tsconfig: toJson({ ...(configObject ?? {}), compilerOptions: cfg }), - }); - } else { - onCloseProps(); - } + const parsed = parseJSONObject(config); + parsed.compilerOptions = newConfig; + updateConfigObject(newConfig); + onChangeProp({ tsconfig: toJson(parsed) }); }, - [onCloseProps, configObject], + [config, onChangeProp], ); return ( ); } diff --git a/packages/website/src/components/config/utils.ts b/packages/website/src/components/config/utils.ts deleted file mode 100644 index e6cbd1e9391..00000000000 --- a/packages/website/src/components/config/utils.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { isRecord } from '@site/src/components/ast/utils'; -import type { EslintRC, TSConfig } from '@site/src/components/types'; -import json5 from 'json5'; - -export interface OptionDeclarations { - name: string; - type?: unknown; - category?: { message: string }; - description?: { message: string }; - element?: { - type: unknown; - }; -} - -export function parseESLintRC(code?: string): EslintRC { - if (code) { - try { - const parsed: unknown = json5.parse(code); - if (isRecord(parsed)) { - if ('rules' in parsed && isRecord(parsed.rules)) { - return parsed as EslintRC; - } - return { ...parsed, rules: {} }; - } - } catch (e) { - // eslint-disable-next-line no-console - console.error(e); - } - } - return { rules: {} }; -} - -export function parseTSConfig(code?: string): TSConfig { - if (code) { - try { - const parsed = window.ts.parseConfigFileTextToJson( - '/tsconfig.json', - code, - ); - if (parsed.error) { - // eslint-disable-next-line no-console - console.error(parsed.error); - } - if (isRecord(parsed.config)) { - return parsed.config as TSConfig; - } - } catch (e) { - // eslint-disable-next-line no-console - console.error(e); - } - } - return { compilerOptions: {} }; -} - -const moduleRegexp = /(module\.exports\s*=)/g; - -function constrainedScopeEval(obj: string): unknown { - // eslint-disable-next-line @typescript-eslint/no-implied-eval - return new Function(` - "use strict"; - var module = { exports: {} }; - (${obj}); - return module.exports - `)(); -} - -export function tryParseEslintModule(value: string): string { - try { - if (moduleRegexp.test(value)) { - const newValue = toJson(constrainedScopeEval(value)); - if (newValue !== value) { - return newValue; - } - } - } catch (e) { - // eslint-disable-next-line no-console - console.error(e); - } - return value; -} - -export function toJson(cfg: unknown): string { - return JSON.stringify(cfg, null, 2); -} - -export function toJsonConfig(cfg: unknown, prop: string): string { - return toJson({ [prop]: cfg }); -} - -export function getTypescriptOptions(): OptionDeclarations[] { - const allowedCategories = [ - 'Command-line Options', - 'Projects', - 'Compiler Diagnostics', - 'Editor Support', - 'Output Formatting', - 'Watch and Build Modes', - 'Source Map Options', - ]; - - const filteredNames = [ - 'moduleResolution', - 'moduleDetection', - 'plugins', - 'typeRoots', - 'jsx', - ]; - - // @ts-expect-error: definition is not fully correct - return (window.ts.optionDeclarations as OptionDeclarations[]).filter( - item => - (item.type === 'boolean' || - item.type === 'list' || - item.type instanceof Map) && - item.description && - item.category && - !allowedCategories.includes(item.category.message) && - !filteredNames.includes(item.name), - ); -} - -export const defaultTsConfig = toJson({ - compilerOptions: { - strictNullChecks: true, - }, -}); - -export const defaultEslintConfig = toJson({ - rules: {}, -}); diff --git a/packages/website/src/components/editor/LoadedEditor.tsx b/packages/website/src/components/editor/LoadedEditor.tsx index 48ea1c59177..f8c88d3d5f0 100644 --- a/packages/website/src/components/editor/LoadedEditor.tsx +++ b/packages/website/src/components/editor/LoadedEditor.tsx @@ -3,47 +3,51 @@ import type Monaco from 'monaco-editor'; import type React from 'react'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { - parseESLintRC, - parseTSConfig, - tryParseEslintModule, -} from '../config/utils'; import { useResizeObserver } from '../hooks/useResizeObserver'; +import { createCompilerOptions } from '../lib/createCompilerOptions'; import { debounce } from '../lib/debounce'; +import { + getEslintJsonSchema, + getRuleJsonSchemaWithErrorLevel, + getTypescriptJsonSchema, +} from '../lib/jsonSchema'; +import { parseTSConfig, tryParseEslintModule } from '../lib/parseConfig'; import type { LintCodeAction } from '../linter/utils'; import { parseLintResults, parseMarkers } from '../linter/utils'; -import type { WebLinter } from '../linter/WebLinter'; import type { TabType } from '../types'; -import { - createCompilerOptions, - getEslintSchema, - getTsConfigSchema, -} from './config'; import { createProvideCodeActions } from './createProvideCodeActions'; import type { CommonEditorProps } from './types'; -import type { SandboxInstance } from './useSandboxServices'; +import type { SandboxServices } from './useSandboxServices'; + +export type LoadedEditorProps = CommonEditorProps & SandboxServices; -export interface LoadedEditorProps extends CommonEditorProps { - readonly main: typeof Monaco; - readonly sandboxInstance: SandboxInstance; - readonly webLinter: WebLinter; +function applyEdit( + model: Monaco.editor.ITextModel, + editor: Monaco.editor.ICodeEditor, + edit: Monaco.editor.IIdentifiedSingleEditOperation, +): void { + if (model.isAttachedToEditor()) { + editor.executeEdits('eslint', [edit]); + } else { + model.pushEditOperations([], [edit], () => null); + } } export const LoadedEditor: React.FC = ({ code, tsconfig, eslintrc, - decoration, - jsx, - main, + selectedRange, + fileType, onEsASTChange, onScopeChange, onTsASTChange, onMarkersChange, onChange, onSelect, - sandboxInstance, + sandboxInstance: { editor, monaco }, showAST, + system, sourceType, webLinter, activeTab, @@ -54,16 +58,16 @@ export const LoadedEditor: React.FC = ({ const codeActions = useRef(new Map()).current; const [tabs] = useState>(() => { const tabsDefault = { - code: sandboxInstance.editor.getModel()!, - tsconfig: sandboxInstance.monaco.editor.createModel( + code: editor.getModel()!, + tsconfig: monaco.editor.createModel( tsconfig, 'json', - sandboxInstance.monaco.Uri.file('/tsconfig.json'), + monaco.Uri.file('/tsconfig.json'), ), - eslintrc: sandboxInstance.monaco.editor.createModel( + eslintrc: monaco.editor.createModel( eslintrc, 'json', - sandboxInstance.monaco.Uri.file('/.eslintrc'), + monaco.Uri.file('/.eslintrc'), ), }; tabsDefault.code.updateOptions({ tabSize: 2, insertSpaces: true }); @@ -73,303 +77,247 @@ export const LoadedEditor: React.FC = ({ }); const updateMarkers = useCallback(() => { - const model = sandboxInstance.editor.getModel()!; - const markers = sandboxInstance.monaco.editor.getModelMarkers({ + const model = editor.getModel()!; + const markers = monaco.editor.getModelMarkers({ resource: model.uri, }); - onMarkersChange(parseMarkers(markers, codeActions, sandboxInstance.editor)); - }, [ - codeActions, - onMarkersChange, - sandboxInstance.editor, - sandboxInstance.monaco.editor, - ]); + onMarkersChange(parseMarkers(markers, codeActions, editor)); + }, [codeActions, onMarkersChange, editor, monaco.editor]); useEffect(() => { - const newPath = jsx ? '/input.tsx' : '/input.ts'; + webLinter.updateParserOptions(sourceType); + }, [webLinter, sourceType]); + + useEffect(() => { + const newPath = `/input${fileType}`; if (tabs.code.uri.path !== newPath) { - const newModel = sandboxInstance.monaco.editor.createModel( - tabs.code.getValue(), - 'typescript', - sandboxInstance.monaco.Uri.file(newPath), + const code = tabs.code.getValue(); + const newModel = monaco.editor.createModel( + code, + undefined, + monaco.Uri.file(newPath), ); newModel.updateOptions({ tabSize: 2, insertSpaces: true }); if (tabs.code.isAttachedToEditor()) { - sandboxInstance.editor.setModel(newModel); + editor.setModel(newModel); } tabs.code.dispose(); tabs.code = newModel; + system.writeFile(newPath, code); } - }, [ - jsx, - sandboxInstance.editor, - sandboxInstance.monaco.Uri, - sandboxInstance.monaco.editor, - tabs, - ]); + }, [fileType, editor, system, monaco, tabs]); useEffect(() => { const config = createCompilerOptions( - jsx, parseTSConfig(tsconfig).compilerOptions, ); - webLinter.updateCompilerOptions(config); - sandboxInstance.setCompilerSettings(config); - }, [jsx, sandboxInstance, tsconfig, webLinter]); + monaco.languages.typescript.typescriptDefaults.setCompilerOptions( + config as Monaco.languages.typescript.CompilerOptions, + ); + }, [monaco, tsconfig]); useEffect(() => { - webLinter.updateRules(parseESLintRC(eslintrc).rules); - }, [eslintrc, webLinter]); + if (editor.getModel()?.uri.path !== tabs[activeTab].uri.path) { + editor.setModel(tabs[activeTab]); + updateMarkers(); + } + }, [activeTab, editor, tabs, updateMarkers]); useEffect(() => { - sandboxInstance.editor.setModel(tabs[activeTab]); - updateMarkers(); - }, [activeTab, sandboxInstance.editor, tabs, updateMarkers]); + const disposable = webLinter.onLint((uri, messages) => { + const diagnostics = parseLintResults(messages, codeActions, ruleId => + monaco.Uri.parse(webLinter.rules.get(ruleId)?.url ?? ''), + ); + monaco.editor.setModelMarkers( + monaco.editor.getModel(monaco.Uri.file(uri))!, + 'eslint', + diagnostics, + ); + updateMarkers(); + }); + return () => disposable(); + }, [webLinter, monaco, codeActions, updateMarkers]); useEffect(() => { - const lintEditor = debounce(() => { - // eslint-disable-next-line no-console - console.info('[Editor] linting triggered'); - - webLinter.updateParserOptions(jsx, sourceType); - - try { - const messages = webLinter.lint(code); - - const markers = parseLintResults(messages, codeActions, ruleId => - sandboxInstance.monaco.Uri.parse( - webLinter.rulesUrl.get(ruleId) ?? '', - ), - ); - - sandboxInstance.monaco.editor.setModelMarkers( - tabs.code, - 'eslint', - markers, - ); - - // fallback when event is not preset, ts < 4.0.5 - if (!sandboxInstance.monaco.editor.onDidChangeMarkers) { - updateMarkers(); - } - } catch (e) { - onMarkersChange(e as Error); - } - - onEsASTChange(webLinter.storedAST); - onTsASTChange(webLinter.storedTsAST); - onScopeChange(webLinter.storedScope); - onSelect(sandboxInstance.editor.getPosition()); - }, 500); - - lintEditor(); - }, [ - code, - jsx, - tsconfig, - eslintrc, - sourceType, - webLinter, - onEsASTChange, - onTsASTChange, - onScopeChange, - onSelect, - sandboxInstance.editor, - sandboxInstance.monaco.editor, - sandboxInstance.monaco.Uri, - codeActions, - tabs.code, - updateMarkers, - onMarkersChange, - ]); + const disposable = webLinter.onParse((uri, model) => { + onEsASTChange(model.storedAST); + onScopeChange(model.storedScope as Record | undefined); + onTsASTChange(model.storedTsAST); + }); + return () => disposable(); + }, [webLinter, onEsASTChange, onScopeChange, onTsASTChange]); useEffect(() => { + const createRuleUri = (name: string): string => + monaco.Uri.parse(`/rules/${name.replace('@', '')}.json`).toString(); + // configure the JSON language support with schemas and schema associations - sandboxInstance.monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ + monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ validate: true, + enableSchemaRequest: false, + allowComments: true, schemas: [ + ...Array.from(webLinter.rules.values()).map(rule => ({ + uri: createRuleUri(rule.name), + schema: getRuleJsonSchemaWithErrorLevel(rule.name, rule.schema), + })), { - uri: 'eslint-schema.json', // id of the first schema - fileMatch: [tabs.eslintrc.uri.toString()], // associate with our model - schema: getEslintSchema(webLinter.ruleNames), + uri: monaco.Uri.file('eslint-schema.json').toString(), // id of the first schema + fileMatch: ['/.eslintrc'], // associate with our model + schema: getEslintJsonSchema(webLinter, createRuleUri), }, { - uri: 'ts-schema.json', // id of the first schema - fileMatch: [tabs.tsconfig.uri.toString()], // associate with our model - schema: getTsConfigSchema(), + uri: monaco.Uri.file('ts-schema.json').toString(), // id of the first schema + fileMatch: ['/tsconfig.json'], // associate with our model + schema: getTypescriptJsonSchema(), }, ], }); + }, [monaco, webLinter]); - const subscriptions = [ - main.languages.registerCodeActionProvider( - 'typescript', - createProvideCodeActions(codeActions), - ), - sandboxInstance.editor.onDidPaste(() => { - if (tabs.eslintrc.isAttachedToEditor()) { - const value = tabs.eslintrc.getValue(); - const newValue = tryParseEslintModule(value); - if (newValue !== value) { - tabs.eslintrc.setValue(newValue); + useEffect(() => { + const disposable = monaco.languages.registerCodeActionProvider( + 'typescript', + createProvideCodeActions(codeActions), + ); + return () => disposable.dispose(); + }, [codeActions, monaco]); + + useEffect(() => { + const disposable = editor.onDidPaste(() => { + if (tabs.eslintrc.isAttachedToEditor()) { + const value = tabs.eslintrc.getValue(); + const newValue = tryParseEslintModule(value); + if (newValue !== value) { + tabs.eslintrc.setValue(newValue); + } + } + }); + return () => disposable.dispose(); + }, [editor, tabs.eslintrc]); + + useEffect(() => { + const disposable = editor.onDidChangeCursorPosition( + debounce(e => { + if (tabs.code.isAttachedToEditor()) { + const position = tabs.code.getOffsetAt(e.position); + console.info('[Editor] updating cursor', position); + onSelect(position); + } + }, 150), + ); + return () => disposable.dispose(); + }, [onSelect, editor, tabs.code]); + + useEffect(() => { + const disposable = editor.addAction({ + id: 'fix-eslint-problems', + label: 'Fix eslint problems', + keybindings: [monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS], + contextMenuGroupId: 'snippets', + contextMenuOrder: 1.5, + run(editor) { + const editorModel = editor.getModel(); + if (editorModel) { + const fixed = webLinter.triggerFix(editor.getValue()); + if (fixed?.fixed) { + applyEdit(editorModel, editor, { + range: editorModel.getFullModelRange(), + text: fixed.output, + }); } } + }, + }); + return () => disposable.dispose(); + }, [editor, monaco, webLinter]); + + useEffect(() => { + const closable = [ + system.watchFile('/tsconfig.json', filename => { + onChange({ tsconfig: system.readFile(filename) }); }), - sandboxInstance.editor.onDidChangeCursorPosition( - debounce(() => { - if (tabs.code.isAttachedToEditor()) { - const position = sandboxInstance.editor.getPosition(); - if (position) { - // eslint-disable-next-line no-console - console.info('[Editor] updating cursor', position); - onSelect(position); - } - } - }, 150), - ), - sandboxInstance.editor.addAction({ - id: 'fix-eslint-problems', - label: 'Fix eslint problems', - keybindings: [ - sandboxInstance.monaco.KeyMod.CtrlCmd | - sandboxInstance.monaco.KeyCode.KeyS, - ], - contextMenuGroupId: 'snippets', - contextMenuOrder: 1.5, - run(editor) { - const editorModel = editor.getModel(); - if (editorModel) { - const fixed = webLinter.fix(editor.getValue()); - if (fixed.fixed) { - editorModel.pushEditOperations( - null, - [ - { - range: editorModel.getFullModelRange(), - text: fixed.output, - }, - ], - () => null, - ); - } - } - }, + system.watchFile('/.eslintrc', filename => { + onChange({ eslintrc: system.readFile(filename) }); }), - tabs.eslintrc.onDidChangeContent( - debounce(() => { - onChange({ eslintrc: tabs.eslintrc.getValue() }); - }, 500), - ), - tabs.tsconfig.onDidChangeContent( - debounce(() => { - onChange({ tsconfig: tabs.tsconfig.getValue() }); - }, 500), - ), - tabs.code.onDidChangeContent( - debounce(() => { - onChange({ code: tabs.code.getValue() }); - }, 500), - ), - // may not be defined in ts < 4.0.5 - sandboxInstance.monaco.editor.onDidChangeMarkers?.(() => { - updateMarkers(); + system.watchFile('/input.*', filename => { + onChange({ code: system.readFile(filename) }); }), ]; - return (): void => { - for (const subscription of subscriptions) { - if (subscription) { - subscription.dispose(); - } - } + return () => { + closable.forEach(c => c.close()); }; - }, [ - codeActions, - main.languages, - onChange, - onSelect, - sandboxInstance.editor, - sandboxInstance.monaco.editor, - sandboxInstance.monaco.languages.json.jsonDefaults, - tabs.code, - tabs.eslintrc, - tabs.tsconfig, - updateMarkers, - webLinter.ruleNames, - ]); + }, [system, onChange]); + + useEffect(() => { + const disposable = editor.onDidChangeModelContent(() => { + const model = editor.getModel(); + if (model) { + system.writeFile(model.uri.path, model.getValue()); + } + }); + return () => disposable.dispose(); + }, [editor, system]); + + useEffect(() => { + const disposable = monaco.editor.onDidChangeMarkers(() => { + updateMarkers(); + }); + return () => disposable.dispose(); + }, [monaco.editor, updateMarkers]); const resize = useMemo(() => { - return debounce(() => sandboxInstance.editor.layout(), 1); - }, [sandboxInstance]); + return debounce(() => editor.layout(), 1); + }, [editor]); - const container = - sandboxInstance.editor.getContainerDomNode?.() ?? - sandboxInstance.editor.getDomNode(); + const container = editor.getContainerDomNode?.() ?? editor.getDomNode(); useResizeObserver(container, () => { resize(); }); useEffect(() => { - if ( - !sandboxInstance.editor.hasTextFocus() && - code !== tabs.code.getValue() - ) { - tabs.code.applyEdits([ - { - range: tabs.code.getFullModelRange(), - text: code, - }, - ]); + if (!editor.hasTextFocus() && code !== tabs.code.getValue()) { + applyEdit(tabs.code, editor, { + range: tabs.code.getFullModelRange(), + text: code, + }); } - }, [sandboxInstance, code, tabs.code]); + }, [code, editor, tabs.code]); useEffect(() => { - if ( - !sandboxInstance.editor.hasTextFocus() && - tsconfig !== tabs.tsconfig.getValue() - ) { - tabs.tsconfig.applyEdits([ - { - range: tabs.tsconfig.getFullModelRange(), - text: tsconfig, - }, - ]); + if (!editor.hasTextFocus() && tsconfig !== tabs.tsconfig.getValue()) { + applyEdit(tabs.tsconfig, editor, { + range: tabs.tsconfig.getFullModelRange(), + text: tsconfig, + }); } - }, [sandboxInstance, tabs.tsconfig, tsconfig]); + }, [editor, tabs.tsconfig, tsconfig]); useEffect(() => { - if ( - !sandboxInstance.editor.hasTextFocus() && - eslintrc !== tabs.eslintrc.getValue() - ) { - tabs.eslintrc.applyEdits([ - { - range: tabs.eslintrc.getFullModelRange(), - text: eslintrc, - }, - ]); + if (!editor.hasTextFocus() && eslintrc !== tabs.eslintrc.getValue()) { + applyEdit(tabs.eslintrc, editor, { + range: tabs.eslintrc.getFullModelRange(), + text: eslintrc, + }); } - }, [sandboxInstance, eslintrc, tabs.eslintrc]); + }, [eslintrc, editor, tabs.eslintrc]); useEffect(() => { - sandboxInstance.monaco.editor.setTheme( - colorMode === 'dark' ? 'vs-dark' : 'vs-light', - ); - }, [colorMode, sandboxInstance]); + monaco.editor.setTheme(colorMode === 'dark' ? 'vs-dark' : 'vs-light'); + }, [colorMode, monaco]); useEffect(() => { setDecorations(prevDecorations => tabs.code.deltaDecorations( prevDecorations, - decoration && showAST + selectedRange && showAST ? [ { - range: new sandboxInstance.monaco.Range( - decoration.start.line, - decoration.start.column + 1, - decoration.end.line, - decoration.end.column + 1, + range: monaco.Range.fromPositions( + tabs.code.getPositionAt(selectedRange[0]), + tabs.code.getPositionAt(selectedRange[1]), ), options: { inlineClassName: 'myLineDecoration', @@ -380,7 +328,11 @@ export const LoadedEditor: React.FC = ({ : [], ), ); - }, [decoration, sandboxInstance, showAST, tabs.code]); + }, [selectedRange, monaco, showAST, tabs.code]); + + useEffect(() => { + webLinter.triggerLint(tabs.code.uri.path); + }, [webLinter, fileType, sourceType, tabs.code]); return null; }; diff --git a/packages/website/src/components/editor/config.ts b/packages/website/src/components/editor/config.ts deleted file mode 100644 index 2428a550269..00000000000 --- a/packages/website/src/components/editor/config.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { JSONSchema4 } from '@typescript-eslint/utils/dist/json-schema'; -import type Monaco from 'monaco-editor'; - -import { getTypescriptOptions } from '../config/utils'; - -export function createCompilerOptions( - jsx = false, - tsConfig: Record = {}, -): Monaco.languages.typescript.CompilerOptions { - const config = window.ts.convertCompilerOptionsFromJson( - { - // ts and monaco has different type as monaco types are not changing base on ts version - target: 'esnext', - module: 'esnext', - ...tsConfig, - jsx: jsx ? 'preserve' : undefined, - lib: Array.isArray(tsConfig.lib) ? tsConfig.lib : undefined, - moduleResolution: undefined, - plugins: undefined, - typeRoots: undefined, - paths: undefined, - moduleDetection: undefined, - baseUrl: undefined, - }, - '/tsconfig.json', - ); - - const options = config.options as Monaco.languages.typescript.CompilerOptions; - - if (!options.lib) { - options.lib = [window.ts.getDefaultLibFileName(options)]; - } - - return options; -} - -export function getEslintSchema( - rules: { name: string; description?: string }[], -): JSONSchema4 { - const properties = rules.reduce>( - (rules, item) => { - rules[item.name] = { - description: item.description, - oneOf: [ - { - type: ['string', 'number'], - enum: ['off', 'warn', 'error', 0, 1, 2], - }, - { - type: 'array', - items: [ - { - type: ['string', 'number'], - enum: ['off', 'warn', 'error', 0, 1, 2], - }, - ], - }, - ], - }; - return rules; - }, - {}, - ); - - return { - type: 'object', - properties: { - rules: { - type: 'object', - properties: properties, - additionalProperties: false, - }, - }, - }; -} - -export function getTsConfigSchema(): JSONSchema4 { - const properties = getTypescriptOptions().reduce((options, item) => { - if (item.type === 'boolean') { - options[item.name] = { - type: 'boolean', - description: item.description!.message, - }; - } else if (item.type === 'list' && item.element?.type instanceof Map) { - options[item.name] = { - type: 'array', - items: { - type: 'string', - enum: Array.from(item.element.type.keys()), - }, - description: item.description!.message, - }; - } else if (item.type instanceof Map) { - options[item.name] = { - type: 'string', - description: item.description!.message, - enum: Array.from(item.type.keys()), - }; - } - return options; - }, {}); - - return { - type: 'object', - properties: { - compilerOptions: { - type: 'object', - properties: properties, - }, - }, - }; -} diff --git a/packages/website/src/components/editor/createProvideCodeActions.ts b/packages/website/src/components/editor/createProvideCodeActions.ts index 0987bf49a4c..a5eae9f849a 100644 --- a/packages/website/src/components/editor/createProvideCodeActions.ts +++ b/packages/website/src/components/editor/createProvideCodeActions.ts @@ -11,7 +11,6 @@ export function createProvideCodeActions( model, _range, context, - _token, ): Monaco.languages.ProviderResult { if (context.only !== 'quickfix') { return { diff --git a/packages/website/src/components/editor/loadSandbox.ts b/packages/website/src/components/editor/loadSandbox.ts index 1dac9d20f62..f7798a4093e 100644 --- a/packages/website/src/components/editor/loadSandbox.ts +++ b/packages/website/src/components/editor/loadSandbox.ts @@ -1,19 +1,15 @@ -import type { LintUtils } from '@typescript-eslint/website-eslint'; -import type MonacoType from 'monaco-editor'; -import type * as TSType from 'typescript'; +import type MonacoEditor from 'monaco-editor'; import type * as SandboxFactory from '../../vendor/sandbox'; -import type * as TsWorker from '../../vendor/tsWorker'; +import type { WebLinterModule } from '../linter/types'; -type Monaco = typeof MonacoType; -type TS = typeof TSType; +type Monaco = typeof MonacoEditor; +type Sandbox = typeof SandboxFactory; export interface SandboxModel { main: Monaco; - tsWorker: typeof TsWorker; - sandboxFactory: typeof SandboxFactory; - ts: TS; - lintUtils: LintUtils; + sandboxFactory: Sandbox; + lintUtils: WebLinterModule; } function loadSandbox(tsVersion: string): Promise { @@ -36,30 +32,15 @@ function loadSandbox(tsVersion: string): Promise { }); // Grab a copy of monaco, TypeScript and the sandbox - window.require( - [ - 'vs/editor/editor.main', - 'vs/language/typescript/tsWorker', - 'sandbox/index', - 'linter/index', - ], - (main, tsWorker, sandboxFactory, lintUtils) => { - const isOK = main && window.ts && sandboxFactory; - if (isOK) { - resolve({ - main, - tsWorker, - sandboxFactory, - ts: window.ts, - lintUtils, - }); - } else { - reject( - new Error( - 'Could not get all the dependencies of sandbox set up!', - ), - ); - } + window.require<[Monaco, Sandbox, WebLinterModule]>( + ['vs/editor/editor.main', 'sandbox/index', 'linter/index'], + (main, sandboxFactory, lintUtils) => { + resolve({ main, sandboxFactory, lintUtils }); + }, + () => { + reject( + new Error('Could not get all the dependencies of sandbox set up!'), + ); }, ); }; diff --git a/packages/website/src/components/editor/types.ts b/packages/website/src/components/editor/types.ts index d2e0df70109..bc7b886f535 100644 --- a/packages/website/src/components/editor/types.ts +++ b/packages/website/src/components/editor/types.ts @@ -1,16 +1,15 @@ import type { TSESTree } from '@typescript-eslint/utils'; -import type Monaco from 'monaco-editor'; import type { SourceFile } from 'typescript'; import type { ConfigModel, ErrorGroup, SelectedRange, TabType } from '../types'; export interface CommonEditorProps extends ConfigModel { readonly activeTab: TabType; - readonly decoration: SelectedRange | null; + readonly selectedRange?: SelectedRange; readonly onChange: (cfg: Partial) => void; - readonly onTsASTChange: (value: undefined | SourceFile) => void; - readonly onEsASTChange: (value: undefined | TSESTree.Program) => void; - readonly onScopeChange: (value: undefined | Record) => void; - readonly onMarkersChange: (value: ErrorGroup[] | Error) => void; - readonly onSelect: (position: Monaco.Position | null) => void; + readonly onTsASTChange: (value: SourceFile | undefined) => void; + readonly onEsASTChange: (value: TSESTree.Program | undefined) => void; + readonly onScopeChange: (value: Record | undefined) => void; + readonly onMarkersChange: (value: ErrorGroup[]) => void; + readonly onSelect: (position?: number) => void; } diff --git a/packages/website/src/components/editor/useSandboxServices.ts b/packages/website/src/components/editor/useSandboxServices.ts index 1efaf68ffa4..86cb92bdc19 100644 --- a/packages/website/src/components/editor/useSandboxServices.ts +++ b/packages/website/src/components/editor/useSandboxServices.ts @@ -1,20 +1,18 @@ import { useColorMode } from '@docusaurus/theme-common'; -import type Monaco from 'monaco-editor'; +import type * as Monaco from 'monaco-editor'; import { useEffect, useState } from 'react'; -import type { - createTypeScriptSandbox, - SandboxConfig, -} from '../../vendor/sandbox'; -import { WebLinter } from '../linter/WebLinter'; +import type { createTypeScriptSandbox } from '../../vendor/sandbox'; +import { createCompilerOptions } from '../lib/createCompilerOptions'; +import { createFileSystem } from '../linter/bridge'; +import { type CreateLinter, createLinter } from '../linter/createLinter'; +import type { PlaygroundSystem } from '../linter/types'; import type { RuleDetails } from '../types'; -import { createCompilerOptions } from './config'; import { editorEmbedId } from './EditorEmbed'; import { sandboxSingleton } from './loadSandbox'; import type { CommonEditorProps } from './types'; export interface SandboxServicesProps { - readonly jsx?: boolean; readonly onLoaded: ( ruleDetails: RuleDetails[], tsVersions: readonly string[], @@ -25,9 +23,9 @@ export interface SandboxServicesProps { export type SandboxInstance = ReturnType; export interface SandboxServices { - main: typeof Monaco; sandboxInstance: SandboxInstance; - webLinter: WebLinter; + system: PlaygroundSystem; + webLinter: CreateLinter; } export const useSandboxServices = ( @@ -35,96 +33,74 @@ export const useSandboxServices = ( ): Error | SandboxServices | undefined => { const { onLoaded } = props; const [services, setServices] = useState(); - const [loadedTs, setLoadedTs] = useState(props.ts); const { colorMode } = useColorMode(); - useEffect(() => { - if (props.ts !== loadedTs) { - window.location.reload(); - } - }, [props.ts, loadedTs]); - useEffect(() => { let sandboxInstance: SandboxInstance | undefined; - setLoadedTs(props.ts); sandboxSingleton(props.ts) - .then(async ({ main, sandboxFactory, ts, lintUtils }) => { - const compilerOptions = createCompilerOptions(props.jsx); - - const sandboxConfig: Partial = { - text: props.code, - monacoSettings: { - minimap: { enabled: false }, - fontSize: 13, - wordWrap: 'off', - scrollBeyondLastLine: false, - smoothScrolling: true, - autoIndent: 'full', - formatOnPaste: true, - formatOnType: true, - wrappingIndent: 'same', - hover: { above: false }, - }, - acquireTypes: false, - compilerOptions: compilerOptions, - domID: editorEmbedId, - }; + .then(async ({ main, sandboxFactory, lintUtils }) => { + const compilerOptions = createCompilerOptions(); sandboxInstance = sandboxFactory.createTypeScriptSandbox( - sandboxConfig, + { + text: props.code, + monacoSettings: { + minimap: { enabled: false }, + fontSize: 13, + wordWrap: 'off', + scrollBeyondLastLine: false, + smoothScrolling: true, + autoIndent: 'full', + formatOnPaste: true, + formatOnType: true, + wrappingIndent: 'same', + hover: { above: false }, + }, + acquireTypes: false, + compilerOptions: + compilerOptions as Monaco.languages.typescript.CompilerOptions, + domID: editorEmbedId, + }, main, - ts, + window.ts, ); sandboxInstance.monaco.editor.setTheme( colorMode === 'dark' ? 'vs-dark' : 'vs-light', ); - let libEntries: Map | undefined; + const system = createFileSystem(props, sandboxInstance.tsvfs); + const worker = await sandboxInstance.getWorkerProcess(); if (worker.getLibFiles) { - libEntries = new Map( - Object.entries((await worker.getLibFiles()) ?? {}).map(item => [ - '/' + item[0], - item[1], - ]), - ); - } else { - // for some older version of playground we do not have definitions available - libEntries = await sandboxInstance.tsvfs.createDefaultMapFromCDN( - { - lib: Array.from(window.ts.libMap.keys()), - }, - props.ts, - true, - window.ts, - ); - for (const pair of libEntries) { - sandboxInstance.languageServiceDefaults.addExtraLib( - pair[1], - 'ts:' + pair[0], - ); + const libs = await worker.getLibFiles(); + for (const [key, value] of Object.entries(libs)) { + system.writeFile('/' + key, value); } } - const system = sandboxInstance.tsvfs.createSystem(libEntries); + window.system = system; window.esquery = lintUtils.esquery; - const webLinter = new WebLinter(system, compilerOptions, lintUtils); + const webLinter = createLinter( + system, + lintUtils, + sandboxInstance.tsvfs, + ); onLoaded( - webLinter.ruleNames, + Array.from(webLinter.rules.values()), Array.from( new Set([...sandboxInstance.supportedVersions, window.ts.version]), ) - .filter(item => parseFloat(item) >= 3.3) + .filter(item => parseFloat(item) >= 4.3) .sort((a, b) => b.localeCompare(a)), ); setServices({ - main, - sandboxInstance, + system, webLinter, + sandboxInstance, }); }) .catch(setServices); @@ -150,7 +126,7 @@ export const useSandboxServices = ( // colorMode and jsx can't be reactive here because we don't want to force a recreation // updating of colorMode and jsx is handled in LoadedEditor // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.ts, onLoaded]); + }, []); return services; }; diff --git a/packages/website/src/components/hooks/useFocus.ts b/packages/website/src/components/hooks/useFocus.ts index 9c0cd6747da..3e94d308e95 100644 --- a/packages/website/src/components/hooks/useFocus.ts +++ b/packages/website/src/components/hooks/useFocus.ts @@ -1,14 +1,14 @@ import type React from 'react'; -import { useRef } from 'react'; +import { useCallback, useRef } from 'react'; function useFocus(): [ React.RefObject, () => void, ] { const htmlElRef = useRef(null); - const setFocus = (): void => { + const setFocus = useCallback((): void => { htmlElRef.current?.focus(); - }; + }, []); return [htmlElRef, setFocus]; } diff --git a/packages/website/src/components/hooks/useHashState.ts b/packages/website/src/components/hooks/useHashState.ts index c7cc5fb074d..70293527f18 100644 --- a/packages/website/src/components/hooks/useHashState.ts +++ b/packages/website/src/components/hooks/useHashState.ts @@ -1,31 +1,36 @@ -import { toJsonConfig } from '@site/src/components/config/utils'; -import * as lz from 'lzstring.ts'; -import { useCallback, useEffect, useState } from 'react'; +import { useHistory } from '@docusaurus/router'; +import * as lz from 'lz-string'; +import { useCallback, useState } from 'react'; import { hasOwnProperty } from '../lib/has-own-property'; +import { toJsonConfig } from '../lib/json'; import { shallowEqual } from '../lib/shallowEqual'; -import type { ConfigModel } from '../types'; +import { fileTypes } from '../options'; +import type { ConfigFileType, ConfigModel, ConfigShowAst } from '../types'; -function writeQueryParam(value: string): string { - return lz.LZString.compressToEncodedURIComponent(value); +function writeQueryParam(value: string | null): string { + return (value && lz.compressToEncodedURIComponent(value)) ?? ''; } function readQueryParam(value: string | null, fallback: string): string { - return value - ? lz.LZString.decompressFromEncodedURIComponent(value) ?? fallback - : fallback; + return (value && lz.decompressFromEncodedURIComponent(value)) ?? fallback; } -function readShowAST(value: string | null): 'ts' | 'scope' | 'es' | boolean { +function readShowAST(value: string | null): ConfigShowAst { switch (value) { case 'es': - return 'es'; case 'ts': - return 'ts'; case 'scope': - return 'scope'; + return value; } - return Boolean(value); + return value ? 'es' : false; +} + +function readFileType(value: string | null): ConfigFileType { + if (value && (fileTypes as string[]).includes(value)) { + return value as ConfigFileType; + } + return '.ts'; } function readLegacyParam( @@ -35,13 +40,12 @@ function readLegacyParam( try { return toJsonConfig(JSON.parse(readQueryParam(data, '{}')), prop); } catch (e) { - // eslint-disable-next-line no-console console.error(e, data, prop); } return undefined; } -const parseStateFromUrl = (hash: string): ConfigModel | undefined => { +const parseStateFromUrl = (hash: string): Partial | undefined => { if (!hash) { return; } @@ -66,53 +70,54 @@ const parseStateFromUrl = (hash: string): ConfigModel | undefined => { ); } + const fileType = + searchParams.get('jsx') === 'true' + ? '.tsx' + : readFileType(searchParams.get('fileType')); + + const code = searchParams.has('code') + ? readQueryParam(searchParams.get('code'), '') + : ''; + return { - // @ts-expect-error: process.env.TS_VERSION - ts: (searchParams.get('ts') ?? process.env.TS_VERSION).trim(), - jsx: searchParams.has('jsx'), - showAST: - searchParams.has('showAST') && readShowAST(searchParams.get('showAST')), + ts: searchParams.get('ts') ?? process.env.TS_VERSION!, + showAST: readShowAST(searchParams.get('showAST')), sourceType: - searchParams.has('sourceType') && - searchParams.get('sourceType') === 'script' - ? 'script' - : 'module', - code: searchParams.has('code') - ? readQueryParam(searchParams.get('code'), '') - : '', + searchParams.get('sourceType') === 'script' ? 'script' : 'module', + code, + fileType, eslintrc: eslintrc ?? '', tsconfig: tsconfig ?? '', + showTokens: searchParams.get('tokens') === 'true', }; } catch (e) { - // eslint-disable-next-line no-console console.warn(e); } return undefined; }; -const writeStateToUrl = (newState: ConfigModel): string => { +const writeStateToUrl = (newState: ConfigModel): string | undefined => { try { - return Object.entries({ - ts: newState.ts.trim(), - jsx: newState.jsx, - sourceType: newState.sourceType, - showAST: newState.showAST, - code: newState.code ? writeQueryParam(newState.code) : undefined, - eslintrc: newState.eslintrc - ? writeQueryParam(newState.eslintrc) - : undefined, - tsconfig: newState.tsconfig - ? writeQueryParam(newState.tsconfig) - : undefined, - }) - .filter(item => item[1]) - .map(item => `${encodeURIComponent(item[0])}=${item[1]}`) - .join('&'); + const searchParams = new URLSearchParams(); + searchParams.set('ts', newState.ts.trim()); + if (newState.sourceType === 'script') { + searchParams.set('sourceType', newState.sourceType); + } + if (newState.showAST) { + searchParams.set('showAST', newState.showAST); + } + if (newState.fileType) { + searchParams.set('fileType', newState.fileType); + } + searchParams.set('code', writeQueryParam(newState.code)); + searchParams.set('eslintrc', writeQueryParam(newState.eslintrc)); + searchParams.set('tsconfig', writeQueryParam(newState.tsconfig)); + searchParams.set('tokens', String(!!newState.showTokens)); + return searchParams.toString(); } catch (e) { - // eslint-disable-next-line no-console console.warn(e); } - return ''; + return undefined; }; const retrieveStateFromLocalStorage = (): Partial | undefined => { @@ -134,24 +139,22 @@ const retrieveStateFromLocalStorage = (): Partial | undefined => { state.ts = ts; } } - if (hasOwnProperty('jsx', config)) { - const jsx = config.jsx; - if (typeof jsx === 'boolean') { - state.jsx = jsx; + if (hasOwnProperty('fileType', config)) { + const fileType = config.fileType; + if (fileType === 'true') { + state.fileType = readFileType(fileType); } } if (hasOwnProperty('showAST', config)) { const showAST = config.showAST; - if (typeof showAST === 'boolean') { - state.showAST = showAST; - } else if (typeof showAST === 'string') { + if (typeof showAST === 'string') { state.showAST = readShowAST(showAST); } } + state.scroll = hasOwnProperty('scroll', config) && !!config.scroll; return state; } catch (e) { - // eslint-disable-next-line no-console console.warn(e); } return undefined; @@ -160,8 +163,10 @@ const retrieveStateFromLocalStorage = (): Partial | undefined => { const writeStateToLocalStorage = (newState: ConfigModel): void => { const config: Partial = { ts: newState.ts, - jsx: newState.jsx, + fileType: newState.fileType, + sourceType: newState.sourceType, showAST: newState.showAST, + scroll: newState.scroll, }; window.localStorage.setItem('config', JSON.stringify(config)); }; @@ -169,68 +174,41 @@ const writeStateToLocalStorage = (newState: ConfigModel): void => { function useHashState( initialState: ConfigModel, ): [ConfigModel, (cfg: Partial) => void] { - const [hash, setHash] = useState(window.location.hash.slice(1)); + const history = useHistory(); const [state, setState] = useState(() => ({ ...initialState, ...retrieveStateFromLocalStorage(), ...parseStateFromUrl(window.location.hash.slice(1)), })); - const [tmpState, setTmpState] = useState>(() => ({ - ...initialState, - ...retrieveStateFromLocalStorage(), - ...parseStateFromUrl(window.location.hash.slice(1)), - })); - useEffect(() => { - const newHash = window.location.hash.slice(1); - if (newHash !== hash) { - const newState = parseStateFromUrl(newHash); - if (newState) { - setState(newState); - setTmpState(newState); - } - } - }, [hash]); - - useEffect(() => { - const newState = { ...state, ...tmpState }; - if (!shallowEqual(newState, state)) { - writeStateToLocalStorage(newState); - const newHash = writeStateToUrl(newState); - setState(newState); - setHash(newHash); - - if (window.location.hash.slice(1) !== newHash) { - window.history.pushState( - undefined, - document.title, - `${window.location.pathname}#${newHash}`, - ); - } - } - }, [tmpState, state]); + const updateState = useCallback( + (cfg: Partial) => { + console.info('[State] updating config diff', cfg); - const onHashChange = (): void => { - const newHash = window.location.hash; - // eslint-disable-next-line no-console - console.info('[State] hash change detected', newHash); - setHash(newHash); - }; + setState(oldState => { + const newState = { ...oldState, ...cfg }; - useEffect(() => { - window.addEventListener('popstate', onHashChange); - return (): void => { - window.removeEventListener('popstate', onHashChange); - }; - }, []); + if (shallowEqual(oldState, newState)) { + return oldState; + } + + writeStateToLocalStorage(newState); + + history.replace({ + ...history.location, + hash: writeStateToUrl(newState), + }); - const _setState = useCallback((cfg: Partial) => { - // eslint-disable-next-line no-console - console.info('[State] updating config diff', cfg); - setTmpState(cfg); - }, []); + if (cfg.ts) { + window.location.reload(); + } + return newState; + }); + }, + [setState, history], + ); - return [state, _setState]; + return [state, updateState]; } export default useHashState; diff --git a/packages/website/src/components/inputs/Checkbox.tsx b/packages/website/src/components/inputs/Checkbox.tsx index 0134bfa4001..576678966cb 100644 --- a/packages/website/src/components/inputs/Checkbox.tsx +++ b/packages/website/src/components/inputs/Checkbox.tsx @@ -9,7 +9,7 @@ export interface CheckboxProps { readonly className?: string; } -function Checkbox(props: CheckboxProps): JSX.Element { +function Checkbox(props: CheckboxProps): React.JSX.Element { const { indeterminate } = props; const checkboxRef = useCallback( diff --git a/packages/website/src/components/inputs/CopyButton.module.css b/packages/website/src/components/inputs/CopyButton.module.css new file mode 100644 index 00000000000..c60c53bb545 --- /dev/null +++ b/packages/website/src/components/inputs/CopyButton.module.css @@ -0,0 +1,54 @@ +.copyButtonContainer { + position: absolute; + top: 5px; + right: 5px; + font-family: var(--ifm-font-family-base); + box-sizing: border-box; + line-height: var(--ifm-line-height-base); + font-size: 0.75rem; + text-align: center; +} + +.copyButton { + --ifm-button-padding-vertical: 0.4rem; + --ifm-button-padding-horizontal: 0.4rem; + --ifm-button-background-color: var(--ifm-background-surface-color); + --ifm-button-color: var(--ifm-color-emphasis-700); + --ifm-button-border-color: var(--ifm-color-emphasis-200); + --copy-button-icon-check: 0; + --copy-button-icon-copy: 1; + + font-size: 0.75rem; + align-items: center; + display: flex; + line-height: 0; + transition: opacity 0.2s ease-in-out, border-color 0.4s ease-in-out, + color 0.4s ease-in-out; +} + +.copyButton:disabled { + --ifm-button-background-color: var(--playground-secondary-color); + --ifm-button-color: var(--ifm-color-success-dark); + --ifm-button-border-color: var(--ifm-color-emphasis-200); + --copy-button-icon-check: 1; + --copy-button-icon-copy: 0; + + opacity: 1; +} + +.copyButton:hover, +.copyButton:focus-visible { + --ifm-button-background-color: var(--playground-secondary-color); + --ifm-button-border-color: var(--ifm-color-emphasis-300); +} + +.copyIcon { + opacity: var(--copy-button-icon-copy); + position: absolute; + transition: opacity 0.2s ease-in-out; +} + +.checkIcon { + opacity: var(--copy-button-icon-check); + transition: opacity 0.2s ease-in-out; +} diff --git a/packages/website/src/components/inputs/CopyButton.tsx b/packages/website/src/components/inputs/CopyButton.tsx new file mode 100644 index 00000000000..e4879f14be9 --- /dev/null +++ b/packages/website/src/components/inputs/CopyButton.tsx @@ -0,0 +1,52 @@ +import CheckIcon from '@site/src/icons/check.svg'; +import CopyIcon from '@site/src/icons/copy.svg'; +import clsx from 'clsx'; +import React from 'react'; + +import { useClipboard } from '../../hooks/useClipboard'; +import styles from './CopyButton.module.css'; +import Tooltip from './Tooltip'; + +export interface CopyButtonProps { + readonly value: unknown; + readonly className?: string; +} + +function jsonStringifyRecursive(obj: unknown): string { + const cache = new Set(); + return JSON.stringify( + obj, + (key, value: unknown) => { + if (typeof value === 'object' && value != null) { + if (cache.has(value)) { + return; + } + cache.add(value); + } + return value; + }, + 2, + ); +} + +function CopyButton({ value, className }: CopyButtonProps): React.JSX.Element { + const [on, onCopy] = useClipboard(() => jsonStringifyRecursive(value)); + + return ( +
+ + + +
+ ); +} + +export default CopyButton; diff --git a/packages/website/src/components/inputs/Dropdown.module.css b/packages/website/src/components/inputs/Dropdown.module.css new file mode 100644 index 00000000000..ae9233b6936 --- /dev/null +++ b/packages/website/src/components/inputs/Dropdown.module.css @@ -0,0 +1,20 @@ +.dropdown { + line-height: 1; + font-size: 0.8rem; + font-weight: 500; + border-radius: 6px; + font-family: inherit; + width: 50%; + box-shadow: none; + padding: 0.4rem 0.6rem; + appearance: none; + color: var(--ifm-font-color-secondary); + border: 1px solid var(--ifm-color-emphasis-100); + background: var(--ifm-color-emphasis-200); + transition: border 0.3s ease; +} + +.dropdown:focus { + outline: none; + border-color: var(--ifm-color-primary); +} diff --git a/packages/website/src/components/inputs/Dropdown.tsx b/packages/website/src/components/inputs/Dropdown.tsx index b0236c4d56e..1a8fd14653d 100644 --- a/packages/website/src/components/inputs/Dropdown.tsx +++ b/packages/website/src/components/inputs/Dropdown.tsx @@ -1,7 +1,7 @@ import clsx from 'clsx'; import React from 'react'; -import styles from '../OptionsSelector.module.css'; +import styles from './Dropdown.module.css'; export interface DropdownOption { readonly value: T; @@ -17,9 +17,9 @@ export interface DropdownProps { readonly disabled?: boolean; } -function Dropdown( +function Dropdown( props: DropdownProps, -): JSX.Element { +): React.JSX.Element { const options: DropdownOption[] = props.options.map(option => typeof option !== 'object' ? { label: String(option), value: option } @@ -28,10 +28,10 @@ function Dropdown( return ( ( name={props.name} className={clsx(styles.textInput, props.className)} type={props.type ?? 'text'} + autoComplete="off" placeholder={props.placeholder} ref={ref} /> diff --git a/packages/website/src/components/inputs/Tooltip.module.css b/packages/website/src/components/inputs/Tooltip.module.css index 2d5303e0110..74d247e544c 100644 --- a/packages/website/src/components/inputs/Tooltip.module.css +++ b/packages/website/src/components/inputs/Tooltip.module.css @@ -9,12 +9,13 @@ display: inline-block; } -.tooltip.hover { +.tooltip.hover, +.tooltip.hover span { text-decoration: underline; cursor: pointer; } -.tooltip:after { +.tooltip::after { background-color: var(--tooltip-bg-color); border-radius: 6px; color: var(--tooltip-text-color); @@ -22,7 +23,7 @@ padding: 0.2rem 1rem; text-indent: 0; text-shadow: none; - white-space: normal; + white-space: pre; word-wrap: break-word; z-index: 10; min-width: 6.25rem; @@ -30,7 +31,7 @@ visibility: hidden; } -.tooltip:before { +.tooltip::before { content: ''; z-index: 11; border: var(--tooltip-arrow-size) solid transparent; @@ -39,8 +40,8 @@ visibility: hidden; } -.tooltip:after, -.tooltip:before { +.tooltip::after, +.tooltip::before { box-sizing: border-box; opacity: 0; pointer-events: none; @@ -48,40 +49,40 @@ transition: opacity 120ms ease-out 120ms; } -.tooltip.hover:hover:before, -.tooltip.hover:hover:after, -.tooltip.visible:before, -.tooltip.visible:after { +.tooltip.hover:hover::before, +.tooltip.hover:hover::after, +.tooltip.visible::before, +.tooltip.visible::after { visibility: visible; - opacity: 100%; + opacity: 1; } -.tooltipLeft:after { +.tooltipLeft::after { margin-right: calc(var(--tooltip-arrow-size) * 2); } -.tooltipLeft:before { +.tooltipLeft::before { border-left-color: var(--tooltip-bg-color); } -.tooltipLeft:after, -.tooltipLeft:before { +.tooltipLeft::after, +.tooltipLeft::before { right: calc(100% - var(--tooltip-arrow-size) / 2); top: 50%; transform-origin: left; transform: translateY(-50%); } -.tooltipRight:after { +.tooltipRight::after { margin-left: calc(var(--tooltip-arrow-size) * 2); } -.tooltipRight:before { +.tooltipRight::before { border-right-color: var(--tooltip-bg-color); } -.tooltipRight:after, -.tooltipRight:before { +.tooltipRight::after, +.tooltipRight::before { left: calc(100% - var(--tooltip-arrow-size) / 2); top: 50%; transform-origin: right; diff --git a/packages/website/src/components/inputs/Tooltip.tsx b/packages/website/src/components/inputs/Tooltip.tsx index fcef27e9dc2..af65e9ce5cf 100644 --- a/packages/website/src/components/inputs/Tooltip.tsx +++ b/packages/website/src/components/inputs/Tooltip.tsx @@ -4,14 +4,14 @@ import React from 'react'; import styles from './Tooltip.module.css'; export interface TooltipProps { - readonly children: JSX.Element | (JSX.Element | false)[]; + readonly children: (React.JSX.Element | false)[] | React.JSX.Element; readonly text: string; readonly position?: 'left' | 'right'; readonly open?: boolean; readonly hover?: boolean; } -function Tooltip(props: TooltipProps): JSX.Element { +function Tooltip(props: TooltipProps): React.JSX.Element { return ( void; +} + +function ActionLabel(props: InputLabelProps): React.JSX.Element { + return ( + + ); +} + +export default ActionLabel; diff --git a/packages/website/src/components/layout/AlertBlock.tsx b/packages/website/src/components/layout/AlertBlock.tsx new file mode 100644 index 00000000000..fbe48ecbe85 --- /dev/null +++ b/packages/website/src/components/layout/AlertBlock.tsx @@ -0,0 +1,16 @@ +import React from 'react'; + +export interface AlertBlockProps { + readonly type: 'danger' | 'info' | 'note' | 'success' | 'warning'; + readonly children: React.ReactNode; +} + +function AlertBlock(props: AlertBlockProps): React.JSX.Element { + return ( +
+
{props.children}
+
+ ); +} + +export default AlertBlock; diff --git a/packages/website/src/components/layout/EditorTabs.module.css b/packages/website/src/components/layout/EditorTabs.module.css new file mode 100644 index 00000000000..98ce2454125 --- /dev/null +++ b/packages/website/src/components/layout/EditorTabs.module.css @@ -0,0 +1,30 @@ +.tabContainer { + display: flex; + justify-content: space-between; + background: var(--playground-main-color); + border-bottom: 1px solid var(--ifm-color-emphasis-200); +} + +.tabStyle { + --ifm-button-padding-horizontal: 1rem; + --ifm-button-background-color: var(--ifm-background-surface-color); + --ifm-button-color: var(--ifm-color-emphasis-700); + --ifm-button-border-color: var(--ifm-color-emphasis-200); + + font-size: 0.75rem; +} + +.tabStyle svg { + margin-left: 0.3rem; +} + +.tabStyle:hover { + --ifm-button-background-color: var(--playground-secondary-color); +} + +.tabStyle:disabled { + --ifm-button-background-color: var(--playground-secondary-color); + --ifm-button-color: var(--ifm-color-emphasis-900); + + opacity: 1; +} diff --git a/packages/website/src/components/layout/EditorTabs.tsx b/packages/website/src/components/layout/EditorTabs.tsx new file mode 100644 index 00000000000..0bbdaefa17b --- /dev/null +++ b/packages/website/src/components/layout/EditorTabs.tsx @@ -0,0 +1,55 @@ +import EditIcon from '@site/src/icons/edit.svg'; +import clsx from 'clsx'; +import React from 'react'; + +import styles from './EditorTabs.module.css'; + +export interface EditorTabsProps { + readonly tabs: (T | { value: T; label: string })[]; + readonly active: T; + readonly showVisualEditor?: boolean; + readonly change: (name: T) => void; + readonly showModal?: (name: T) => void; +} + +function EditorTabs({ + tabs, + active, + showVisualEditor, + change, + showModal, +}: EditorTabsProps): React.JSX.Element { + const tabsWithLabels = tabs.map(tab => + typeof tab !== 'object' ? { value: tab, label: String(tab) } : tab, + ); + + return ( +
+
+ {tabsWithLabels.map(item => ( + + ))} +
+ {showVisualEditor && ( + + )} +
+ ); +} + +export default EditorTabs; diff --git a/packages/website/src/components/layout/Expander.module.css b/packages/website/src/components/layout/Expander.module.css index 28640f9c69f..79699d0ee78 100644 --- a/packages/website/src/components/layout/Expander.module.css +++ b/packages/website/src/components/layout/Expander.module.css @@ -19,7 +19,7 @@ width: 100%; background: transparent; text-rendering: optimizelegibility; - -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; font: var(--ifm-font-size-base) / var(--ifm-line-height-base) var(--ifm-font-family-base); text-align: left; diff --git a/packages/website/src/components/layout/Expander.tsx b/packages/website/src/components/layout/Expander.tsx index 90948f956b3..01b49c6d66f 100644 --- a/packages/website/src/components/layout/Expander.tsx +++ b/packages/website/src/components/layout/Expander.tsx @@ -11,7 +11,7 @@ export interface ExpanderProps { readonly label: string; } -function Expander(props: ExpanderProps): JSX.Element { +function Expander(props: ExpanderProps): React.JSX.Element { const { collapsed, toggleCollapsed } = useCollapsible({ initialState: false, }); diff --git a/packages/website/src/components/layout/InputLabel.module.css b/packages/website/src/components/layout/InputLabel.module.css new file mode 100644 index 00000000000..7c4e4491e6a --- /dev/null +++ b/packages/website/src/components/layout/InputLabel.module.css @@ -0,0 +1,25 @@ +.optionLabel { + cursor: pointer; + align-items: center; + display: flex; + flex: 0 0 1.5rem; + flex-direction: row; + font-size: 0.75rem; + margin: 0; + padding: 0.4rem 0.8rem; + transition: background-color var(--ifm-transition-fast) + var(--ifm-transition-timing-default), + color var(--ifm-transition-fast) var(--ifm-transition-timing-default); + color: var(--ifm-font-color-secondary); + justify-content: space-between; + border: none; + background: transparent; + font-family: var(--ifm-font-family-base); + box-sizing: border-box; + line-height: var(--ifm-line-height-base); +} + +.optionLabel:hover { + background-color: var(--ifm-color-emphasis-100); + color: var(--ifm-font-color-primary); +} diff --git a/packages/website/src/components/layout/InputLabel.tsx b/packages/website/src/components/layout/InputLabel.tsx new file mode 100644 index 00000000000..619a41a62c6 --- /dev/null +++ b/packages/website/src/components/layout/InputLabel.tsx @@ -0,0 +1,19 @@ +import React from 'react'; + +import styles from './InputLabel.module.css'; + +export interface InputLabelProps { + readonly name: string; + readonly children: React.ReactNode; +} + +function InputLabel(props: InputLabelProps): React.JSX.Element { + return ( + + ); +} + +export default InputLabel; diff --git a/packages/website/src/components/layout/Loader.module.css b/packages/website/src/components/layout/Loader.module.css index ae7d360432e..b49b68ef6be 100644 --- a/packages/website/src/components/layout/Loader.module.css +++ b/packages/website/src/components/layout/Loader.module.css @@ -2,11 +2,13 @@ 33% { transform: translateY(10px); } + 66% { transform: translateY(-10px); } + 100% { - transform: translateY(0px); + transform: translateY(0); } } diff --git a/packages/website/src/components/layout/Loader.tsx b/packages/website/src/components/layout/Loader.tsx index 86d067c4213..ca0476285da 100644 --- a/packages/website/src/components/layout/Loader.tsx +++ b/packages/website/src/components/layout/Loader.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import styles from './Loader.module.css'; -function Loader(): JSX.Element { +function Loader(): React.JSX.Element { return ( diff --git a/packages/website/src/components/lib/createCompilerOptions.ts b/packages/website/src/components/lib/createCompilerOptions.ts new file mode 100644 index 00000000000..33540cc1b3e --- /dev/null +++ b/packages/website/src/components/lib/createCompilerOptions.ts @@ -0,0 +1,34 @@ +import type * as ts from 'typescript'; + +/** + * Converts compiler options from JSON to ts.CompilerOptions + */ +export function createCompilerOptions( + tsConfig: Record = {}, +): ts.CompilerOptions { + const config = window.ts.convertCompilerOptionsFromJson( + { + target: 'esnext', + module: 'esnext', + jsx: 'preserve', + ...tsConfig, + allowJs: true, + lib: Array.isArray(tsConfig.lib) ? tsConfig.lib : undefined, + moduleResolution: undefined, + plugins: undefined, + typeRoots: undefined, + paths: undefined, + moduleDetection: undefined, + baseUrl: undefined, + }, + '/tsconfig.json', + ); + + const options = config.options; + + if (!options.lib) { + options.lib = [window.ts.getDefaultLibFileName(options)]; + } + + return options; +} diff --git a/packages/website/src/components/lib/createEventsBinder.ts b/packages/website/src/components/lib/createEventsBinder.ts new file mode 100644 index 00000000000..6b5bfaecbee --- /dev/null +++ b/packages/website/src/components/lib/createEventsBinder.ts @@ -0,0 +1,19 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function createEventsBinder void>(): { + trigger: (...args: Parameters) => void; + register: (cb: T) => () => void; +} { + const events = new Set(); + + return { + trigger(...args: Parameters): void { + events.forEach(cb => cb(...args)); + }, + register(cb: T): () => void { + events.add(cb); + return (): void => { + events.delete(cb); + }; + }, + }; +} diff --git a/packages/website/src/components/lib/debounce.ts b/packages/website/src/components/lib/debounce.ts index 87feff49f65..8e4b40ee193 100644 --- a/packages/website/src/components/lib/debounce.ts +++ b/packages/website/src/components/lib/debounce.ts @@ -3,7 +3,7 @@ export function debounce( wait: number, ): (...args: X) => void { // eslint-disable-next-line @typescript-eslint/no-explicit-any - let timeout: any | undefined; + let timeout: any; return function (...args: X): void { // eslint-disable-next-line @typescript-eslint/no-unsafe-argument clearTimeout(timeout); diff --git a/packages/website/src/components/lib/json.ts b/packages/website/src/components/lib/json.ts new file mode 100644 index 00000000000..9b3cb981dcd --- /dev/null +++ b/packages/website/src/components/lib/json.ts @@ -0,0 +1,38 @@ +import json5 from 'json5'; + +import { isRecord } from '../ast/utils'; + +/** + * Validates that the passed value is a record, if not return an empty object + */ +export function ensureObject(obj: unknown): Record { + return isRecord(obj) ? obj : {}; +} + +/** + * Parse a JSON string into an object. If the string is not valid JSON, return an empty object. + */ +export function parseJSONObject(code?: string): Record { + if (code) { + try { + return ensureObject(json5.parse(code)); + } catch (e) { + console.error(e); + } + } + return {}; +} + +/** + * Convert a config object to a JSON string + */ +export function toJson(cfg: unknown): string { + return JSON.stringify(cfg, null, 2); +} + +/** + * Convert a config object to a JSON string, wrapping it in a property + */ +export function toJsonConfig(cfg: unknown, prop: string): string { + return toJson({ [prop]: cfg }); +} diff --git a/packages/website/src/components/lib/jsonSchema.ts b/packages/website/src/components/lib/jsonSchema.ts new file mode 100644 index 00000000000..cc68b440163 --- /dev/null +++ b/packages/website/src/components/lib/jsonSchema.ts @@ -0,0 +1,204 @@ +import type { JSONSchema4 } from '@typescript-eslint/utils/json-schema'; +import type * as ts from 'typescript'; + +import type { CreateLinter } from '../linter/createLinter'; + +const defaultRuleSchema: JSONSchema4 = { + type: ['string', 'number'], + enum: ['off', 'warn', 'error', 0, 1, 2], +}; + +// https://github.com/microsoft/TypeScript/issues/17002 +function isArray(arg: unknown): arg is readonly unknown[] { + return Array.isArray(arg); +} + +/** + * Add the error level to the rule schema items + * + * if you encounter issues with rule schema validation you can check the schema by using the following code in the console: + * monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.find(item => item.uri.includes('typescript-eslint/consistent-type-imports')) + * monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.find(item => item.uri.includes('no-unused-labels')) + * monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas.filter(item => item.schema.type === 'array') + */ +export function getRuleJsonSchemaWithErrorLevel( + name: string, + ruleSchema: JSONSchema4 | readonly JSONSchema4[], +): JSONSchema4 { + if (isArray(ruleSchema)) { + const defaultRuleSchemaCopy = { ...defaultRuleSchema }; + if (ruleSchema[0]?.$defs) { + defaultRuleSchemaCopy.$defs = ruleSchema[0].$defs; + } + return { + type: 'array', + items: [defaultRuleSchemaCopy, ...ruleSchema], + minItems: 1, + additionalItems: false, + }; + } + if (ruleSchema.type === 'array') { + // example: explicit-member-accessibility + if (isArray(ruleSchema.items)) { + return { + ...ruleSchema, + items: [defaultRuleSchema, ...ruleSchema.items], + maxItems: ruleSchema.maxItems ? ruleSchema.maxItems + 1 : undefined, + minItems: ruleSchema.minItems ? ruleSchema.minItems + 1 : 1, + additionalItems: false, + }; + } + // example: naming-convention rule + if (typeof ruleSchema.items === 'object' && ruleSchema.items) { + return { + ...ruleSchema, + items: [defaultRuleSchema], + additionalItems: ruleSchema.items, + }; + } + } + + // example eqeqeq + if (isArray(ruleSchema.anyOf)) { + return { + ...ruleSchema, + anyOf: ruleSchema.anyOf.map(item => + getRuleJsonSchemaWithErrorLevel(name, item), + ), + }; + } + // example logical-assignment-operators + if (isArray(ruleSchema.oneOf)) { + return { + ...ruleSchema, + oneOf: ruleSchema.oneOf.map(item => + getRuleJsonSchemaWithErrorLevel(name, item), + ), + }; + } + if (typeof ruleSchema !== 'object' || Object.keys(ruleSchema).length) { + console.error('unsupported rule schema', name, ruleSchema); + } + return { + type: 'array', + items: [defaultRuleSchema], + minItems: 1, + additionalItems: false, + }; +} + +/** + * Get the JSON schema for the eslint config + * Currently we only support the rules and extends + */ +export function getEslintJsonSchema( + linter: CreateLinter, + createRef: (name: string) => string, +): JSONSchema4 { + const properties: Record = {}; + + for (const [, item] of linter.rules) { + properties[item.name] = { + description: `${item.description}\n ${item.url}`, + title: item.name.startsWith('@typescript') ? 'Rules' : 'Core rules', + default: 'off', + oneOf: [defaultRuleSchema, { $ref: createRef(item.name) }], + }; + } + + return { + type: 'object', + properties: { + extends: { + oneOf: [ + { type: 'string' }, + { + type: 'array', + items: { type: 'string', enum: Object.keys(linter.configs) }, + uniqueItems: true, + }, + ], + }, + rules: { + type: 'object', + properties: properties, + additionalProperties: false, + }, + }, + }; +} + +/** + * Get all typescript options, except for the ones that are not supported by the playground + * this function uses private API from typescript, and this might break in the future + */ +export function getTypescriptOptions(): ts.OptionDeclarations[] { + const allowedCategories = [ + 'Command-line Options', + 'Projects', + 'Compiler Diagnostics', + 'Editor Support', + 'Output Formatting', + 'Watch and Build Modes', + 'Source Map Options', + ]; + + const filteredNames = [ + 'moduleResolution', + 'moduleDetection', + 'plugins', + 'typeRoots', + 'jsx', + ]; + + return window.ts.optionDeclarations.filter( + item => + (item.type === 'boolean' || + item.type === 'list' || + item.type instanceof Map) && + item.description && + item.category && + !allowedCategories.includes(item.category.message) && + !filteredNames.includes(item.name), + ); +} + +/** + * Get the JSON schema for the typescript config + */ +export function getTypescriptJsonSchema(): JSONSchema4 { + const properties = getTypescriptOptions().reduce((options, item) => { + if (item.type === 'boolean') { + options[item.name] = { + type: 'boolean', + description: item.description!.message, + }; + } else if (item.type === 'list' && item.element?.type instanceof Map) { + options[item.name] = { + type: 'array', + items: { + type: 'string', + enum: Array.from(item.element.type.keys()), + }, + description: item.description!.message, + }; + } else if (item.type instanceof Map) { + options[item.name] = { + type: 'string', + description: item.description!.message, + enum: Array.from(item.type.keys()), + }; + } + return options; + }, {}); + + return { + type: 'object', + properties: { + compilerOptions: { + type: 'object', + properties: properties, + }, + }, + }; +} diff --git a/packages/website/src/components/lib/markdown.ts b/packages/website/src/components/lib/markdown.ts index a2f499ba01f..682378c5a5a 100644 --- a/packages/website/src/components/lib/markdown.ts +++ b/packages/website/src/components/lib/markdown.ts @@ -1,10 +1,10 @@ -import { parseESLintRC } from '../config/utils'; import type { ConfigModel } from '../types'; +import { parseESLintRC } from './parseConfig'; -export function createSummary( +function createSummary( value: string, title: string, - type: 'ts' | 'json', + type: 'json' | 'ts', length: number, ): string { const code = `### ${title}\n\n\`\`\`${type}\n${value}\n\`\`\``; @@ -14,41 +14,43 @@ export function createSummary( return code; } -function createSummaryJson( - obj: ConfigModel['tsconfig'] | ConfigModel['eslintrc'], - field: string, - title: string, -): string { - if (obj && Object.keys(obj).length > 0) { +function createSummaryJson(obj: string, field: string, title: string): string { + if (obj && obj.length > 0) { return createSummary(obj, title, 'json', 10); } return ''; } -export function genVersions(state: ConfigModel): string { +function generateVersionsTable(tsVersion: string): string { return [ '| package | version |', '| -- | -- |', `| \`@typescript-eslint/eslint-plugin\` | \`${process.env.TS_ESLINT_VERSION}\` |`, `| \`@typescript-eslint/parser\` | \`${process.env.TS_ESLINT_VERSION}\` |`, - `| \`TypeScript\` | \`${state.ts}\` |`, + `| \`TypeScript\` | \`${tsVersion}\` |`, `| \`ESLint\` | \`${process.env.ESLINT_VERSION}\` |`, `| \`node\` | \`web\` |`, ].join('\n'); } +/** + * Create a markdown string that user can copy and paste into an issue + */ export function createMarkdown(state: ConfigModel): string { return [ `[Playground](${document.location.toString()})`, createSummary(state.code, 'Code', 'ts', 30), createSummaryJson(state.eslintrc, 'rules', 'Eslint config'), createSummaryJson(state.tsconfig, 'compilerOptions', 'TypeScript config'), - genVersions(state), + generateVersionsTable(state.ts), ] .filter(Boolean) .join('\n\n'); } +/** + * Create a URLSearchParams string for the issue template + */ export function createMarkdownParams(state: ConfigModel): string { const { rules } = parseESLintRC(state.eslintrc); const ruleKeys = Object.keys(rules); @@ -66,7 +68,7 @@ export function createMarkdownParams(state: ConfigModel): string { 'repro-code': state.code, 'eslint-config': `module.exports = ${state.eslintrc ?? '{}'}`, 'typescript-config': state.tsconfig ?? '{}', - versions: genVersions(state), + versions: generateVersionsTable(state.ts), }; return new URLSearchParams(params).toString(); diff --git a/packages/website/src/components/lib/parseConfig.ts b/packages/website/src/components/lib/parseConfig.ts new file mode 100644 index 00000000000..c38c553be13 --- /dev/null +++ b/packages/website/src/components/lib/parseConfig.ts @@ -0,0 +1,81 @@ +import { isRecord } from '../ast/utils'; +import type { EslintRC, TSConfig } from '../types'; +import { ensureObject, parseJSONObject, toJson } from './json'; + +/** + * Parse a .eslintrc string into an object. + * This function is pretty naive, as it only validates rules and extends. + */ +export function parseESLintRC(code?: string): EslintRC { + if (code) { + try { + const parsed = parseJSONObject(code); + if ('rules' in parsed) { + parsed.rules = ensureObject(parsed.rules); + } + if ('extends' in parsed) { + parsed.extends = + Array.isArray(parsed.extends) || typeof parsed.extends === 'string' + ? parsed.extends + : []; + } + return parsed as EslintRC; + } catch (e) { + console.error(e); + } + } + return { rules: {} }; +} + +/** + * Parse a tsconfig.json string into an object. + * This is done by typescript compiler. + */ +export function parseTSConfig(code?: string): TSConfig { + if (code) { + try { + const parsed = window.ts.parseConfigFileTextToJson( + '/tsconfig.json', + code, + ); + if (parsed.error) { + console.error(parsed.error); + } + if (isRecord(parsed.config)) { + return parsed.config as TSConfig; + } + } catch (e) { + console.error(e); + } + } + return { compilerOptions: {} }; +} + +const moduleRegexp = /(module\.exports\s*=)/g; + +function constrainedScopeEval(obj: string): unknown { + // eslint-disable-next-line @typescript-eslint/no-implied-eval + return new Function(` + "use strict"; + var module = { exports: {} }; + (${obj}); + return module.exports + `)(); +} + +/** + * Evaluate a string that contains a module.exports assignment. + */ +export function tryParseEslintModule(value: string): string { + try { + if (moduleRegexp.test(value)) { + const newValue = toJson(constrainedScopeEval(value)); + if (newValue !== value) { + return newValue; + } + } + } catch (e) { + console.error(e); + } + return value; +} diff --git a/packages/website/src/components/lib/scroll-into.ts b/packages/website/src/components/lib/scroll-into.ts index 83c221fbbaa..d21dca1d6af 100644 --- a/packages/website/src/components/lib/scroll-into.ts +++ b/packages/website/src/components/lib/scroll-into.ts @@ -1,4 +1,7 @@ -export function scrollIntoViewIfNeeded(target: HTMLElement): void { +/** + * Scroll the target element into view if it is not already visible. + */ +export function scrollIntoViewIfNeeded(target: Element): void { const rect = target.getBoundingClientRect(); const isBelow = rect.top < 0; const isAbove = rect.bottom > window.innerHeight; diff --git a/packages/website/src/components/lib/shallowEqual.ts b/packages/website/src/components/lib/shallowEqual.ts index f1e26ede82d..fc6909430cf 100644 --- a/packages/website/src/components/lib/shallowEqual.ts +++ b/packages/website/src/components/lib/shallowEqual.ts @@ -1,6 +1,9 @@ +/** + * Shallowly compare two objects. + */ export function shallowEqual( - object1: object | undefined | null, - object2: object | undefined | null, + object1: object | null | undefined, + object2: object | null | undefined, ): boolean { if (object1 === object2) { return true; diff --git a/packages/website/src/components/linter/CompilerHost.ts b/packages/website/src/components/linter/CompilerHost.ts deleted file mode 100644 index addbff4de35..00000000000 --- a/packages/website/src/components/linter/CompilerHost.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { LintUtils } from '@typescript-eslint/website-eslint'; -import type { CompilerHost, SourceFile, System } from 'typescript'; - -/** - * Creates an in-memory CompilerHost -which is essentially an extra wrapper to System - * which works with TypeScript objects - returns both a compiler host, and a way to add new SourceFile - * instances to the in-memory file system. - * - * based on typescript-vfs - * @see https://github.com/microsoft/TypeScript-Website/blob/d2613c0e57ae1be2f3a76e94b006819a1fc73d5e/packages/typescript-vfs/src/index.ts#L480 - */ -export function createVirtualCompilerHost( - sys: System, - lintUtils: LintUtils, -): CompilerHost { - return { - ...sys, - getCanonicalFileName: (fileName: string) => fileName, - getDefaultLibFileName: options => - '/' + window.ts.getDefaultLibFileName(options), - getNewLine: () => sys.newLine, - getSourceFile(fileName, languageVersionOrOptions): SourceFile | undefined { - if (this.fileExists(fileName)) { - const file = this.readFile(fileName) ?? ''; - return window.ts.createSourceFile( - fileName, - file, - languageVersionOrOptions, - true, - lintUtils.getScriptKind(fileName, false), - ); - } - return undefined; - }, - useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, - }; -} diff --git a/packages/website/src/components/linter/WebLinter.ts b/packages/website/src/components/linter/WebLinter.ts deleted file mode 100644 index 2038e1ade88..00000000000 --- a/packages/website/src/components/linter/WebLinter.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { createVirtualCompilerHost } from '@site/src/components/linter/CompilerHost'; -import { parseSettings } from '@site/src/components/linter/config'; -import type { ParserOptions } from '@typescript-eslint/types'; -import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; -import type { LintUtils } from '@typescript-eslint/website-eslint'; -import type { - CompilerHost, - CompilerOptions, - SourceFile, - System, -} from 'typescript'; - -const PARSER_NAME = '@typescript-eslint/parser'; - -export class WebLinter { - private readonly host: CompilerHost; - - public storedAST?: TSESTree.Program; - public storedTsAST?: SourceFile; - public storedScope?: Record; - - private compilerOptions: CompilerOptions; - private readonly parserOptions: ParserOptions = { - ecmaFeatures: { - jsx: false, - globalReturn: false, - }, - ecmaVersion: 'latest', - project: ['./tsconfig.json'], - sourceType: 'module', - }; - - private linter: TSESLint.Linter; - private lintUtils: LintUtils; - private rules: TSESLint.Linter.RulesRecord = {}; - - public readonly ruleNames: { name: string; description?: string }[] = []; - public readonly rulesUrl = new Map(); - - constructor( - system: System, - compilerOptions: CompilerOptions, - lintUtils: LintUtils, - ) { - this.compilerOptions = compilerOptions; - this.lintUtils = lintUtils; - this.linter = lintUtils.createLinter(); - - this.host = createVirtualCompilerHost(system, lintUtils); - - this.linter.defineParser(PARSER_NAME, { - parseForESLint: (text, options?: ParserOptions) => { - return this.eslintParse(text, options); - }, - }); - - this.linter.getRules().forEach((item, name) => { - this.ruleNames.push({ - name: name, - description: item.meta?.docs?.description, - }); - this.rulesUrl.set(name, item.meta?.docs?.url); - }); - } - - get eslintConfig(): TSESLint.Linter.Config { - return { - parser: PARSER_NAME, - parserOptions: this.parserOptions, - rules: this.rules, - }; - } - - lint(code: string): TSESLint.Linter.LintMessage[] { - return this.linter.verify(code, this.eslintConfig); - } - - fix(code: string): TSESLint.Linter.FixReport { - return this.linter.verifyAndFix(code, this.eslintConfig, { fix: true }); - } - - updateRules(rules: TSESLint.Linter.RulesRecord): void { - this.rules = rules; - } - - updateParserOptions(jsx?: boolean, sourceType?: TSESLint.SourceType): void { - this.parserOptions.ecmaFeatures!.jsx = jsx ?? false; - this.parserOptions.sourceType = sourceType ?? 'module'; - } - - updateCompilerOptions(options: CompilerOptions = {}): void { - this.compilerOptions = options; - } - - eslintParse( - code: string, - eslintOptions: ParserOptions = {}, - ): TSESLint.Linter.ESLintParseResult { - const isJsx = eslintOptions?.ecmaFeatures?.jsx ?? false; - const fileName = isJsx ? '/demo.tsx' : '/demo.ts'; - - this.storedAST = undefined; - this.storedTsAST = undefined; - this.storedScope = undefined; - - this.host.writeFile(fileName, code, false); - - const program = window.ts.createProgram({ - rootNames: [fileName], - options: this.compilerOptions, - host: this.host, - }); - const tsAst = program.getSourceFile(fileName)!; - - const { estree: ast, astMaps } = this.lintUtils.astConverter( - tsAst, - { ...parseSettings, code, jsx: isJsx }, - true, - ); - - const scopeManager = this.lintUtils.analyze(ast, { - ecmaVersion: - eslintOptions.ecmaVersion === 'latest' - ? 1e8 - : eslintOptions.ecmaVersion, - globalReturn: eslintOptions.ecmaFeatures?.globalReturn ?? false, - sourceType: eslintOptions.sourceType ?? 'script', - }); - - this.storedAST = ast; - this.storedTsAST = tsAst; - this.storedScope = scopeManager as unknown as Record; - - return { - ast, - services: { - hasFullTypeInformation: true, - program, - esTreeNodeToTSNodeMap: astMaps.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: astMaps.tsNodeToESTreeNodeMap, - }, - scopeManager, - visitorKeys: this.lintUtils.visitorKeys, - }; - } -} diff --git a/packages/website/src/components/linter/bridge.ts b/packages/website/src/components/linter/bridge.ts new file mode 100644 index 00000000000..4a4d52e4463 --- /dev/null +++ b/packages/website/src/components/linter/bridge.ts @@ -0,0 +1,79 @@ +import type * as tsvfs from '@site/src/vendor/typescript-vfs'; +import type * as ts from 'typescript'; + +import { debounce } from '../lib/debounce'; +import type { ConfigModel } from '../types'; +import type { PlaygroundSystem } from './types'; + +export function createFileSystem( + config: Pick, + vfs: typeof tsvfs, +): PlaygroundSystem { + const files = new Map(); + files.set(`/.eslintrc`, config.eslintrc); + files.set(`/tsconfig.json`, config.tsconfig); + files.set(`/input${config.fileType}`, config.code); + + const fileWatcherCallbacks = new Map>(); + + const system = vfs.createSystem(files) as PlaygroundSystem; + + system.watchFile = ( + path, + callback, + pollingInterval = 500, + ): ts.FileWatcher => { + const cb = pollingInterval ? debounce(callback, pollingInterval) : callback; + + const escapedPath = path.replace(/\./g, '\\.').replace(/\*/g, '[^/]+'); + const expPath = new RegExp(`^${escapedPath}$`, ''); + + let handle = fileWatcherCallbacks.get(expPath); + if (!handle) { + handle = new Set(); + fileWatcherCallbacks.set(expPath, handle); + } + handle.add(cb); + + return { + close: (): void => { + fileWatcherCallbacks.get(expPath)?.delete(cb); + }, + }; + }; + + const triggerCallbacks = ( + path: string, + type: ts.FileWatcherEventKind, + ): void => { + fileWatcherCallbacks.forEach((callbacks, key) => { + if (key.test(path)) { + callbacks.forEach(cb => cb(path, type)); + } + }); + }; + + system.deleteFile = (fileName): void => { + files.delete(fileName); + triggerCallbacks(fileName, 1); + }; + + system.writeFile = (fileName, contents): void => { + if (!contents) { + contents = ''; + } + const file = files.get(fileName); + if (file === contents) { + // do not trigger callbacks if the file has not changed + return; + } + files.set(fileName, contents); + triggerCallbacks(fileName, file ? 2 : 0); + }; + + system.removeFile = (fileName): void => { + files.delete(fileName); + }; + + return system; +} diff --git a/packages/website/src/components/linter/config.ts b/packages/website/src/components/linter/config.ts index 5fa05a4a11b..fc6389b4e1b 100644 --- a/packages/website/src/components/linter/config.ts +++ b/packages/website/src/components/linter/config.ts @@ -1,27 +1,46 @@ -import type { ParseSettings } from '@typescript-eslint/typescript-estree/dist/parseSettings'; +import type { ParseSettings } from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; +import type { TSESLint } from '@typescript-eslint/utils'; -export const parseSettings: ParseSettings = { +export const PARSER_NAME = '@typescript-eslint/parser'; + +export const defaultParseSettings: ParseSettings = { + allowInvalidAST: false, code: '', + codeFullText: '', comment: true, comments: [], - createDefaultProgram: false, debugLevel: new Set(), + DEPRECATED__createDefaultProgram: false, + errorOnTypeScriptSyntacticAndSemanticIssues: false, errorOnUnknownASTType: false, + EXPERIMENTAL_projectService: undefined, + EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, extraFileExtensions: [], filePath: '', - jsx: false, + jsx: true, loc: true, - // eslint-disable-next-line no-console log: console.log, preserveNodeMaps: true, + programs: null, projects: [], range: true, + singleRun: false, + suppressDeprecatedPropertyWarnings: false, tokens: [], - tsconfigRootDir: '/', tsconfigMatchCache: new Map(), - errorOnTypeScriptSyntacticAndSemanticIssues: false, - EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, - singleRun: false, - programs: null, - moduleResolver: '', + tsconfigRootDir: '/', +}; + +export const defaultEslintConfig: TSESLint.Linter.Config = { + parser: PARSER_NAME, + parserOptions: { + ecmaFeatures: { + jsx: true, + globalReturn: false, + }, + ecmaVersion: 'latest', + project: ['./tsconfig.json'], + sourceType: 'module', + }, + rules: {}, }; diff --git a/packages/website/src/components/linter/createLinter.ts b/packages/website/src/components/linter/createLinter.ts new file mode 100644 index 00000000000..2f0c1725329 --- /dev/null +++ b/packages/website/src/components/linter/createLinter.ts @@ -0,0 +1,181 @@ +import type * as tsvfs from '@site/src/vendor/typescript-vfs'; +import type { JSONSchema, TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type * as ts from 'typescript'; + +import { createCompilerOptions } from '../lib/createCompilerOptions'; +import { createEventsBinder } from '../lib/createEventsBinder'; +import { parseESLintRC, parseTSConfig } from '../lib/parseConfig'; +import { defaultEslintConfig, PARSER_NAME } from './config'; +import { createParser } from './createParser'; +import type { + LinterOnLint, + LinterOnParse, + PlaygroundSystem, + WebLinterModule, +} from './types'; + +export interface CreateLinter { + rules: Map< + string, + { + name: string; + description?: string; + url?: string; + schema: JSONSchema.JSONSchema4 | readonly JSONSchema.JSONSchema4[]; + } + >; + configs: string[]; + triggerFix(filename: string): TSESLint.Linter.FixReport | undefined; + triggerLint(filename: string): void; + onLint(cb: LinterOnLint): () => void; + onParse(cb: LinterOnParse): () => void; + updateParserOptions(sourceType?: TSESLint.SourceType): void; +} + +export function createLinter( + system: PlaygroundSystem, + webLinterModule: WebLinterModule, + vfs: typeof tsvfs, +): CreateLinter { + const rules: CreateLinter['rules'] = new Map(); + const configs = new Map(Object.entries(webLinterModule.configs)); + let compilerOptions: ts.CompilerOptions = {}; + const eslintConfig: TSESLint.Linter.Config = { ...defaultEslintConfig }; + + const onLint = createEventsBinder(); + const onParse = createEventsBinder(); + + const linter = webLinterModule.createLinter(); + + const parser = createParser( + system, + compilerOptions, + (filename, model): void => { + onParse.trigger(filename, model); + }, + webLinterModule, + vfs, + ); + + linter.defineParser(PARSER_NAME, parser); + + linter.getRules().forEach((item, name) => { + rules.set(name, { + name: name, + description: item.meta?.docs?.description, + url: item.meta?.docs?.url, + schema: item.meta?.schema ?? [], + }); + }); + + const triggerLint = (filename: string): void => { + console.info('[Editor] linting triggered for file', filename); + const code = system.readFile(filename) ?? '\n'; + if (code != null) { + try { + const messages = linter.verify(code, eslintConfig, filename); + onLint.trigger(filename, messages); + } catch (e) { + const lintMessage: TSESLint.Linter.LintMessage = { + source: 'eslint', + ruleId: '', + severity: 2, + nodeType: '', + column: 1, + line: 1, + message: String(e instanceof Error ? e.stack : e), + }; + if (typeof e === 'object' && e && 'currentNode' in e) { + const node = e.currentNode as TSESTree.Node; + lintMessage.column = node.loc.start.column + 1; + lintMessage.line = node.loc.start.line; + lintMessage.endColumn = node.loc.end.column + 1; + lintMessage.endLine = node.loc.end.line; + } + onLint.trigger(filename, [lintMessage]); + } + } + }; + + const triggerFix = ( + filename: string, + ): TSESLint.Linter.FixReport | undefined => { + const code = system.readFile(filename); + if (code) { + return linter.verifyAndFix(code, eslintConfig, { + filename: filename, + fix: true, + }); + } + return undefined; + }; + + const updateParserOptions = (sourceType?: TSESLint.SourceType): void => { + eslintConfig.parserOptions ??= {}; + eslintConfig.parserOptions.sourceType = sourceType ?? 'module'; + }; + + const resolveEslintConfig = ( + cfg: Partial, + ): TSESLint.Linter.Config => { + const config = { rules: {} }; + if (cfg.extends) { + const cfgExtends = Array.isArray(cfg.extends) + ? cfg.extends + : [cfg.extends]; + for (const extendsName of cfgExtends) { + const maybeConfig = configs.get(extendsName); + if (maybeConfig) { + const resolved = resolveEslintConfig(maybeConfig); + if (resolved.rules) { + Object.assign(config.rules, resolved.rules); + } + } + } + } + if (cfg.rules) { + Object.assign(config.rules, cfg.rules); + } + return config; + }; + + const applyEslintConfig = (fileName: string): void => { + try { + const file = system.readFile(fileName) ?? '{}'; + const parsed = resolveEslintConfig(parseESLintRC(file)); + eslintConfig.rules = parsed.rules; + console.log('[Editor] Updating', fileName, eslintConfig); + } catch (e) { + console.error(e); + } + }; + + const applyTSConfig = (fileName: string): void => { + try { + const file = system.readFile(fileName) ?? '{}'; + const parsed = parseTSConfig(file).compilerOptions; + compilerOptions = createCompilerOptions(parsed); + console.log('[Editor] Updating', fileName, compilerOptions); + parser.updateConfig(compilerOptions); + } catch (e) { + console.error(e); + } + }; + + system.watchFile('/input.*', triggerLint); + system.watchFile('/.eslintrc', applyEslintConfig); + system.watchFile('/tsconfig.json', applyTSConfig); + + applyEslintConfig('/.eslintrc'); + applyTSConfig('/tsconfig.json'); + + return { + rules, + configs: Array.from(configs.keys()), + triggerFix, + triggerLint, + updateParserOptions, + onParse: onParse.register, + onLint: onLint.register, + }; +} diff --git a/packages/website/src/components/linter/createParser.ts b/packages/website/src/components/linter/createParser.ts new file mode 100644 index 00000000000..1c0d9258a8f --- /dev/null +++ b/packages/website/src/components/linter/createParser.ts @@ -0,0 +1,108 @@ +import type * as tsvfs from '@site/src/vendor/typescript-vfs'; +import type { ParserOptions } from '@typescript-eslint/types'; +import type { TSESLint } from '@typescript-eslint/utils'; +import type * as ts from 'typescript'; + +import { defaultParseSettings } from './config'; +import type { + ParseSettings, + PlaygroundSystem, + UpdateModel, + WebLinterModule, +} from './types'; + +export function createParser( + system: PlaygroundSystem, + compilerOptions: ts.CompilerOptions, + onUpdate: (filename: string, model: UpdateModel) => void, + utils: WebLinterModule, + vfs: typeof tsvfs, +): TSESLint.Linter.ParserModule & { + updateConfig: (compilerOptions: ts.CompilerOptions) => void; +} { + const registeredFiles = new Set(); + + const createEnv = ( + compilerOptions: ts.CompilerOptions, + ): tsvfs.VirtualTypeScriptEnvironment => { + return vfs.createVirtualTypeScriptEnvironment( + system, + Array.from(registeredFiles), + window.ts, + compilerOptions, + ); + }; + + let compilerHost = createEnv(compilerOptions); + + return { + updateConfig(compilerOptions): void { + compilerHost = createEnv(compilerOptions); + }, + parseForESLint: ( + text: string, + options: ParserOptions = {}, + ): TSESLint.Linter.ESLintParseResult => { + const filePath = options.filePath ?? '/input.ts'; + + // if text is empty use empty line to avoid error + const code = text || '\n'; + + if (registeredFiles.has(filePath)) { + compilerHost.updateFile(filePath, code); + } else { + registeredFiles.add(filePath); + compilerHost.createFile(filePath, code); + } + + const parseSettings: ParseSettings = { + ...defaultParseSettings, + code: code, + codeFullText: code, + filePath: filePath, + }; + + const program = compilerHost.languageService.getProgram(); + if (!program) { + throw new Error('Failed to get program'); + } + + const tsAst = program.getSourceFile(filePath)!; + + const converted = utils.astConverter(tsAst, parseSettings, true); + + const scopeManager = utils.analyze(converted.estree, { + globalReturn: options.ecmaFeatures?.globalReturn ?? false, + sourceType: options.sourceType ?? 'module', + }); + + const checker = program.getTypeChecker(); + + onUpdate(filePath, { + storedAST: converted.estree, + storedTsAST: tsAst, + storedScope: scopeManager, + typeChecker: checker, + }); + + return { + ast: converted.estree, + services: { + program, + esTreeNodeToTSNodeMap: converted.astMaps.esTreeNodeToTSNodeMap, + tsNodeToESTreeNodeMap: converted.astMaps.tsNodeToESTreeNodeMap, + getSymbolAtLocation: node => + checker.getSymbolAtLocation( + converted.astMaps.esTreeNodeToTSNodeMap.get(node), + ), + getTypeAtLocation: node => + checker.getTypeAtLocation( + converted.astMaps.esTreeNodeToTSNodeMap.get(node), + ), + }, + scopeManager, + visitorKeys: utils.visitorKeys, + }; + }, + }; +} diff --git a/packages/website/src/components/linter/types.ts b/packages/website/src/components/linter/types.ts new file mode 100644 index 00000000000..540ad0e4521 --- /dev/null +++ b/packages/website/src/components/linter/types.ts @@ -0,0 +1,37 @@ +import type { analyze, ScopeManager } from '@typescript-eslint/scope-manager'; +import type { astConverter } from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; +import type { TSESLint, TSESTree } from '@typescript-eslint/utils'; +import type esquery from 'esquery'; +import type * as ts from 'typescript'; + +export type { ParseSettings } from '@typescript-eslint/typescript-estree/use-at-your-own-risk'; + +export interface UpdateModel { + storedAST?: TSESTree.Program; + storedTsAST?: ts.SourceFile; + storedScope?: ScopeManager; + typeChecker?: ts.TypeChecker; +} + +export interface WebLinterModule { + createLinter: () => TSESLint.Linter; + analyze: typeof analyze; + visitorKeys: TSESLint.SourceCode.VisitorKeys; + astConverter: typeof astConverter; + esquery: typeof esquery; + configs: Record; +} + +export type PlaygroundSystem = Required< + Pick +> & + ts.System & { + removeFile: (fileName: string) => void; + }; + +export type LinterOnLint = ( + fileName: string, + messages: TSESLint.Linter.LintMessage[], +) => void; + +export type LinterOnParse = (fileName: string, model: UpdateModel) => void; diff --git a/packages/website/src/components/linter/utils.ts b/packages/website/src/components/linter/utils.ts index e2a4b3ed1c7..2f6f59f9c14 100644 --- a/packages/website/src/components/linter/utils.ts +++ b/packages/website/src/components/linter/utils.ts @@ -17,7 +17,7 @@ export function ensurePositiveInt( value: number | undefined, defaultValue: number, ): number { - return Math.max(1, (value !== undefined ? value : defaultValue) | 0); + return Math.max(1, (value ?? defaultValue) | 0); } export function createURI(marker: Monaco.editor.IMarkerData): string { @@ -102,8 +102,9 @@ export function parseMarkers( result[group].items.push({ message: - (marker.owner !== 'eslint' && code ? `${code.value}: ` : '') + - marker.message, + (marker.owner !== 'eslint' && marker.owner !== 'json' && code.value + ? `${code.value}: ` + : '') + marker.message, location: `${marker.startLineNumber}:${marker.startColumn} - ${marker.endLineNumber}:${marker.endColumn}`, severity: marker.severity, fixer: fixers.find(item => item.isPreferred), @@ -135,7 +136,7 @@ export function parseLintResults( value: message.ruleId, target: ruleUri(message.ruleId), } - : 'FATAL', + : 'Internal error', severity: message.severity === 2 ? 8 // MarkerSeverity.Error diff --git a/packages/website/src/components/modals/Modal.module.css b/packages/website/src/components/modals/Modal.module.css deleted file mode 100644 index a6209dedd4f..00000000000 --- a/packages/website/src/components/modals/Modal.module.css +++ /dev/null @@ -1,64 +0,0 @@ -.modal { - display: none; - position: fixed; - z-index: 1; - padding-top: 100px; - left: 0; - top: 0; - width: 100%; - height: 100%; - overflow: auto; - background-color: rgba(0, 0, 0, 0.4); -} - -.modal.open { - display: block; -} - -.modalContent { - position: relative; - background-color: var(--ifm-background-surface-color); - border-radius: var(--ifm-global-radius); - margin: auto; - padding: 0; - width: calc(var(--ifm-container-width) * 0.7); - animation-name: animatetop; - animation-duration: 0.4s; - max-width: 95%; -} - -@keyframes animatetop { - from { - top: -30rem; - opacity: 0; - } - to { - top: 0; - opacity: 1; - } -} - -.modalClose { - transition: color var(--ifm-transition-fast) - var(--ifm-transition-timing-default); -} - -.modalClose:hover, -.modalClose:focus { - color: var(--ifm-color-primary); -} - -.modalHeader { - display: flex; - padding: 1rem 1.5rem; - justify-content: space-between; - align-items: baseline; -} - -.modalHeader h2 { - margin: 0; -} - -.modalBody { - padding: 1rem 1.5rem; -} diff --git a/packages/website/src/components/modals/Modal.tsx b/packages/website/src/components/modals/Modal.tsx deleted file mode 100644 index ffc8ca55fef..00000000000 --- a/packages/website/src/components/modals/Modal.tsx +++ /dev/null @@ -1,74 +0,0 @@ -/* eslint-disable jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */ -import CloseIcon from '@site/src/icons/close.svg'; -import clsx from 'clsx'; -import type { MouseEvent } from 'react'; -import React, { useCallback, useEffect } from 'react'; - -import styles from './Modal.module.css'; - -interface ModalProps { - readonly header: string; - readonly children: JSX.Element | (JSX.Element | false)[]; - readonly isOpen: boolean; - readonly onClose: () => void; -} - -function Modal(props: ModalProps): JSX.Element { - const { onClose } = props; - - useEffect(() => { - const closeOnEscapeKeyDown = (e: KeyboardEvent): void => { - if ( - e.key === 'Escape' || - // eslint-disable-next-line deprecation/deprecation -- intentional fallback for old browsers - e.keyCode === 27 - ) { - onClose(); - } - }; - - document.body.addEventListener('keydown', closeOnEscapeKeyDown); - return (): void => { - document.body.removeEventListener('keydown', closeOnEscapeKeyDown); - }; - }, [onClose]); - - const onClick = useCallback( - (e: MouseEvent) => { - if (e.currentTarget === e.target) { - onClose(); - } - }, - [onClose], - ); - - return ( -
-
-
-

{props.header}

- -
-
- {React.Children.map(props.children, child => child)} -
-
-
- ); -} - -export default Modal; diff --git a/packages/website/src/components/options.ts b/packages/website/src/components/options.ts new file mode 100644 index 00000000000..07e50240fb3 --- /dev/null +++ b/packages/website/src/components/options.ts @@ -0,0 +1,46 @@ +import { toJson } from './lib/json'; +import type { ConfigFileType, ConfigModel, ConfigShowAst } from './types'; + +export const detailTabs: { value: ConfigShowAst; label: string }[] = [ + { value: false, label: 'Errors' }, + { value: 'es', label: 'ESTree' }, + { value: 'ts', label: 'TypeScript' }, + { value: 'scope', label: 'Scope' }, +]; + +/** + * List of allowed extensions used in playground + */ +export const fileTypes: ConfigFileType[] = [ + '.ts', + '.tsx', + '.js', + '.jsx', + '.d.ts', + '.cjs', + '.mjs', + '.cts', + '.mts', +]; + +/** + * Default config for the playground + * It's used as a fallback when the URL doesn't contain any config + */ +export const defaultConfig: ConfigModel = { + fileType: '.tsx', + showAST: false, + sourceType: 'module', + code: '', + ts: process.env.TS_VERSION!, + tsconfig: toJson({ + compilerOptions: { + strictNullChecks: true, + }, + }), + eslintrc: toJson({ + rules: {}, + }), + scroll: true, + showTokens: false, +}; diff --git a/packages/website/src/components/types.ts b/packages/website/src/components/types.ts index b63d9bca307..219443b6b95 100644 --- a/packages/website/src/components/types.ts +++ b/packages/website/src/components/types.ts @@ -1,38 +1,37 @@ import type { TSESLint } from '@typescript-eslint/utils'; +import type * as ts from 'typescript'; export type CompilerFlags = Record; export type SourceType = TSESLint.SourceType; export type RulesRecord = TSESLint.Linter.RulesRecord; -export type RuleEntry = TSESLint.Linter.RuleEntry; export interface RuleDetails { name: string; description?: string; + url?: string; } -export type TabType = 'code' | 'tsconfig' | 'eslintrc'; +export type TabType = 'code' | 'eslintrc' | 'tsconfig'; + +export type ConfigFileType = `${ts.Extension}`; + +export type ConfigShowAst = 'es' | 'scope' | 'ts' | false; export interface ConfigModel { - jsx?: boolean; + fileType?: ConfigFileType; sourceType?: SourceType; eslintrc: string; tsconfig: string; code: string; ts: string; - showAST?: boolean | 'ts' | 'es' | 'scope'; + showAST?: ConfigShowAst; + scroll?: boolean; + showTokens?: boolean; } -export interface SelectedPosition { - line: number; - column: number; -} - -export interface SelectedRange { - start: SelectedPosition; - end: SelectedPosition; -} +export type SelectedRange = [number, number]; export interface ErrorItem { message: string; diff --git a/packages/website/src/css/custom.css b/packages/website/src/css/custom.css index 6f6138f49d5..a97b0c184ca 100644 --- a/packages/website/src/css/custom.css +++ b/packages/website/src/css/custom.css @@ -1,17 +1,17 @@ /* stylelint-disable docusaurus/copyright-header */ + /** * Any CSS included here will be global. The classic template * bundles Infima by default. Infima is a CSS framework designed to * work well for content-centric websites. */ -@import './prism.css'; +@import url('./prism.css'); /* You can override the default Infima variables here. */ html:root { --color-blurple: #2656c7; --color-blurple-shadow: #111e80; - --ifm-color-primary: #3535e5; --ifm-color-primary-dark: #1b43d4; --ifm-color-primary-darker: var(--color-blurple); @@ -22,12 +22,10 @@ html:root { --ifm-code-font-size: 95%; --ifm-color-info: var(--ifm-color-primary-dark); --ifm-link-color: var(--ifm-color-primary-dark); - - --code-line-decoration: rgba(112, 53, 229, 0.1); - --code-editor-bg: #ffffff; - + --code-line-decoration: rgb(112 53 229 / 10%); + --code-editor-bg: #fff; --docsearch-muted-color: #666; - --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1); + --docusaurus-highlighted-code-line-bg: rgb(0 0 0 / 10%); } html[data-theme='dark']:root { @@ -39,36 +37,29 @@ html[data-theme='dark']:root { --ifm-color-primary-light: #889dfa; --ifm-color-primary-lighter: #b1c5fd; --ifm-color-primary-lightest: #c5d1ff; - --ifm-button-background-color: var(--ifm-color-primary-dark); - --ifm-code-background: rgb(43, 40, 54); - --ifm-code-color: rgb(248, 248, 242); + --ifm-code-background: rgb(43 40 54); + --ifm-code-color: rgb(248 248 242); --ifm-color-info: var(--ifm-color-primary-light); --ifm-link-color: var(--ifm-color-primary-light); --ifm-menu-color-active: var(--ifm-color-primary-light); --ifm-navbar-link-hover-color: var(--ifm-color-primary-light); - - --code-line-decoration: rgba(255, 255, 255, 0.1); + --code-line-decoration: rgb(255 255 255 / 10%); --code-editor-bg: #1e1e1e; - --ifm-tabs-color-active: var(--ifm-color-primary-light); --ifm-toc-border-color: var(--ifm-background-surface-color); --ifm-footer-background-color: var(--ifm-background-surface-color); - --ifm-color-secondary-contrast-background: var( --ifm-background-surface-color ); - --ifm-color-secondary-dark: #2c2d2f; - --ifm-color-secondary-darker: rgb(200, 201, 204); - --ifm-color-secondary-darkest: rgb(164, 166, 168); - - scrollbar-color: #454a4d #202324; - + --ifm-color-secondary-darker: rgb(200 201 204); + --ifm-color-secondary-darkest: rgb(164 166 168); --docsearch-muted-color: #aaa; - --docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3); - + --docusaurus-highlighted-code-line-bg: rgb(0 0 0 / 30%); --gray-border-shadow: var(--ifm-color-secondary-dark); + + scrollbar-color: #454a4d #202324; } .image-link { @@ -78,47 +69,50 @@ html[data-theme='dark']:root { justify-content: flex-start; } -.image-link:before { +.image-link::before { content: ''; display: flex; } /* assumes icons are black by default and inverts them for dark mode so they're white */ -html[data-theme='dark'] .image-link:before { +html[data-theme='dark'] .image-link::before { filter: invert(100%); } -.bug-report-link:before { +.bug-report-link::before { background: url('/img/bug-report.svg') no-repeat; } -.discord-link:before { - background: url('/img/discord.svg') no-repeat; - background-position: center; + +.discord-link::before { + background: url('/img/discord.svg') no-repeat center; } -.github-link:before { + +.github-link::before { background: url('/img/github.svg') no-repeat; } -.mastodon-link:before { + +.mastodon-link::before { background: url('/img/mastodon.svg') no-repeat; } -.stack-overflow-link:before { - background: url('/img/stack-overflow.svg') no-repeat; -} -.stack-overflow-link:before { + +.stack-overflow-link::before { background: url('/img/stack-overflow.svg') no-repeat; } -.twitter-link:before { + +.twitter-link::before { background: url('/img/twitter.svg') no-repeat; } + .header-github-link:hover { opacity: 0.6; } -.header-github-link:before { + +.header-github-link::before { height: 24px; width: 24px; } -.social-link-icon:before { +.social-link-icon::before { height: 20px; margin-right: 4px; width: 20px; @@ -156,7 +150,7 @@ h6 { .code-block-removed-line::before { content: '-'; display: inline-block; - width: 0px; + width: 0; position: relative; left: -0.7em; color: red; @@ -173,10 +167,10 @@ h6 { .code-block-added-line::before { content: '+'; display: inline-block; - width: 0px; + width: 0; position: relative; left: -0.7em; - color: rgb(2, 164, 113); + color: rgb(2 164 113); font-weight: 700; } diff --git a/packages/website/src/css/prism.css b/packages/website/src/css/prism.css index f4dcc311e48..cb71c164fb7 100644 --- a/packages/website/src/css/prism.css +++ b/packages/website/src/css/prism.css @@ -2,36 +2,32 @@ --token-color: #393a34; --token-background: #f6f8fa; --token-border: var(--ifm-color-emphasis-300); - - --token-color-comment: #999988; + --token-color-comment: #998; --token-color-doctype: #008000; --token-color-string: #a31515; --token-color-operator: #393a34; --token-color-symbol: #36acaa; --token-color-number: #098658; - --token-color-keyword: #0000ff; + --token-color-keyword: #00f; --token-color-function: #569cd6; - --token-color-function-variable: #000000; + --token-color-function-variable: #000; --token-color-important: #e90; --token-color-class-name: #2b91af; --token-color-selector: #800000; --token-color-regexp: #800000; - --token-color-property: #dd0000; - --token-color-builtin: #0000ff; - --token-color-boolean: #0000ff; - + --token-color-property: #d00; + --token-color-builtin: #00f; + --token-color-boolean: #00f; --token-color-inserted: #247e81; --token-color-deleted: #d73a49; --token-color-unchanged: #a7a9a8; - - --token-color-highlight: rgba(193, 222, 241, 0.2); + --token-color-highlight: rgb(193 222 241 / 20%); } html[data-theme='dark'] { --token-color: #f8f8f2; --token-background: var(--ifm-background-surface-color); --token-border: #414458; - --token-color-comment: #737373; --token-color-doctype: #6a9955; --token-color-string: #6a9955; @@ -48,19 +44,18 @@ html[data-theme='dark'] { --token-color-property: #ce9178; --token-color-builtin: #569cd6; --token-color-boolean: #569cd6; - --token-color-inserted: #50fa7b; --token-color-deleted: #f55; --token-color-unchanged: #a6a6a6; - - --token-color-highlight: rgba(247, 235, 198, 0.2); + --token-color-highlight: rgb(247 235 198 / 20%); } .theme-code-block, .theme-code-block pre { + --ifm-color-emphasis-300: var(--token-border); + color: var(--token-color) !important; background-color: var(--token-background) !important; - --ifm-color-emphasis-300: var(--token-border); } .token.comment { diff --git a/packages/website/src/globals.d.ts b/packages/website/src/globals.d.ts index 910571ed8e6..0f4c2463b06 100644 --- a/packages/website/src/globals.d.ts +++ b/packages/website/src/globals.d.ts @@ -1,19 +1,13 @@ -import type * as SandboxFactory from '@site/src/vendor/sandbox'; -import type * as TsWorker from '@site/src/vendor/tsWorker'; -import type { LintUtils } from '@typescript-eslint/website-eslint'; import type esquery from 'esquery'; -import type MonacoType from 'monaco-editor'; -import type * as TSType from 'typescript'; +import type * as ts from 'typescript'; declare global { - type WindowRequireCb = ( - main: typeof MonacoType, - tsWorker: typeof TsWorker, - sandboxFactory: typeof SandboxFactory, - lintUtils: LintUtils, - ) => void; interface WindowRequire { - (files: string[], cb: WindowRequireCb): void; + ( + files: string[], + success?: (...arg: T) => void, + error?: (e: Error) => void, + ): void; config: (arg: { paths?: Record; ignoreDuplicateModules?: string[]; @@ -21,8 +15,9 @@ declare global { } interface Window { - ts: typeof TSType; + ts: typeof ts; require: WindowRequire; esquery: typeof esquery; + system: unknown; } } diff --git a/packages/website/src/hooks/useBool.ts b/packages/website/src/hooks/useBool.ts new file mode 100644 index 00000000000..b06c9c40e5a --- /dev/null +++ b/packages/website/src/hooks/useBool.ts @@ -0,0 +1,15 @@ +import type { Dispatch, SetStateAction } from 'react'; +import { useCallback, useState } from 'react'; + +export function useBool( + initialState: boolean | (() => boolean), +): [boolean, () => void, Dispatch>] { + const [value, setValue] = useState(initialState); + + const toggle = useCallback( + (): void => setValue(currentValue => !currentValue), + [], + ); + + return [value, toggle, setValue]; +} diff --git a/packages/website/src/hooks/useClipboard.ts b/packages/website/src/hooks/useClipboard.ts new file mode 100644 index 00000000000..c97ecf38314 --- /dev/null +++ b/packages/website/src/hooks/useClipboard.ts @@ -0,0 +1,17 @@ +import { useCallback } from 'react'; + +import { useDebouncedToggle } from './useDebouncedToggle'; + +export type useClipboardResult = [copied: boolean, copy: () => void]; + +export function useClipboard(code: () => string): useClipboardResult { + const [copied, setCopied] = useDebouncedToggle(false); + + const copy = useCallback(() => { + void navigator.clipboard.writeText(code()).then(() => { + setCopied(true); + }); + }, [setCopied, code]); + + return [copied, copy]; +} diff --git a/packages/website/src/components/hooks/useDebouncedToggle.ts b/packages/website/src/hooks/useDebouncedToggle.ts similarity index 92% rename from packages/website/src/components/hooks/useDebouncedToggle.ts rename to packages/website/src/hooks/useDebouncedToggle.ts index d857f4aea2c..428955c3be7 100644 --- a/packages/website/src/components/hooks/useDebouncedToggle.ts +++ b/packages/website/src/hooks/useDebouncedToggle.ts @@ -1,6 +1,6 @@ import { useCallback, useRef, useState } from 'react'; -export default function useDebouncedToggle( +export function useDebouncedToggle( value: T, timeout = 1000, ): [T, (data: T) => void] { diff --git a/packages/website/src/hooks/useHistorySelector.ts b/packages/website/src/hooks/useHistorySelector.ts new file mode 100644 index 00000000000..841c100b83b --- /dev/null +++ b/packages/website/src/hooks/useHistorySelector.ts @@ -0,0 +1,17 @@ +import { useHistory } from '@docusaurus/router'; +import type * as H from 'history'; +import { useSyncExternalStore } from 'react'; + +export type HistorySelector = (history: H.History) => T; + +export function useHistorySelector( + selector: HistorySelector, + getServerSnapshot: () => T, +): T { + const history = useHistory(); + return useSyncExternalStore( + history.listen, + () => selector(history), + getServerSnapshot, + ); +} diff --git a/packages/website/src/icons/check.svg b/packages/website/src/icons/check.svg new file mode 100644 index 00000000000..7835588c478 --- /dev/null +++ b/packages/website/src/icons/check.svg @@ -0,0 +1,9 @@ + + + diff --git a/packages/website/src/icons/copy.svg b/packages/website/src/icons/copy.svg index 573a7c00477..6625354aa3f 100644 --- a/packages/website/src/icons/copy.svg +++ b/packages/website/src/icons/copy.svg @@ -5,5 +5,5 @@ height="18" fill="currentColor" > - + diff --git a/packages/website/src/pages/index.tsx b/packages/website/src/pages/index.tsx index e82e7e7495b..be25b707ba4 100644 --- a/packages/website/src/pages/index.tsx +++ b/packages/website/src/pages/index.tsx @@ -11,7 +11,7 @@ import styles from './styles.module.css'; interface FeatureItem { title: string; - description: JSX.Element; + description: React.JSX.Element; imageUrl?: string; } @@ -106,7 +106,7 @@ const features: FeatureItem[] = [ }, ]; -function Feature({ title, description }: FeatureItem): JSX.Element { +function Feature({ title, description }: FeatureItem): React.JSX.Element { return (
@@ -130,7 +130,7 @@ function Feature({ title, description }: FeatureItem): JSX.Element { ); } -function Home(): JSX.Element { +function Home(): React.JSX.Element { const { siteConfig } = useDocusaurusContext(); return ( @@ -161,7 +161,7 @@ function Home(): JSX.Element { key={idx} className={clsx( styles.features, - idx % 2 == 1 ? styles.lightBackground : '', + idx % 2 === 1 ? styles.lightBackground : '', )} >
diff --git a/packages/website/src/pages/play.tsx b/packages/website/src/pages/play.tsx index 9983ed770e5..0080ebb226c 100644 --- a/packages/website/src/pages/play.tsx +++ b/packages/website/src/pages/play.tsx @@ -3,15 +3,17 @@ import Loader from '@site/src/components/layout/Loader'; import Layout from '@theme/Layout'; import React, { lazy, Suspense } from 'react'; -function Play(): JSX.Element { +function Play(): React.JSX.Element { return ( }> - {(): JSX.Element => { + {(): React.JSX.Element => { const Playground = lazy( () => // @ts-expect-error: This does not follow Node resolution - import('../components/Playground') as Promise<() => JSX.Element>, + import('../components/Playground') as Promise< + () => React.JSX.Element + >, ); return ( }> diff --git a/packages/website/src/pages/styles.module.css b/packages/website/src/pages/styles.module.css index eec92f56346..ee93e62557c 100644 --- a/packages/website/src/pages/styles.module.css +++ b/packages/website/src/pages/styles.module.css @@ -6,14 +6,15 @@ */ .hero { + --ifm-font-color-base: var(--ifm-color-white); + --ifm-button-color: var(--ifm-color-white); + background-color: var(--color-blurple-shadow); background-image: linear-gradient( 135deg, var(--color-blurple) 0%, var(--color-blurple-shadow) 100% ); - --ifm-font-color-base: var(--ifm-color-white); - --ifm-button-color: var(--ifm-color-white); text-align: center; } @@ -28,6 +29,7 @@ .buttons { --ifm-button-size-multiplier: 1.6; + display: flex; flex-wrap: wrap; align-items: center; @@ -37,7 +39,8 @@ .buttons a { --ifm-font-color-base: var(--ifm-color-white); --ifm-button-color: var(--ifm-color-white); - margin: 1rem 1rem; + + margin: 1rem; } .buttonCentered { diff --git a/packages/website/src/prism/language/jsonc.js b/packages/website/src/prism/language/jsonc.js index c42733fb7d6..6ca349dc45c 100644 --- a/packages/website/src/prism/language/jsonc.js +++ b/packages/website/src/prism/language/jsonc.js @@ -1,3 +1,5 @@ +/* global Prism */ + // https://www.json.org/json-en.html Prism.languages.cjson = { property: { diff --git a/packages/website/src/theme/CodeBlock/Content/String.tsx b/packages/website/src/theme/CodeBlock/Content/String.tsx index 9ea2df703b2..12f20a4de10 100644 --- a/packages/website/src/theme/CodeBlock/Content/String.tsx +++ b/packages/website/src/theme/CodeBlock/Content/String.tsx @@ -14,12 +14,11 @@ import CopyButton from '@theme/CodeBlock/CopyButton'; import Line from '@theme/CodeBlock/Line'; import WordWrapButton from '@theme/CodeBlock/WordWrapButton'; import clsx from 'clsx'; -import Highlight, { type Language, defaultProps } from 'prism-react-renderer'; +import Highlight, { defaultProps, type Language } from 'prism-react-renderer'; import React from 'react'; import styles from './styles.module.css'; -// eslint-disable-next-line import/no-default-export export default function CodeBlockString({ children, className: blockClassName = '', @@ -27,7 +26,7 @@ export default function CodeBlockString({ title: titleProp, showLineNumbers: showLineNumbersProp, language: languageProp, -}: Props): JSX.Element { +}: Props): React.JSX.Element { const { prism: { defaultLanguage, magicComments }, } = useThemeConfig(); @@ -77,7 +76,7 @@ export default function CodeBlockString({ tokens, getLineProps, getTokenProps, - }): JSX.Element => ( + }): React.JSX.Element => (
       
{emoji}
diff --git a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx index 572ab28dad8..9094d8a980f 100644 --- a/packages/website/src/theme/MDXComponents/RuleAttributes.tsx +++ b/packages/website/src/theme/MDXComponents/RuleAttributes.tsx @@ -7,12 +7,18 @@ import type { FeatureProps } from './Feature'; import { Feature } from './Feature'; import styles from './RuleAttributes.module.css'; -const getRecommendation = (docs: RuleMetaDataDocs): [string, string] => { - return docs.recommended === 'strict' - ? ['🔒', 'strict'] - : docs.requiresTypeChecking - ? ['🧠', 'recommended-requiring-type-checking'] - : ['✅', 'recommended']; +const recommendations = { + recommended: ['✅', 'recommended'], + strict: ['🔒', 'strict'], + stylistic: ['🎨', 'stylistic'], +}; + +const getRecommendation = (docs: RuleMetaDataDocs): string[] => { + const recommendation = recommendations[docs.recommended!]; + + return docs.requiresTypeChecking + ? [recommendation[0], `${recommendation[1]}-type-checked`] + : recommendation; }; export function RuleAttributes({ name }: { name: string }): React.ReactNode { diff --git a/packages/website/src/theme/MDXComponents/index.tsx b/packages/website/src/theme/MDXComponents/index.tsx index c810e8b7283..3d6f79de755 100644 --- a/packages/website/src/theme/MDXComponents/index.tsx +++ b/packages/website/src/theme/MDXComponents/index.tsx @@ -3,7 +3,6 @@ import MDXComponents from '@theme-original/MDXComponents'; import { RuleAttributes } from './RuleAttributes'; import { TryInPlayground } from './TryInPlayground'; -// eslint-disable-next-line import/no-default-export export default { ...MDXComponents, 'rule-attributes': RuleAttributes, diff --git a/packages/website/src/theme/prism-include-languages.js b/packages/website/src/theme/prism-include-languages.js index dd315925c22..660275a1af1 100644 --- a/packages/website/src/theme/prism-include-languages.js +++ b/packages/website/src/theme/prism-include-languages.js @@ -8,7 +8,7 @@ export default function prismIncludeLanguages(PrismObject) { globalThis.Prism = PrismObject; additionalLanguages.forEach(lang => { - require(`prismjs/components/prism-${lang}`); // eslint-disable-line + require(`prismjs/components/prism-${lang}`); }); require(`../prism/language/jsonc`); diff --git a/packages/website/src/vendor/ds/createDesignSystem.d.ts b/packages/website/src/vendor/ds/createDesignSystem.d.ts deleted file mode 100644 index 7a506961350..00000000000 --- a/packages/website/src/vendor/ds/createDesignSystem.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -import type { Sandbox } from '../sandbox'; -import type { DiagnosticRelatedInformation, Node } from 'typescript'; - -export declare interface LocalStorageOption { - blurb: string; - flag: string; - display: string; - emptyImpliesEnabled?: true; - oneline?: true; - requireRestart?: true; - onchange?: (newValue: boolean) => void; -} -export declare interface OptionsListConfig { - style: 'separated' | 'rows'; - requireRestart?: true; -} -export declare type DesignSystem = ReturnType< - ReturnType ->; -export declare const createDesignSystem: (sandbox: Sandbox) => ( - container: Element, -) => { - /** The element of the design system */ - container: Element; - /** Clear the sidebar */ - clear: () => void; - /** Present code in a pre > code */ - code: (code: string) => HTMLElement; - /** Ideally only use this once, and maybe even prefer using subtitles everywhere */ - title: (title: string) => HTMLElement; - /** Used to denote sections, give info etc */ - subtitle: (subtitle: string) => HTMLElement; - /** Used to show a paragraph */ - p: (subtitle: string) => HTMLElement; - /** When you can't do something, or have nothing to show */ - showEmptyScreen: (message: string) => HTMLDivElement; - /** - * Shows a list of hoverable, and selectable items (errors, highlights etc) which have code representation. - * The type is quite small, so it should be very feasible for you to massage other data to fit into this function - */ - listDiags: ( - model: import('monaco-editor').editor.ITextModel, - diags: DiagnosticRelatedInformation[], - ) => HTMLUListElement; - /** Lets you remove the hovers from listDiags etc */ - clearDeltaDecorators: (force?: true | undefined) => void; - /** Shows a single option in local storage (adds an li to the container BTW) */ - localStorageOption: (setting: LocalStorageOption) => HTMLLIElement; - /** Uses localStorageOption to create a list of options */ - showOptionList: ( - options: LocalStorageOption[], - style: OptionsListConfig, - ) => void; - /** Shows a full-width text input */ - createTextInput: (config: { - id: string; - placeholder: string; - onChanged?: ((text: string, input: HTMLInputElement) => void) | undefined; - onEnter: (text: string, input: HTMLInputElement) => void; - value?: string | undefined; - keepValueAcrossReloads?: true | undefined; - isEnabled?: ((input: HTMLInputElement) => boolean) | undefined; - }) => HTMLFormElement; - /** Renders an AST tree */ - createASTTree: ( - node: Node, - settings?: - | { - closedByDefault?: true | undefined; - } - | undefined, - ) => HTMLDivElement; - /** Creates an input button */ - button: (settings: { - label: string; - onclick?: ((ev: MouseEvent) => void) | undefined; - }) => HTMLInputElement; - /** Used to re-create a UI like the tab bar at the top of the plugins section */ - createTabBar: () => HTMLDivElement; - /** Used with createTabBar to add buttons */ - createTabButton: (text: string) => HTMLButtonElement; - /** A general "restart your browser" message */ - declareRestartRequired: (i?: ((key: string) => string) | undefined) => void; - /** Create a new Design System instance and add it to the container. You'll need to cast - * this after usage, because otherwise the type-system circularly references itself - */ - createSubDesignSystem: () => any; -}; diff --git a/packages/website/src/vendor/playground.d.ts b/packages/website/src/vendor/playground.d.ts deleted file mode 100644 index 8de9141b661..00000000000 --- a/packages/website/src/vendor/playground.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { PluginUtils } from './pluginUtils'; -import type React from 'react'; - -declare type Sandbox = import('./sandbox').Sandbox; -declare type Monaco = typeof import('monaco-editor'); -export { PluginUtils } from './pluginUtils'; -export declare interface PluginFactory { - ( - i: (key: string, components?: any) => string, - utils: PluginUtils, - ): PlaygroundPlugin; -} - -/** The interface of all sidebar plugins */ -export interface PlaygroundPlugin { - /** Not public facing, but used by the playground to uniquely identify plugins */ - id: string; - /** To show in the tabs */ - displayName: string; - /** Should this plugin be selected when the plugin is first loaded? Lets you check for query vars etc to load a particular plugin */ - shouldBeSelected?: () => boolean; - /** Before we show the tab, use this to set up your HTML - it will all be removed by the playground when someone navigates off the tab */ - willMount?: (sandbox: Sandbox, container: HTMLDivElement) => void; - /** After we show the tab */ - didMount?: (sandbox: Sandbox, container: HTMLDivElement) => void; - /** Model changes while this plugin is actively selected */ - modelChanged?: ( - sandbox: Sandbox, - model: import('monaco-editor').editor.ITextModel, - container: HTMLDivElement, - ) => void; - /** Delayed model changes while this plugin is actively selected, useful when you are working with the TS API because it won't run on every keypress */ - modelChangedDebounce?: ( - sandbox: Sandbox, - model: import('monaco-editor').editor.ITextModel, - container: HTMLDivElement, - ) => void; - /** Before we remove the tab */ - willUnmount?: (sandbox: Sandbox, container: HTMLDivElement) => void; - /** After we remove the tab */ - didUnmount?: (sandbox: Sandbox, container: HTMLDivElement) => void; - /** An object you can use to keep data around in the scope of your plugin object */ - data?: any; -} -interface PlaygroundConfig { - /** Language like "en" / "ja" etc */ - lang: string; - /** Site prefix, like "v2" during the pre-release */ - prefix: string; - /** Optional plugins so that we can re-use the playground with different sidebars */ - plugins?: PluginFactory[]; - /** Should this playground load up custom plugins from localStorage? */ - supportCustomPlugins: boolean; -} -export declare const setupPlayground: ( - sandbox: Sandbox, - monaco: Monaco, - config: PlaygroundConfig, - i: (key: string) => string, - react: typeof React, -) => { - exporter: { - openProjectInStackBlitz: () => void; - openProjectInCodeSandbox: () => void; - copyAsMarkdownIssue: ( - e: React.MouseEvent, - ) => Promise; - copyForChat: (e: React.MouseEvent) => boolean; - copyForChatWithPreview: ( - e: React.MouseEvent, - ) => boolean; - openInTSAST: () => void; - openInBugWorkbench: () => void; - openInVSCodeDev: () => void; - exportAsTweet: () => void; - }; - // ui: import("./createUI").UI; - registerPlugin: (plugin: PlaygroundPlugin) => void; - plugins: PlaygroundPlugin[]; - getCurrentPlugin: () => PlaygroundPlugin; - tabs: HTMLButtonElement[]; - setDidUpdateTab: ( - func: ( - newPlugin: PlaygroundPlugin, - previousPlugin: PlaygroundPlugin, - ) => void, - ) => void; - createUtils: ( - sb: any, - react: typeof React, - ) => { - el: (str: string, elementType: string, container: Element) => HTMLElement; - requireURL: (path: string) => string; - react: typeof React; - createDesignSystem: (container: Element) => { - container: Element; - clear: () => void; - code: (code: string) => HTMLElement; - title: (title: string) => HTMLElement; - subtitle: (subtitle: string) => HTMLElement; - p: (subtitle: string) => HTMLElement; - showEmptyScreen: (message: string) => HTMLDivElement; - listDiags: ( - model: import('monaco-editor').editor.ITextModel, - diags: import('typescript').DiagnosticRelatedInformation[], - ) => HTMLUListElement; - clearDeltaDecorators: (force?: true | undefined) => void; - localStorageOption: ( - setting: import('./ds/createDesignSystem').LocalStorageOption, - ) => HTMLLIElement; - showOptionList: ( - options: import('./ds/createDesignSystem').LocalStorageOption[], - style: import('./ds/createDesignSystem').OptionsListConfig, - ) => void; - createTextInput: (config: { - id: string; - placeholder: string; - onChanged?: - | ((text: string, input: HTMLInputElement) => void) - | undefined; - onEnter: (text: string, input: HTMLInputElement) => void; - value?: string | undefined; - keepValueAcrossReloads?: true | undefined; - isEnabled?: ((input: HTMLInputElement) => boolean) | undefined; - }) => HTMLFormElement; - createASTTree: ( - node: import('typescript').Node, - settings?: - | { - closedByDefault?: true | undefined; - } - | undefined, - ) => HTMLDivElement; - button: (settings: { - label: string; - onclick?: ((ev: MouseEvent) => void) | undefined; - }) => HTMLInputElement; - createTabBar: () => HTMLDivElement; - createTabButton: (text: string) => HTMLButtonElement; - declareRestartRequired: ( - i?: ((key: string) => string) | undefined, - ) => void; - createSubDesignSystem: () => any; - }; - flashHTMLElement: (element: HTMLElement) => void; - setNotifications: (pluginID: string, amount: number) => void; - }; -}; -export declare type Playground = ReturnType; diff --git a/packages/website/src/vendor/pluginUtils.d.ts b/packages/website/src/vendor/pluginUtils.d.ts deleted file mode 100644 index 3d69a7a5c66..00000000000 --- a/packages/website/src/vendor/pluginUtils.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -import type React from 'react'; - -/** Creates a set of util functions which is exposed to Plugins to make it easier to build consistent UIs */ -export declare const createUtils: ( - sb: any, - react: typeof React, -) => { - /** Use this to make a few dumb element generation funcs */ - el: (str: string, elementType: string, container: Element) => HTMLElement; - /** Get a relative URL for something in your dist folder depending on if you're in dev mode or not */ - requireURL: (path: string) => string; - /** The Gatsby copy of React */ - react: typeof React; - /** - * The playground plugin design system. Calling any of the functions will append the - * element to the container you pass into the first param, and return the HTMLElement - */ - createDesignSystem: (container: Element) => { - container: Element; - clear: () => void; - code: (code: string) => HTMLElement; - title: (title: string) => HTMLElement; - subtitle: (subtitle: string) => HTMLElement; - p: (subtitle: string) => HTMLElement; - showEmptyScreen: (message: string) => HTMLDivElement; - listDiags: ( - model: import('monaco-editor').editor.ITextModel, - diags: import('typescript').DiagnosticRelatedInformation[], - ) => HTMLUListElement; - clearDeltaDecorators: (force?: true | undefined) => void; - localStorageOption: ( - setting: import('./ds/createDesignSystem').LocalStorageOption, - ) => HTMLLIElement; - showOptionList: ( - options: import('./ds/createDesignSystem').LocalStorageOption[], - style: import('./ds/createDesignSystem').OptionsListConfig, - ) => void; - createTextInput: (config: { - id: string; - placeholder: string; - onChanged?: ((text: string, input: HTMLInputElement) => void) | undefined; - onEnter: (text: string, input: HTMLInputElement) => void; - value?: string | undefined; - keepValueAcrossReloads?: true | undefined; - isEnabled?: ((input: HTMLInputElement) => boolean) | undefined; - }) => HTMLFormElement; - createASTTree: ( - node: import('typescript').Node, - settings?: - | { - closedByDefault?: true | undefined; - } - | undefined, - ) => HTMLDivElement; - button: (settings: { - label: string; - onclick?: ((ev: MouseEvent) => void) | undefined; - }) => HTMLInputElement; - createTabBar: () => HTMLDivElement; - createTabButton: (text: string) => HTMLButtonElement; - declareRestartRequired: (i?: ((key: string) => string) | undefined) => void; - createSubDesignSystem: () => any; - }; - /** Flashes a HTML Element */ - flashHTMLElement: (element: HTMLElement) => void; - /** Add a little red button in the top corner of a plugin tab with a number */ - setNotifications: (pluginID: string, amount: number) => void; -}; -export declare type PluginUtils = ReturnType; diff --git a/packages/website/src/vendor/sandbox.d.ts b/packages/website/src/vendor/sandbox.d.ts index 0bd3ecc2d25..14b3310bb49 100644 --- a/packages/website/src/vendor/sandbox.d.ts +++ b/packages/website/src/vendor/sandbox.d.ts @@ -1,15 +1,25 @@ -import { TypeScriptWorker } from './tsWorker'; -// import lzstring from "./vendor/lzstring.min"; -import * as tsvfs from './typescript-vfs'; +/********************************************** + * DO NOT MODIFY THIS FILE MANUALLY * + * * + * THIS FILE HAS BEEN FETCHED FROM THE * + * TYPESCRIPT PLAYGROUND SOURCE CODE. * + * * + * YOU CAN REGENERATE THESE FILES USING * + * yarn generate-website-dts * + **********************************************/ -declare type CompilerOptions = - import('monaco-editor').languages.typescript.CompilerOptions; -declare type Monaco = typeof import('monaco-editor'); +import type * as ts from 'typescript'; +import type * as MonacoEditor from 'monaco-editor'; +import type TypeScriptWorker = MonacoEditor.languages.typescript.TypeScriptWorker; +import type lzstring from 'lz-string'; +import type * as tsvfs from './typescript-vfs'; +type CompilerOptions = MonacoEditor.languages.typescript.CompilerOptions; +type Monaco = typeof MonacoEditor; /** * These are settings for the playground which are the equivalent to props in React * any changes to it should require a new setup of the playground */ -export declare type SandboxConfig = { +export type SandboxConfig = { /** The default source code for the playground */ text: string; /** @deprecated */ @@ -19,7 +29,7 @@ export declare type SandboxConfig = { /** Compiler options which are automatically just forwarded on */ compilerOptions: CompilerOptions; /** Optional monaco settings overrides */ - monacoSettings?: import('monaco-editor').editor.IEditorOptions; + monacoSettings?: MonacoEditor.editor.IEditorOptions; /** Acquire types via type acquisition */ acquireTypes: boolean; /** Support twoslash compiler options */ @@ -54,9 +64,9 @@ export declare function defaultPlaygroundSettings(): { /** The default file for the playground */ filetype: 'js' | 'ts' | 'd.ts'; /** Compiler options which are automatically just forwarded on */ - compilerOptions: import('monaco-editor').languages.typescript.CompilerOptions; + compilerOptions: MonacoEditor.languages.typescript.CompilerOptions; /** Optional monaco settings overrides */ - monacoSettings?: import('monaco-editor').editor.IEditorOptions | undefined; + monacoSettings?: MonacoEditor.editor.IEditorOptions | undefined; /** Acquire types via type acquisition */ acquireTypes: boolean; /** Support twoslash compiler options */ @@ -81,7 +91,7 @@ export declare function defaultPlaygroundSettings(): { export declare const createTypeScriptSandbox: ( partialConfig: Partial, monaco: Monaco, - ts: typeof import('typescript'), + ts: typeof ts, ) => { /** The same config you passed in */ config: { @@ -89,7 +99,7 @@ export declare const createTypeScriptSandbox: ( useJavaScript?: boolean | undefined; filetype: 'js' | 'ts' | 'd.ts'; compilerOptions: CompilerOptions; - monacoSettings?: import('monaco-editor').editor.IEditorOptions | undefined; + monacoSettings?: MonacoEditor.editor.IEditorOptions | undefined; acquireTypes: boolean; supportTwoslashCompilerOptions: boolean; suppressAutomaticallyGettingDefaultText?: true | undefined; @@ -105,7 +115,12 @@ export declare const createTypeScriptSandbox: ( }; /** A list of TypeScript versions you can use with the TypeScript sandbox */ supportedVersions: readonly [ - '4.7.3', + '5.2.0-beta', + '5.1.6', + '5.0.4', + '4.9.5', + '4.8.4', + '4.7.4', '4.6.4', '4.5.5', '4.4.4', @@ -126,17 +141,17 @@ export declare const createTypeScriptSandbox: ( '2.4.1', ]; /** The monaco editor instance */ - editor: import('monaco-editor').editor.IStandaloneCodeEditor; + editor: MonacoEditor.editor.IStandaloneCodeEditor; /** Either "typescript" or "javascript" depending on your config */ language: string; /** The outer monaco module, the result of require("monaco-editor") */ - monaco: typeof import('monaco-editor'); + monaco: typeof MonacoEditor; /** Gets a monaco-typescript worker, this will give you access to a language server. Note: prefer this for language server work because it happens on a webworker . */ getWorkerProcess: () => Promise; /** A copy of require("@typescript/vfs") this can be used to quickly set up an in-memory compiler runs for ASTs, or to get complex language server results (anything above has to be serialized when passed)*/ tsvfs: typeof tsvfs; /** Get all the different emitted files after TypeScript is run */ - getEmitResult: () => Promise; + getEmitResult: () => Promise; /** Gets just the JavaScript for your sandbox, will transpile if in TS only */ getRunnableJS: () => Promise; /** Gets the DTS output of the main code in the editor */ @@ -144,15 +159,15 @@ export declare const createTypeScriptSandbox: ( /** The monaco-editor dom node, used for showing/hiding the editor */ getDomNode: () => HTMLElement; /** The model is an object which monaco uses to keep track of text in the editor. Use this to directly modify the text in the editor */ - getModel: () => import('monaco-editor').editor.ITextModel; + getModel: () => MonacoEditor.editor.ITextModel; /** Gets the text of the main model, which is the text in the editor */ getText: () => string; /** Shortcut for setting the model's text content which would update the editor */ setText: (text: string) => void; /** Gets the AST of the current text in monaco - uses `createTSProgram`, so the performance caveat applies there too */ - getAST: () => Promise; + getAST: () => Promise; /** The module you get from require("typescript") */ - ts: typeof import('typescript'); + ts: typeof ts; /** Create a new Program, a TypeScript data model which represents the entire project. As well as some of the * primitive objects you would normally need to do work with the files. * @@ -166,22 +181,20 @@ export declare const createTypeScriptSandbox: ( * TODO: It would be good to create an easy way to have a single program instance which is updated for you * when the monaco model changes. */ - setupTSVFS: (fsMapAdditions?: Map | undefined) => Promise<{ - program: import('typescript').Program; - system: import('typescript').System; + setupTSVFS: (fsMapAdditions?: Map) => Promise<{ + program: ts.Program; + system: ts.System; host: { - compilerHost: import('typescript').CompilerHost; - updateFile: (sourceFile: import('typescript').SourceFile) => boolean; + compilerHost: ts.CompilerHost; + updateFile: (sourceFile: ts.SourceFile) => boolean; }; fsMap: Map; }>; /** Uses the above call setupTSVFS, but only returns the program */ - createTSProgram: () => Promise; + createTSProgram: () => Promise; /** The Sandbox's default compiler options */ compilerDefaults: { - [ - x: string - ]: import('monaco-editor').languages.typescript.CompilerOptionsValue; + [x: string]: MonacoEditor.languages.typescript.CompilerOptionsValue; allowJs?: boolean | undefined; allowSyntheticDefaultImports?: boolean | undefined; allowUmdGlobalAccess?: boolean | undefined; @@ -206,21 +219,17 @@ export declare const createTypeScriptSandbox: ( inlineSourceMap?: boolean | undefined; inlineSources?: boolean | undefined; isolatedModules?: boolean | undefined; - jsx?: import('monaco-editor').languages.typescript.JsxEmit | undefined; + jsx?: MonacoEditor.languages.typescript.JsxEmit | undefined; keyofStringsOnly?: boolean | undefined; lib?: string[] | undefined; locale?: string | undefined; mapRoot?: string | undefined; maxNodeModuleJsDepth?: number | undefined; - module?: - | import('monaco-editor').languages.typescript.ModuleKind - | undefined; + module?: MonacoEditor.languages.typescript.ModuleKind | undefined; moduleResolution?: - | import('monaco-editor').languages.typescript.ModuleResolutionKind - | undefined; - newLine?: - | import('monaco-editor').languages.typescript.NewLineKind + | MonacoEditor.languages.typescript.ModuleResolutionKind | undefined; + newLine?: MonacoEditor.languages.typescript.NewLineKind | undefined; noEmit?: boolean | undefined; noEmitHelpers?: boolean | undefined; noEmitOnError?: boolean | undefined; @@ -238,9 +247,7 @@ export declare const createTypeScriptSandbox: ( out?: string | undefined; outDir?: string | undefined; outFile?: string | undefined; - paths?: - | import('monaco-editor').languages.typescript.MapLike - | undefined; + paths?: MonacoEditor.languages.typescript.MapLike | undefined; preserveConstEnums?: boolean | undefined; preserveSymlinks?: boolean | undefined; project?: string | undefined; @@ -262,9 +269,7 @@ export declare const createTypeScriptSandbox: ( stripInternal?: boolean | undefined; suppressExcessPropertyErrors?: boolean | undefined; suppressImplicitAnyIndexErrors?: boolean | undefined; - target?: - | import('monaco-editor').languages.typescript.ScriptTarget - | undefined; + target?: MonacoEditor.languages.typescript.ScriptTarget | undefined; traceResolution?: boolean | undefined; resolveJsonModule?: boolean | undefined; types?: string[] | undefined; @@ -273,7 +278,7 @@ export declare const createTypeScriptSandbox: ( useDefineForClassFields?: boolean | undefined; }; /** The Sandbox's current compiler options */ - getCompilerOptions: () => import('monaco-editor').languages.typescript.CompilerOptions; + getCompilerOptions: () => MonacoEditor.languages.typescript.CompilerOptions; /** Replace the Sandbox's compiler options */ setCompilerSettings: (opts: CompilerOptions) => void; /** Overwrite the Sandbox's compiler options */ @@ -283,7 +288,7 @@ export declare const createTypeScriptSandbox: ( /** A way to get callbacks when compiler settings have changed */ setDidUpdateCompilerSettings: (func: (opts: CompilerOptions) => void) => void; /** A copy of lzstring, which is used to archive/unarchive code */ - // lzstring: typeof lzstring; + lzstring: typeof lzstring; /** Returns compiler options found in the params of the current page */ createURLQueryWithCompilerOptions: ( _sandbox: any, @@ -298,11 +303,11 @@ export declare const createTypeScriptSandbox: ( /** Returns compiler options in the source code using twoslash notation */ getTwoSlashCompilerOptions: (code: string) => any; /** Gets to the current monaco-language, this is how you talk to the background webworkers */ - languageServiceDefaults: import('monaco-editor').languages.typescript.LanguageServiceDefaults; + languageServiceDefaults: MonacoEditor.languages.typescript.LanguageServiceDefaults; /** The path which represents the current file using the current compiler options */ filepath: string; /** Adds a file to the vfs used by the editor */ addLibraryToRuntime: (code: string, _path: string) => void; }; -export declare type Sandbox = ReturnType; +export type Sandbox = ReturnType; export {}; diff --git a/packages/website/src/vendor/tsWorker.d.ts b/packages/website/src/vendor/tsWorker.d.ts deleted file mode 100644 index 801ea3e43b4..00000000000 --- a/packages/website/src/vendor/tsWorker.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -import * as ts from 'typescript'; - -export declare class TypeScriptWorker implements ts.LanguageServiceHost { - private _ctx; - private _extraLibs; - private _languageService; - private _compilerOptions; - constructor(ctx: any, createData: any); - getCompilationSettings(): ts.CompilerOptions; - getScriptFileNames(): string[]; - private _getModel; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): ts.IScriptSnapshot | undefined; - getScriptKind?(fileName: string): ts.ScriptKind; - getCurrentDirectory(): string; - getDefaultLibFileName(options: ts.CompilerOptions): string; - isDefaultLibFileName(fileName: string): boolean; - private static clearFiles; - getSyntacticDiagnostics(fileName: string): Promise; - getSemanticDiagnostics(fileName: string): Promise; - getSuggestionDiagnostics( - fileName: string, - ): Promise; - getCompilerOptionsDiagnostics(fileName: string): Promise; - getCompletionsAtPosition( - fileName: string, - position: number, - ): Promise; - getCompletionEntryDetails( - fileName: string, - position: number, - entry: string, - ): Promise; - getSignatureHelpItems( - fileName: string, - position: number, - ): Promise; - getQuickInfoAtPosition( - fileName: string, - position: number, - ): Promise; - getOccurrencesAtPosition( - fileName: string, - position: number, - ): Promise | undefined>; - getDefinitionAtPosition( - fileName: string, - position: number, - ): Promise | undefined>; - getReferencesAtPosition( - fileName: string, - position: number, - ): Promise; - getNavigationBarItems(fileName: string): Promise; - getFormattingEditsForDocument( - fileName: string, - options: ts.FormatCodeOptions, - ): Promise; - getFormattingEditsForRange( - fileName: string, - start: number, - end: number, - options: ts.FormatCodeOptions, - ): Promise; - getFormattingEditsAfterKeystroke( - fileName: string, - postion: number, - ch: string, - options: ts.FormatCodeOptions, - ): Promise; - findRenameLocations( - fileName: string, - positon: number, - findInStrings: boolean, - findInComments: boolean, - providePrefixAndSuffixTextForRename: boolean, - ): Promise; - getRenameInfo( - fileName: string, - positon: number, - options: ts.RenameInfoOptions, - ): Promise; - getEmitOutput(fileName: string): Promise; - getCodeFixesAtPosition( - fileName: string, - start: number, - end: number, - errorCodes: number[], - formatOptions: ts.FormatCodeOptions, - ): Promise>; - updateExtraLibs(extraLibs: IExtraLibs): void; - /** - * https://github.com/microsoft/TypeScript-Website/blob/246798df5013036bd9b4389932b642c20ab35deb/packages/playground-worker/types.d.ts#L48 - */ - getLibFiles(): Promise>; -} -export interface IExtraLib { - content: string; - version: number; -} -export interface IExtraLibs { - [path: string]: IExtraLib; -} diff --git a/packages/website/src/vendor/typescript-vfs.d.ts b/packages/website/src/vendor/typescript-vfs.d.ts index 5a5db30651a..81d54ea4536 100644 --- a/packages/website/src/vendor/typescript-vfs.d.ts +++ b/packages/website/src/vendor/typescript-vfs.d.ts @@ -1,21 +1,30 @@ -declare type System = import('typescript').System; -declare type CompilerOptions = import('typescript').CompilerOptions; -declare type CustomTransformers = import('typescript').CustomTransformers; -declare type LanguageServiceHost = import('typescript').LanguageServiceHost; -declare type CompilerHost = import('typescript').CompilerHost; -declare type SourceFile = import('typescript').SourceFile; -declare type TS = typeof import('typescript'); +/********************************************** + * DO NOT MODIFY THIS FILE MANUALLY * + * * + * THIS FILE HAS BEEN FETCHED FROM THE * + * TYPESCRIPT PLAYGROUND SOURCE CODE. * + * * + * YOU CAN REGENERATE THESE FILES USING * + * yarn generate-website-dts * + **********************************************/ + +import type * as ts from 'typescript'; +type System = ts.System; +type CompilerOptions = ts.CompilerOptions; +type CustomTransformers = ts.CustomTransformers; +type LanguageServiceHost = ts.LanguageServiceHost; +type CompilerHost = ts.CompilerHost; +type SourceFile = ts.SourceFile; +type TS = typeof ts; export interface VirtualTypeScriptEnvironment { sys: System; - languageService: import('typescript').LanguageService; - getSourceFile: ( - fileName: string, - ) => import('typescript').SourceFile | undefined; + languageService: ts.LanguageService; + getSourceFile: (fileName: string) => ts.SourceFile | undefined; createFile: (fileName: string, content: string) => void; updateFile: ( fileName: string, content: string, - replaceTextSpan?: import('typescript').TextSpan, + replaceTextSpan?: ts.TextSpan, ) => void; } /** @@ -52,7 +61,8 @@ export declare const knownLibFilesForCompilerOptions: ( */ export declare const createDefaultMapFromNodeModules: ( compilerOptions: CompilerOptions, - ts?: typeof import('typescript') | undefined, + ts?: typeof ts, + tsLibDirectory?: string, ) => Map; /** * Adds recursively files from the FS into the map based on the folder @@ -82,9 +92,9 @@ export declare const createDefaultMapFromCDN: ( version: string, cache: boolean, ts: TS, - lzstring?: any | undefined, - fetcher?: typeof fetch | undefined, - storer?: Storage | undefined, + lzstring?: typeof import('lz-string'), + fetcher?: typeof fetch, + storer?: typeof localStorage, ) => Promise>; /** * Creates an in-memory System object which can be used in a TypeScript program, this @@ -100,6 +110,7 @@ export declare function createFSBackedSystem( files: Map, _projectRoot: string, ts: TS, + tsLibDirectory?: string, ): System; /** * Creates an in-memory CompilerHost -which is essentially an extra wrapper to System @@ -125,6 +136,6 @@ export declare function createVirtualLanguageServiceHost( customTransformers?: CustomTransformers, ): { languageServiceHost: LanguageServiceHost; - updateFile: (sourceFile: import('typescript').SourceFile) => void; + updateFile: (sourceFile: ts.SourceFile) => void; }; export {}; diff --git a/packages/website/tests/index.spec.ts b/packages/website/tests/index.spec.ts index 77d6c73cda2..81b7f0c42d9 100644 --- a/packages/website/tests/index.spec.ts +++ b/packages/website/tests/index.spec.ts @@ -10,9 +10,16 @@ test.describe('Website', () => { test('should have no errors', async ({ page }) => { const errorMessages: string[] = []; page.on('console', msg => { - if (['error', 'warning'].includes(msg.type())) { - errorMessages.push(`[${msg.type()}] ${msg.text()}`); + const type = msg.type(); + if (!['error', 'warning'].includes(type)) { + return; } + const text = msg.text(); + // this log is fine because the ReactDOM usage is controlled by docusaurus, not us + if (text.includes('ReactDOM.render is no longer supported in React 18')) { + return; + } + errorMessages.push(`[${type}] ${text}`); }); await page.goto('/'); expect(errorMessages).toStrictEqual([]); diff --git a/packages/website/tests/playground.spec.ts b/packages/website/tests/playground.spec.ts index ad600738b51..67f679359db 100644 --- a/packages/website/tests/playground.spec.ts +++ b/packages/website/tests/playground.spec.ts @@ -2,7 +2,8 @@ import AxeBuilder from '@axe-core/playwright'; import type { Page } from '@playwright/test'; import { expect, test } from '@playwright/test'; -test.describe('Playground', () => { +// TODO: fix these tests and reenable them +test.describe.skip('Playground', () => { test.beforeEach(async ({ page }) => { await page.goto('/play'); }); @@ -11,8 +12,7 @@ test.describe('Playground', () => { await new AxeBuilder({ page }).analyze(); }); - // TODO: fix this test and reenable it - test.skip('Usage', async ({ page }) => { + test('Usage', async ({ page }) => { // 1. Type some valid code in the playground await writeInEditor(page, 'let value: string[];'); @@ -47,6 +47,24 @@ test.describe('Playground', () => { await expect(page.getByText('let value: string[];')).toBeVisible(); await expect(page.getByText('All is ok!')).toBeVisible(); }); + + test('AST Viewer', async ({ page }) => { + // 1. Type some valid code in the playground + await writeInEditor(page, 'let value: Array;'); + + // 2. Enable AST viewer + await page + .getByRole('combobox', { name: 'AST Viewer' }) + .selectOption({ label: 'ESTree' }); + + // 3. Type some valid code in the playground + await writeInEditor(page, 'let value: Array;'); + + // 4. Validate variable declaration block exists in AST viewer + await expect( + page.getByRole('link', { name: 'VariableDeclaration' }), + ).toBeVisible(); + }); }); async function writeInEditor(page: Page, text: string): Promise { diff --git a/packages/website/tests/rules.spec.ts b/packages/website/tests/rules.spec.ts new file mode 100644 index 00000000000..faba1bdd447 --- /dev/null +++ b/packages/website/tests/rules.spec.ts @@ -0,0 +1,32 @@ +import AxeBuilder from '@axe-core/playwright'; +import { expect, test } from '@playwright/test'; + +test.describe('Rules Page', () => { + test.beforeEach(async ({ page }) => { + await page.goto('/rules'); + }); + + test('Accessibility', async ({ page }) => { + await new AxeBuilder({ page }).analyze(); + }); + + test('Rules filters are saved to the URL', async ({ page }) => { + await page.getByText('🔧 fixable').first().click(); + await page.getByText('✅ recommended').first().click(); + await page.getByText('✅ recommended').first().click(); + + expect(new URL(page.url()).search).toBe( + '?supported-rules=xrecommended-fixable', + ); + }); + + test('Rules filters are read from the URL on page load', async ({ page }) => { + await page.goto('/rules?supported-rules=strict-xfixable'); + + const strict = page.getByText('🔒 strict').first(); + const fixable = page.getByText('🔧 fixable').first(); + + await expect(strict).toHaveAttribute('aria-label', /Current: include/); + await expect(fixable).toHaveAttribute('aria-label', /Current: exclude/); + }); +}); diff --git a/packages/website/tools/generate-website-dts.ts b/packages/website/tools/generate-website-dts.ts new file mode 100644 index 00000000000..6f7525b9f0d --- /dev/null +++ b/packages/website/tools/generate-website-dts.ts @@ -0,0 +1,108 @@ +import * as fs from 'node:fs/promises'; +import * as path from 'node:path'; + +import fetch from 'cross-fetch'; +import makeDir from 'make-dir'; +import prettier from 'prettier'; +import { rimraf } from 'rimraf'; + +const BASE_HOST = 'https://www.staging-typescript.org'; + +const banner = [ + '/**********************************************', + ' * DO NOT MODIFY THIS FILE MANUALLY *', + ' * *', + ' * THIS FILE HAS BEEN FETCHED FROM THE *', + ' * TYPESCRIPT PLAYGROUND SOURCE CODE. *', + ' * *', + ' * YOU CAN REGENERATE THESE FILES USING *', + ' * yarn generate-website-dts *', + ' **********************************************/', +]; + +async function getFileAndStoreLocally( + url: string, + path: string, + editFunc: (arg: string) => string = (text: string): string => text, +): Promise { + console.log('Fetching', url); + const response = await fetch(BASE_HOST + url, { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }); + + const config = await prettier.resolveConfig(path); + + let contents = await response.text(); + contents = [...banner, '', editFunc(contents)].join('\n'); + contents = prettier.format(contents, { + parser: 'typescript', + ...config, + }); + + await fs.writeFile(path, contents, 'utf8'); +} + +function replaceImports(text: string, from: string, to: string): string { + const regex = new RegExp(`from ["']${from}["']`, 'g'); + const regex2 = new RegExp(`import\\(["']${from}["']\\)`, 'g'); + return text.replace(regex, `from '${to}'`).replace(regex2, `import('${to}')`); +} + +function injectImports(text: string, from: string, safeName: string): string { + const regex = new RegExp(`import\\(["']${from}["']\\)`, 'g'); + if (regex.test(text)) { + return ( + `import type * as ${safeName} from '${from}';\n` + + text.replace(regex, safeName) + ); + } + return text; +} + +function processFiles(text: string): string { + let result = text; + result = injectImports(result, 'monaco-editor', 'MonacoEditor'); + result = injectImports(result, 'typescript', 'ts'); + result = replaceImports(result, './vendor/lzstring.min', 'lz-string'); + result = replaceImports( + result, + './vendor/typescript-vfs', + './typescript-vfs', + ); + // replace the import of the worker with the type + result = result.replace( + /import\s*\{\s*TypeScriptWorker\s*}\s*from\s*['"].\/tsWorker['"];/, + 'import TypeScriptWorker = MonacoEditor.languages.typescript.TypeScriptWorker;', + ); + // replace all imports with import type + result = result.replace(/^import\s+(?!type)/gm, 'import type '); + return result; +} + +async function main(): Promise { + const vendor = path.join(__dirname, '..', 'src', 'vendor'); + + console.log('Cleaning...'); + await rimraf(vendor); + await makeDir(vendor); + + // TS-VFS + await getFileAndStoreLocally( + '/js/sandbox/vendor/typescript-vfs.d.ts', + path.join(vendor, 'typescript-vfs.d.ts'), + processFiles, + ); + + // Sandbox + await getFileAndStoreLocally( + '/js/sandbox/index.d.ts', + path.join(vendor, 'sandbox.d.ts'), + processFiles, + ); +} + +main().catch(error => { + console.error(error); + process.exitCode = 1; +}); diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json index 82eff535cb8..e8715739403 100644 --- a/packages/website/tsconfig.json +++ b/packages/website/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "CommonJS", + "module": "NodeNext", "moduleResolution": "NodeNext", "allowJs": true, "esModuleInterop": true, @@ -16,5 +16,13 @@ }, "types": ["@docusaurus/module-type-aliases", "@docusaurus/theme-classic"] }, - "include": ["src", "tests", "plugins", "typings", "./*.ts"] + "include": [ + "src", + "tests", + "tools", + "plugins", + "typings", + "sidebars/*.js", + "./*.ts" + ] } diff --git a/packages/website/typings/esquery.d.ts b/packages/website/typings/esquery.d.ts new file mode 100644 index 00000000000..aca8d71c8bb --- /dev/null +++ b/packages/website/typings/esquery.d.ts @@ -0,0 +1,157 @@ +// forked from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/f8e7d054df8c4546dc911f0cf4ca6a0c2d51f11e/types/esquery/index.d.ts + +declare module 'esquery' { + // use our types instead of the estree types + import type { TSESTree } from '@typescript-eslint/types'; + + export as namespace esquery; + + export = query; + + type Node = TSESTree.Node; + + /** Query the code AST using the selector string. */ + declare function query(ast: Node, selector: string): Node[]; + + declare namespace query { + /** Parse a selector and return its AST. */ + function parse(selector: string): Selector; + /** From a JS AST and a selector AST, collect all JS AST nodes that match the selector. */ + function match(ast: Node, selector: Selector): Node[]; + /** Given a `node` and its ancestors, determine if `node` is matched by `selector`. */ + function matches(node: Node, selector: Selector, ancestry: Node[]): boolean; + /** Query the code AST using the selector string. */ + function query(ast: Node, selector: string): Node[]; + + // + // Unions + // + type Selector = + | Adjacent + | Attribute + | Child + | Class + | Descendant + | Field + | Has + | Identifier + | Matches + | Negation + | NthChild + | NthLastChild + | Sequence + | Sibling + | Type + | Wildcard; + type MultiSelector = Has | Matches | Negation | Sequence; + type BinarySelector = Adjacent | Child | Descendant | Sibling; + type NthSelector = NthChild | NthLastChild; + type SubjectSelector = + | Attribute + | BinarySelector + | Identifier + | MultiSelector + | NthSelector + | Wildcard; + type Literal = NumericLiteral | StringLiteral; + + // + // Base Atoms + // + interface Atom { + type: string; + } + interface SubjectSelectorAtom extends Atom { + subject?: boolean | undefined; + } + interface NthSelectorAtom extends SubjectSelectorAtom { + index: NumericLiteral; + } + interface BinarySelectorAtom extends SubjectSelectorAtom { + type: 'adjacent' | 'child' | 'descendant' | 'sibling'; + left: SubjectSelector; + right: SubjectSelector; + } + interface MultiSelectorAtom extends SubjectSelectorAtom { + selectors: SubjectSelector[]; + } + interface LiteralAtom extends Atom { + type: 'literal'; + value: number | string; + } + + // + // Literals + // + interface StringLiteral extends LiteralAtom { + value: string; + } + interface NumericLiteral extends LiteralAtom { + value: number; + } + interface RegExpLiteral extends Atom { + type: 'regexp'; + value: RegExp; + } + + // + // Atoms + // + interface Field extends Atom { + type: 'field'; + name: string; + } + interface Type extends Atom { + type: 'type'; + value: string; + } + interface Sequence extends MultiSelectorAtom { + type: 'compound'; + } + interface Identifier extends SubjectSelectorAtom { + type: 'identifier'; + value: string; + } + interface Wildcard extends SubjectSelectorAtom { + type: 'wildcard'; + value: '*'; + } + interface Attribute extends SubjectSelectorAtom { + type: 'attribute'; + name: string; + operator?: '!=' | '<' | '<=' | '=' | '>' | '>=' | undefined; + value?: Literal | RegExpLiteral | Type | undefined; + } + interface NthChild extends NthSelectorAtom { + type: 'nth-child'; + } + interface NthLastChild extends NthSelectorAtom { + type: 'nth-last-child'; + } + interface Descendant extends BinarySelectorAtom { + type: 'descendant'; + } + interface Child extends BinarySelectorAtom { + type: 'child'; + } + interface Sibling extends BinarySelectorAtom { + type: 'sibling'; + } + interface Adjacent extends BinarySelectorAtom { + type: 'adjacent'; + } + interface Negation extends MultiSelectorAtom { + type: 'not'; + } + interface Matches extends MultiSelectorAtom { + type: 'matches'; + } + interface Has extends MultiSelectorAtom { + type: 'has'; + } + interface Class extends Atom { + type: 'class'; + name: 'declaration' | 'expression' | 'function' | 'pattern' | 'statement'; + } + } +} diff --git a/packages/website/typings/monaco-editor.d.ts b/packages/website/typings/monaco-editor.d.ts new file mode 100644 index 00000000000..c7d31ef6652 --- /dev/null +++ b/packages/website/typings/monaco-editor.d.ts @@ -0,0 +1,12 @@ +import 'monaco-editor/esm/vs/editor/editor.api'; + +declare module 'monaco-editor/esm/vs/editor/editor.api' { + namespace languages.typescript { + interface TypeScriptWorker { + /** + * https://github.com/microsoft/TypeScript-Website/blob/246798df5013036bd9b4389932b642c20ab35deb/packages/playground-worker/types.d.ts#L48 + */ + getLibFiles?(): Promise>; + } + } +} diff --git a/packages/website/typings/typescript.d.ts b/packages/website/typings/typescript.d.ts index 7239e4ddcb5..30af30c4ae7 100644 --- a/packages/website/typings/typescript.d.ts +++ b/packages/website/typings/typescript.d.ts @@ -1,7 +1,5 @@ import 'typescript'; -type StringMap = Map; - declare module 'typescript' { /** * Map of available libraries @@ -9,5 +7,17 @@ declare module 'typescript' { * The key is the key used in compilerOptions.lib * The value is the file name */ - const libMap: StringMap; + const libMap: Map; + + interface OptionDeclarations { + name: string; + type?: unknown; + category?: { message: string }; + description?: { message: string }; + element?: { + type: unknown; + }; + } + + const optionDeclarations: OptionDeclarations[]; } diff --git a/patches/@microsoft+api-extractor+7.36.1.patch b/patches/@microsoft+api-extractor+7.36.1.patch new file mode 100644 index 00000000000..b1a7e6055a6 --- /dev/null +++ b/patches/@microsoft+api-extractor+7.36.1.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js b/node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js +index 31b46f8..e7081c6 100644 +--- a/node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js ++++ b/node_modules/@microsoft/api-extractor/lib/api/ExtractorConfig.js +@@ -668,6 +668,6 @@ ExtractorConfig.FILENAME = 'api-extractor.json'; + */ + ExtractorConfig._tsdocBaseFilePath = path.resolve(__dirname, '../../extends/tsdoc-base.json'); + ExtractorConfig._defaultConfig = node_core_library_1.JsonFile.load(path.join(__dirname, '../schemas/api-extractor-defaults.json')); +-ExtractorConfig._declarationFileExtensionRegExp = /\.d\.ts$/i; ++ExtractorConfig._declarationFileExtensionRegExp = /\.d\.(c|m)?ts$/i; + exports.ExtractorConfig = ExtractorConfig; + //# sourceMappingURL=ExtractorConfig.js.map +\ No newline at end of file diff --git a/patches/ajv+6.12.6.patch b/patches/ajv+6.12.6.patch new file mode 100644 index 00000000000..43b89b3f40a --- /dev/null +++ b/patches/ajv+6.12.6.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/ajv/lib/ajv.d.ts b/node_modules/ajv/lib/ajv.d.ts +index 078364d..21cf7bf 100644 +--- a/node_modules/ajv/lib/ajv.d.ts ++++ b/node_modules/ajv/lib/ajv.d.ts +@@ -153,7 +153,7 @@ declare namespace ajv { + parentData?: object | Array, + parentDataProperty?: string | number, + rootData?: object | Array +- ): boolean | PromiseLike; ++ ): boolean; + schema?: object | boolean; + errors?: null | Array; + refs?: object; diff --git a/patches/eslint-visitor-keys+3.4.1.patch b/patches/eslint-visitor-keys+3.4.1.patch new file mode 100644 index 00000000000..c4bcaea3173 --- /dev/null +++ b/patches/eslint-visitor-keys+3.4.1.patch @@ -0,0 +1,33 @@ +diff --git a/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts b/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +new file mode 100644 +index 0000000..5295c19 +--- /dev/null ++++ b/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.d.cts +@@ -0,0 +1,27 @@ ++type VisitorKeys$1 = { ++ readonly [type: string]: readonly string[]; ++}; ++/** ++* @typedef {{ readonly [type: string]: ReadonlyArray }} VisitorKeys ++*/ ++/** ++* @type {VisitorKeys} ++*/ ++declare const KEYS: VisitorKeys$1; ++ ++/** ++* Get visitor keys of a given node. ++* @param {object} node The AST node to get keys. ++* @returns {readonly string[]} Visitor keys of the node. ++*/ ++declare function getKeys(node: object): readonly string[]; ++/** ++* Make the union set with `KEYS` and given keys. ++* @param {VisitorKeys} additionalKeys The additional keys. ++* @returns {VisitorKeys} The union set. ++*/ ++declare function unionWith(additionalKeys: VisitorKeys): VisitorKeys; ++ ++type VisitorKeys = VisitorKeys$1; ++ ++export { KEYS, VisitorKeys, getKeys, unionWith }; diff --git a/patches/react-split-pane+0.1.92.patch b/patches/react-split-pane+0.1.92.patch index b00ff2919e7..bd6141c8b12 100644 --- a/patches/react-split-pane+0.1.92.patch +++ b/patches/react-split-pane+0.1.92.patch @@ -1,12 +1,12 @@ diff --git a/node_modules/react-split-pane/index.d.ts b/node_modules/react-split-pane/index.d.ts -index d116f54..9329094 100644 +index d116f54..20a132e 100644 --- a/node_modules/react-split-pane/index.d.ts +++ b/node_modules/react-split-pane/index.d.ts -@@ -25,6 +25,7 @@ export type SplitPaneProps = { - pane2Style?: React.CSSProperties; - resizerClassName?: string; - step?: number; -+ children?: React.ReactNode; - }; +@@ -6,6 +6,7 @@ export type Split = 'vertical' | 'horizontal'; - export type SplitPaneState = { + export type SplitPaneProps = { + allowResize?: boolean; ++ children?: React.ReactNode; + className?: string; + primary?: 'first' | 'second'; + minSize?: Size; diff --git a/patches/tsutils+3.21.0.patch b/patches/tsutils+3.21.0.patch deleted file mode 100644 index 0b2e3ee1036..00000000000 --- a/patches/tsutils+3.21.0.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/node_modules/tsutils/util/util.d.ts b/node_modules/tsutils/util/util.d.ts -index 97cedda..4a63900 100644 ---- a/node_modules/tsutils/util/util.d.ts -+++ b/node_modules/tsutils/util/util.d.ts -@@ -9,7 +9,7 @@ export declare function isJsDocKind(kind: ts.SyntaxKind): boolean; - export declare function isKeywordKind(kind: ts.SyntaxKind): boolean; - export declare function isThisParameter(parameter: ts.ParameterDeclaration): boolean; - export declare function getModifier(node: ts.Node, kind: ts.Modifier['kind']): ts.Modifier | undefined; --export declare function hasModifier(modifiers: ts.ModifiersArray | undefined, ...kinds: Array): boolean; -+export declare function hasModifier(modifiers: Iterable | undefined, ...kinds: Array): boolean; - export declare function isParameterProperty(node: ts.ParameterDeclaration): boolean; - export declare function hasAccessModifier(node: ts.ClassElement | ts.ParameterDeclaration): boolean; - export declare const isNodeFlagSet: (node: ts.Node, flag: ts.NodeFlags) => boolean; diff --git a/patches/typescript+5.0.2.patch b/patches/typescript+5.0.2.patch deleted file mode 100644 index 4f4c95641d2..00000000000 --- a/patches/typescript+5.0.2.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts -index 374e65a..9d5a88c 100644 ---- a/node_modules/typescript/lib/typescript.d.ts -+++ b/node_modules/typescript/lib/typescript.d.ts -@@ -368,8 +368,8 @@ declare namespace ts { - JSDocFunctionType = 320, - JSDocVariadicType = 321, - JSDocNamepathType = 322, -+ /** @deprecated This was only added in 4.7 */ - JSDoc = 323, -- /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 323, - JSDocText = 324, - JSDocTypeLiteral = 325, -@@ -4522,7 +4522,13 @@ declare namespace ts { - function symbolName(symbol: Symbol): string; - function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; - function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. -+ */ - function getDecorators(node: HasDecorators): readonly Decorator[] | undefined; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. -+ */ - function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; - /** - * Gets the JSDoc parameter tags for the node if present. -@@ -5027,7 +5033,13 @@ declare namespace ts { - function isModuleName(node: Node): node is ModuleName; - function isBinaryOperatorToken(node: Node): node is BinaryOperatorToken; - function setTextRange(range: T, location: TextRange | undefined): T; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. -+ */ - function canHaveModifiers(node: Node): node is HasModifiers; -+ /** -+ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. -+ */ - function canHaveDecorators(node: Node): node is HasDecorators; - /** - * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes diff --git a/patches/typescript+5.1.6.patch b/patches/typescript+5.1.6.patch new file mode 100644 index 00000000000..e5b64b9a625 --- /dev/null +++ b/patches/typescript+5.1.6.patch @@ -0,0 +1,84 @@ +diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts +index ff7896e..1b85a0b 100644 +--- a/node_modules/typescript/lib/typescript.d.ts ++++ b/node_modules/typescript/lib/typescript.d.ts +@@ -370,8 +370,8 @@ declare namespace ts { + JSDocFunctionType = 323, + JSDocVariadicType = 324, + JSDocNamepathType = 325, ++ /** @deprecated This was only added in 4.7 */ + JSDoc = 326, +- /** @deprecated Use SyntaxKind.JSDoc */ + JSDocComment = 326, + JSDocText = 327, + JSDocTypeLiteral = 328, +@@ -734,6 +734,8 @@ declare namespace ts { + readonly name: PropertyName; + readonly questionToken?: QuestionToken; + readonly type?: TypeNode; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly initializer?: Expression | undefined; + } + interface PropertyDeclaration extends ClassElement, JSDocContainer { + readonly kind: SyntaxKind.PropertyDeclaration; +@@ -759,6 +761,10 @@ declare namespace ts { + readonly parent: ObjectLiteralExpression; + readonly name: PropertyName; + readonly initializer: Expression; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly questionToken?: QuestionToken | undefined; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly exclamationToken?: ExclamationToken | undefined; + } + interface ShorthandPropertyAssignment extends ObjectLiteralElement, JSDocContainer { + readonly kind: SyntaxKind.ShorthandPropertyAssignment; +@@ -766,6 +772,12 @@ declare namespace ts { + readonly name: Identifier; + readonly equalsToken?: EqualsToken; + readonly objectAssignmentInitializer?: Expression; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly modifiers?: NodeArray | undefined; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly questionToken?: QuestionToken | undefined; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly exclamationToken?: ExclamationToken | undefined; + } + interface SpreadAssignment extends ObjectLiteralElement, JSDocContainer { + readonly kind: SyntaxKind.SpreadAssignment; +@@ -888,6 +900,8 @@ declare namespace ts { + } + interface FunctionTypeNode extends FunctionOrConstructorTypeNodeBase, LocalsContainer { + readonly kind: SyntaxKind.FunctionType; ++ /** @deprecated removed in 5.0 but we want to keep it for backwards compatibility checks! */ ++ readonly modifiers?: NodeArray | undefined; + } + interface ConstructorTypeNode extends FunctionOrConstructorTypeNodeBase, LocalsContainer { + readonly kind: SyntaxKind.ConstructorType; +@@ -4570,7 +4584,13 @@ declare namespace ts { + function symbolName(symbol: Symbol): string; + function getNameOfJSDocTypedef(declaration: JSDocTypedefTag): Identifier | PrivateIdentifier | undefined; + function getNameOfDeclaration(declaration: Declaration | Expression | undefined): DeclarationName | undefined; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. ++ */ + function getDecorators(node: HasDecorators): readonly Decorator[] | undefined; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. ++ */ + function getModifiers(node: HasModifiers): readonly Modifier[] | undefined; + /** + * Gets the JSDoc parameter tags for the node if present. +@@ -5096,7 +5116,13 @@ declare namespace ts { + function isModuleName(node: Node): node is ModuleName; + function isBinaryOperatorToken(node: Node): node is BinaryOperatorToken; + function setTextRange(range: T, location: TextRange | undefined): T; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getModifiers from `@typescript-eslint/type-utils`. ++ */ + function canHaveModifiers(node: Node): node is HasModifiers; ++ /** ++ * @deprecated don't use this directly as it does not exist pre-4.8; instead use getDecorators from `@typescript-eslint/type-utils`. ++ */ + function canHaveDecorators(node: Node): node is HasDecorators; + /** + * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes diff --git a/tests/integration/fixtures/recommended-does-not-require-program/index.ts b/tests/integration/fixtures/recommended-does-not-require-program/index.ts deleted file mode 100644 index cf187492f17..00000000000 --- a/tests/integration/fixtures/recommended-does-not-require-program/index.ts +++ /dev/null @@ -1 +0,0 @@ -var foo: any = true; diff --git a/tests/integration/fixtures/typescript-and-tslint-plugins-together/tsconfig.json b/tests/integration/fixtures/typescript-and-tslint-plugins-together/tsconfig.json deleted file mode 100644 index aee0ec940fc..00000000000 --- a/tests/integration/fixtures/typescript-and-tslint-plugins-together/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "compilerOptions": { - "strict": true - } -} diff --git a/tests/integration/tests/__snapshots__/eslint-v6.test.ts.snap b/tests/integration/tests/__snapshots__/eslint-v6.test.ts.snap deleted file mode 100644 index 4bb27abfcc9..00000000000 --- a/tests/integration/tests/__snapshots__/eslint-v6.test.ts.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`eslint-v6 should lint successfully 1`] = ` -[ - { - "errorCount": 1, - "filePath": "/index.ts", - "fixableErrorCount": 0, - "fixableWarningCount": 0, - "messages": [ - { - "column": 15, - "endColumn": 18, - "endLine": 1, - "line": 1, - "message": "Unexpected any. Specify a different type.", - "messageId": "unexpectedAny", - "nodeType": "TSAnyKeyword", - "ruleId": "@typescript-eslint/no-explicit-any", - "severity": 2, - }, - ], - "source": "const noSemi: any = true; -", - "warningCount": 0, - }, -] -`; diff --git a/tests/integration/tests/eslint-v6.test.ts b/tests/integration/tests/eslint-v6.test.ts deleted file mode 100644 index afcf9da3bc2..00000000000 --- a/tests/integration/tests/eslint-v6.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { integrationTest } from '../integration-test-base'; - -integrationTest(__filename, '*.ts'); diff --git a/tests/integration/tests/markdown.test.ts b/tests/integration/tests/markdown.test.ts deleted file mode 100644 index 8ac7befb646..00000000000 --- a/tests/integration/tests/markdown.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { integrationTest } from '../integration-test-base'; - -integrationTest(__filename, '*.md'); diff --git a/tests/integration/tests/recommended-does-not-require-program.test.ts b/tests/integration/tests/recommended-does-not-require-program.test.ts deleted file mode 100644 index afcf9da3bc2..00000000000 --- a/tests/integration/tests/recommended-does-not-require-program.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { integrationTest } from '../integration-test-base'; - -integrationTest(__filename, '*.ts'); diff --git a/tests/integration/tests/typescript-and-tslint-plugins-together.test.ts b/tests/integration/tests/typescript-and-tslint-plugins-together.test.ts deleted file mode 100644 index afcf9da3bc2..00000000000 --- a/tests/integration/tests/typescript-and-tslint-plugins-together.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { integrationTest } from '../integration-test-base'; - -integrationTest(__filename, '*.ts'); diff --git a/tests/integration/tests/vue-jsx.test.ts b/tests/integration/tests/vue-jsx.test.ts deleted file mode 100644 index 18a482247ac..00000000000 --- a/tests/integration/tests/vue-jsx.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { integrationTest } from '../integration-test-base'; - -integrationTest(__filename, '*.vue'); diff --git a/tests/integration/tests/vue-sfc.test.ts b/tests/integration/tests/vue-sfc.test.ts deleted file mode 100644 index 18a482247ac..00000000000 --- a/tests/integration/tests/vue-sfc.test.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { integrationTest } from '../integration-test-base'; - -integrationTest(__filename, '*.vue'); diff --git a/tests/integration/tsconfig.json b/tests/integration/tsconfig.json deleted file mode 100644 index e6c02e537a6..00000000000 --- a/tests/integration/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "compilerOptions": { - "esModuleInterop": true, - "resolveJsonModule": true, - "rootDir": "." - }, - "include": ["./*.ts", "./tests/*.test.ts"], - "references": [] -} diff --git a/tests/performance/README.md b/tests/performance/README.md deleted file mode 100644 index ff1fd586482..00000000000 --- a/tests/performance/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Temp README (intended for maintainers only at this time) - -Run: - -```sh -docker-compose -f tests/performance/docker-compose.yml up --build -``` - -It will build the docker container, create volumes for the local files, and will clone the real world project repo ready for experimentation. - -The docker container is configured to run forever, so you just need to attach a shell to it, - -e.g. by running - -```sh -docker exec -it {{ RUNNING_CONTAINER_ID_HERE }} bash -``` - -Or by using the docker extension in VSCode and right clicking on the running container. - -Every time you make an update to the local built packages (e.g. `parser` or `eslint-plugin`), you need to rerun -the utility script _within_ the running container. - -For example, you will run something like the following (where `root@a91d93f9ffc3` refers to what's running in your container): - -```sh -root@a91d93f9ffc3:/usr/vega-lite# ../linked/install-local-packages.sh -``` diff --git a/tests/performance/docker-compose.yml b/tests/performance/docker-compose.yml deleted file mode 100644 index bf737b239a3..00000000000 --- a/tests/performance/docker-compose.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: '3' - -services: - lint-real-repo: - build: ./fixtures/lint-real-repo - container_name: 'lint-real-repo' - volumes: - # Runtime link to the relevant built @typescript-eslint packages and test utils, - # but apply an empty volume for the package tests, we don't need those. - - ../../package.json/:/usr/root-package.json - - ./utils/:/usr/utils - - ../../packages/parser/:/usr/parser - - /usr/parser/tests - - ../../packages/typescript-estree/:/usr/typescript-estree - - /usr/typescript-estree/tests - - ../../packages/eslint-plugin/:/usr/eslint-plugin - - /usr/eslint-plugin/tests - - ../../packages/eslint-plugin-tslint/:/usr/eslint-plugin-tslint - - /usr/eslint-plugin-tslint/tests - # Runtime link to all the specific integration test files, so that most updates don't require a rebuild. - - ./fixtures/lint-real-repo:/usr/linked diff --git a/tests/performance/fixtures/lint-real-repo/Dockerfile b/tests/performance/fixtures/lint-real-repo/Dockerfile deleted file mode 100644 index f3002796ecb..00000000000 --- a/tests/performance/fixtures/lint-real-repo/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:carbon - -WORKDIR /usr - -# Clone the repo and checkout the relevant commit -RUN git clone https://github.com/typescript-eslint/vega-lite -WORKDIR /usr/vega-lite -RUN git checkout f1e4c1ebe50fdf3b9131ba5dde915e6efbe4bd87 - -# Run the equivalent of the project's travis build before linting starts -RUN yarn install --frozen-lockfile && yarn cache clean -RUN yarn build - -# Keep the container alive forever -CMD [ "tail", "-f", "/dev/null"] diff --git a/tests/performance/fixtures/lint-real-repo/install-local-packages.sh b/tests/performance/fixtures/lint-real-repo/install-local-packages.sh deleted file mode 100755 index 0807e303b89..00000000000 --- a/tests/performance/fixtures/lint-real-repo/install-local-packages.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -exuo pipefail - -# This script should be run by attaching a shell to the running docker -# container, and then running `../linked/install-local-packages.sh` from -# that shell. -# -# Use the local volumes for our own packages -# NOTE: You need to rerun this script every time the local packages change -# in order to apply the changes to the node_modules of the repo under test -yarn add @typescript-eslint/typescript-estree@file:///usr/typescript-estree -yarn add @typescript-eslint/parser@file:///usr/parser -yarn add @typescript-eslint/eslint-plugin@file:///usr/eslint-plugin diff --git a/tools/dummypkg/README.md b/tools/dummypkg/README.md new file mode 100644 index 00000000000..a1e34930477 --- /dev/null +++ b/tools/dummypkg/README.md @@ -0,0 +1,3 @@ +# dummy-pkg + +This exists as a way for us to shim-out npm packages that we don't want to install in our repo. diff --git a/tools/dummypkg/index.d.ts b/tools/dummypkg/index.d.ts new file mode 100644 index 00000000000..cb0ff5c3b54 --- /dev/null +++ b/tools/dummypkg/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/dummypkg/index.js b/tools/dummypkg/index.js new file mode 100644 index 00000000000..5a0e9a5b821 --- /dev/null +++ b/tools/dummypkg/index.js @@ -0,0 +1 @@ +exports.value = 'a'; diff --git a/tools/dummypkg/package.json b/tools/dummypkg/package.json new file mode 100644 index 00000000000..4c5cdcf8737 --- /dev/null +++ b/tools/dummypkg/package.json @@ -0,0 +1,6 @@ +{ + "name": "dummypkg", + "version": "1.0.0", + "main": "./index.js", + "types": "./index.d.ts" +} diff --git a/tools/generate-website-dts.ts b/tools/generate-website-dts.ts deleted file mode 100644 index 134945cfc85..00000000000 --- a/tools/generate-website-dts.ts +++ /dev/null @@ -1,113 +0,0 @@ -import fetch from 'cross-fetch'; -import * as fs from 'fs'; -import * as path from 'path'; - -const baseHost = 'https://www.staging-typescript.org'; - -async function getFileAndStoreLocally( - url: string, - path: string, - editFunc: (arg: string) => string = (text: string): string => text, -): Promise { - const response = await fetch(baseHost + url, { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }); - const contents = await response.text(); - fs.writeFileSync(path, editFunc(contents), 'utf8'); -} - -async function main(): Promise { - const vendor = path.join( - __dirname, - '..', - 'packages', - 'website', - 'src', - 'vendor', - ); - const ds = path.join(vendor, 'ds'); - - if (!fs.existsSync(vendor)) { - fs.mkdirSync(vendor); - } - if (!fs.existsSync(ds)) { - fs.mkdirSync(ds); - } - - // The API for the monaco typescript worker - await getFileAndStoreLocally( - '/js/sandbox/tsWorker.d.ts', - path.join(vendor, 'tsWorker.d.ts'), - ); - - // The Design System DTS - await getFileAndStoreLocally( - '/js/playground/ds/createDesignSystem.d.ts', - path.join(ds, 'createDesignSystem.d.ts'), - text => { - return text.replace('typescriptlang-org/static/js/sandbox', '../sandbox'); - }, - ); - - // Util funcs - await getFileAndStoreLocally( - '/js/playground/pluginUtils.d.ts', - path.join(vendor, 'pluginUtils.d.ts'), - text => { - return text.replace('from "@typescript/sandbox"', 'from "./sandbox"'); - }, - ); - - // TS-VFS - await getFileAndStoreLocally( - '/js/sandbox/vendor/typescript-vfs.d.ts', - path.join(vendor, 'typescript-vfs.d.ts'), - text => { - const removeImports = text.replace( - '/// ', - '', - ); - return removeImports.replace('import("lz-string").LZStringStatic', 'any'); - }, - ); - - // Sandbox - await getFileAndStoreLocally( - '/js/sandbox/index.d.ts', - path.join(vendor, 'sandbox.d.ts'), - text => { - return text - .replace(/import lzstring/g, '// import lzstring') - .replace('"./vendor/typescript-vfs"', "'./typescript-vfs'") - .replace('lzstring: typeof lzstring', '// lzstring: typeof lzstring'); - }, - ); - - // Playground - await getFileAndStoreLocally( - '/js/playground/index.d.ts', - path.join(vendor, '/playground.d.ts'), - text => { - const replaceSandbox = text.replace(/@typescript\/sandbox/g, './sandbox'); - const replaceTSVFS = replaceSandbox.replace( - /typescriptlang-org\/static\/js\/sandbox\/vendor\/typescript-vfs/g, - './typescript-vfs', - ); - const removedLZ = replaceTSVFS.replace( - 'lzstring: typeof', - '// lzstring: typeof', - ); - const removedWorker = removedLZ.replace( - 'getWorkerProcess', - '// getWorkerProcess', - ); - return removedWorker.replace('ui:', '// ui:'); - }, - ); -} - -main().catch(error => { - console.error(error); - process.exitCode = 1; -}); diff --git a/tsconfig.base.json b/tsconfig.base.json index 7bb2b5a7fa8..fd7ed6a809f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -6,15 +6,15 @@ "declaration": true, "declarationMap": true, "esModuleInterop": true, - "module": "commonjs", - "moduleResolution": "node", + "module": "Node16", + "moduleResolution": "node16", "noImplicitReturns": true, "pretty": true, "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "es2017", - "lib": ["es2017"], + "target": "ES2021", + "lib": ["ES2021"], "paths": {} } } diff --git a/yarn.lock b/yarn.lock index 77b776c94d1..0948e60c3fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,36 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + +"@actions/core@^1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.10.0.tgz#44551c3c71163949a2f06e94d9ca2157a0cfac4f" + integrity sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug== + dependencies: + "@actions/http-client" "^2.0.1" + uuid "^8.3.2" + +"@actions/github@^5.1.1": + version "5.1.1" + resolved "https://registry.yarnpkg.com/@actions/github/-/github-5.1.1.tgz#40b9b9e1323a5efcf4ff7dadd33d8ea51651bbcb" + integrity sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g== + dependencies: + "@actions/http-client" "^2.0.1" + "@octokit/core" "^3.6.0" + "@octokit/plugin-paginate-rest" "^2.17.0" + "@octokit/plugin-rest-endpoint-methods" "^5.13.0" + +"@actions/http-client@^2.0.1": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-2.1.0.tgz#b6d8c3934727d6a50d10d19f00a711a964599a9f" + integrity sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw== + dependencies: + tunnel "^0.0.6" + "@algolia/autocomplete-core@1.7.1": version "1.7.1" resolved "https://registry.yarnpkg.com/@algolia/autocomplete-core/-/autocomplete-core-1.7.1.tgz#025538b8a9564a9f3dd5bcf8a236d6951c76c7d1" @@ -131,11 +161,11 @@ "@algolia/requester-common" "4.13.1" "@ampproject/remapping@^2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d" - integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w== + version "2.2.1" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" + integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== dependencies: - "@jridgewell/gen-mapping" "^0.1.0" + "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" "@apideck/better-ajv-errors@^0.3.1": @@ -147,45 +177,45 @@ jsonpointer "^5.0.0" leven "^3.1.0" -"@axe-core/playwright@^4.4.5": - version "4.6.0" - resolved "https://registry.yarnpkg.com/@axe-core/playwright/-/playwright-4.6.0.tgz#9a91118e6876ece891eac17fa49174d77caf9356" - integrity sha512-q9K4GVJ1fH8FQqErgs01dwzhOJ03vZDfMg+vO9Er05BxQOCp9Rm8oyB3byVzC7oNlxFaPU1qQ8zLwZYypHmchw== +"@axe-core/playwright@^4.7.3": + version "4.7.3" + resolved "https://registry.yarnpkg.com/@axe-core/playwright/-/playwright-4.7.3.tgz#aa9b9e563c2c2c5024ff777da6c4f2e5f93dd8f4" + integrity sha512-v2PRgAyGvop7bamrTpNJtc5b1R7giAPnMzZXrS/VDZBCY5+uwVYtCNgDvBsqp5P1QMZxUMoBN+CERJUTMjFN0A== dependencies: - axe-core "^4.6.1" + axe-core "^4.7.0" -"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.8.3": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" - integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== +"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.22.5", "@babel/code-frame@^7.8.3": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" + integrity sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ== dependencies: - "@babel/highlight" "^7.18.6" + "@babel/highlight" "^7.22.5" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.18.8", "@babel/compat-data@^7.19.3", "@babel/compat-data@^7.20.5": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.0.tgz#c241dc454e5b5917e40d37e525e2f4530c399298" - integrity sha512-gMuZsmsgxk/ENC3O/fRw5QY8A9/uxQbbCEypnLIiYYc/qVJtEV7ouxC3EllIIwNzMqAQee5tanFabWsUOutS7g== +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.5", "@babel/compat-data@^7.21.5", "@babel/compat-data@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" + integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== -"@babel/core@*", "@babel/core@^7.11.1", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.15.5", "@babel/core@^7.18.6", "@babel/core@^7.20.2": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.21.3.tgz#cf1c877284a469da5d1ce1d1e53665253fae712e" - integrity sha512-qIJONzoa/qiHghnm0l1n4i/6IIziDpzqc36FBs4pzMhDUraHqponwJLiAKm1hGLP3OSB/TVNz6rMwVGpwxxySw== +"@babel/core@*", "@babel/core@^7.11.1", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.15.0", "@babel/core@^7.15.5", "@babel/core@^7.18.6", "@babel/core@^7.22.8": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.9.tgz#bd96492c68822198f33e8a256061da3cf391f58f" + integrity sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w== dependencies: "@ampproject/remapping" "^2.2.0" - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.21.3" - "@babel/helper-compilation-targets" "^7.20.7" - "@babel/helper-module-transforms" "^7.21.2" - "@babel/helpers" "^7.21.0" - "@babel/parser" "^7.21.3" - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.21.3" - "@babel/types" "^7.21.3" + "@babel/code-frame" "^7.22.5" + "@babel/generator" "^7.22.9" + "@babel/helper-compilation-targets" "^7.22.9" + "@babel/helper-module-transforms" "^7.22.9" + "@babel/helpers" "^7.22.6" + "@babel/parser" "^7.22.7" + "@babel/template" "^7.22.5" + "@babel/traverse" "^7.22.8" + "@babel/types" "^7.22.5" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.2" - semver "^6.3.0" + semver "^6.3.1" "@babel/core@7.12.9": version "7.12.9" @@ -209,21 +239,21 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/eslint-parser@*", "@babel/eslint-parser@^7.19.1": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.21.3.tgz#d79e822050f2de65d7f368a076846e7184234af7" - integrity sha512-kfhmPimwo6k4P8zxNs8+T7yR44q1LdpsZdE1NkCsVlfiuTPRfnGgjaF8Qgug9q9Pou17u6wneYF0lDCZJATMFg== +"@babel/eslint-parser@*", "@babel/eslint-parser@^7.22.7": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.22.9.tgz#75f8aa978d1e76c87cc6f26c1ea16ae58804d390" + integrity sha512-xdMkt39/nviO/4vpVdrEYPwXCsYIXSSAr6mC7WQsNIlGnuxKyKE7GZjalcnbSWiC4OXGNNN3UQPeHfjSC6sTDA== dependencies: "@nicolo-ribaudo/eslint-scope-5-internals" "5.1.1-v1" eslint-visitor-keys "^2.1.0" - semver "^6.3.0" + semver "^6.3.1" -"@babel/generator@^7.12.5", "@babel/generator@^7.18.7", "@babel/generator@^7.21.3", "@babel/generator@^7.7.2": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.3.tgz#232359d0874b392df04045d72ce2fd9bb5045fce" - integrity sha512-QS3iR1GYC/YGUnW7IdggFeN5c1poPUurnGttOV/bZgPGV+izC/D8HnD6DLwod0fsatNyVn1G3EVWMYIF0nHbeA== +"@babel/generator@^7.12.5", "@babel/generator@^7.18.7", "@babel/generator@^7.22.7", "@babel/generator@^7.22.9", "@babel/generator@^7.7.2": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.9.tgz#572ecfa7a31002fa1de2a9d91621fd895da8493d" + integrity sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw== dependencies: - "@babel/types" "^7.21.3" + "@babel/types" "^7.22.5" "@jridgewell/gen-mapping" "^0.3.2" "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" @@ -243,39 +273,42 @@ "@babel/helper-explode-assignable-expression" "^7.18.6" "@babel/types" "^7.18.9" -"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.19.0", "@babel/helper-compilation-targets@^7.19.3", "@babel/helper-compilation-targets@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz#a6cd33e93629f5eb473b021aac05df62c4cd09bb" - integrity sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ== +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.20.7", "@babel/helper-compilation-targets@^7.21.5", "@babel/helper-compilation-targets@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.9.tgz#f9d0a7aaaa7cd32a3f31c9316a69f5a9bcacb892" + integrity sha512-7qYrNM6HjpnPHJbopxmb8hSPoZ0gsX8IvUS32JGVoy+pU9e5N0nLr1VjJoR6kA4d9dmGLxNYOjeB8sUDal2WMw== dependencies: - "@babel/compat-data" "^7.20.5" - "@babel/helper-validator-option" "^7.18.6" - browserslist "^4.21.3" + "@babel/compat-data" "^7.22.9" + "@babel/helper-validator-option" "^7.22.5" + browserslist "^4.21.9" lru-cache "^5.1.1" - semver "^6.3.0" + semver "^6.3.1" -"@babel/helper-create-class-features-plugin@^7.18.6": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.18.9.tgz#d802ee16a64a9e824fcbf0a2ffc92f19d58550ce" - integrity sha512-WvypNAYaVh23QcjpMR24CwZY2Nz6hqdOcFdPbNpV56hL5H6KiFheO7Xm1aPdlLQ7d5emYZX7VZwPp9x3z+2opw== +"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.21.0": + version "7.21.8" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.8.tgz#205b26330258625ef8869672ebca1e0dee5a0f02" + integrity sha512-+THiN8MqiH2AczyuZrnrKL6cAxFRRQDKW9h1YkBvbgKmAm6mwiacig1qT73DHIWMGo40GRnsEfN3LA+E6NtmSw== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" - "@babel/helper-member-expression-to-functions" "^7.18.9" + "@babel/helper-environment-visitor" "^7.21.5" + "@babel/helper-function-name" "^7.21.0" + "@babel/helper-member-expression-to-functions" "^7.21.5" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/helper-replace-supers" "^7.18.9" + "@babel/helper-replace-supers" "^7.21.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" "@babel/helper-split-export-declaration" "^7.18.6" + semver "^6.3.0" -"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.19.0.tgz#7976aca61c0984202baca73d84e2337a5424a41b" - integrity sha512-htnV+mHX32DF81amCDrwIDr8nrp1PTm+3wfBN9/v8QJOLEioOCOG7qNyq0nHeFiWbT3Eb7gsPwEmV64UCQ1jzw== +"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.20.5": + version "7.21.8" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.8.tgz#a7886f61c2e29e21fd4aaeaf1e473deba6b571dc" + integrity sha512-zGuSdedkFtsFHGbexAvNuipg1hbtitDLo2XE8/uf6Y9sOQV1xsYX/2pNbtedp/X0eU1pIt+kGvaqHCowkRbS5g== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - regexpu-core "^5.1.0" + regexpu-core "^5.3.1" + semver "^6.3.0" -"@babel/helper-define-polyfill-provider@^0.3.1", "@babel/helper-define-polyfill-provider@^0.3.2", "@babel/helper-define-polyfill-provider@^0.3.3": +"@babel/helper-define-polyfill-provider@^0.3.3": version "0.3.3" resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz#8612e55be5d51f0cd1f36b4a5a83924e89884b7a" integrity sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww== @@ -287,10 +320,10 @@ resolve "^1.14.2" semver "^6.1.2" -"@babel/helper-environment-visitor@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be" - integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg== +"@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.21.5", "@babel/helper-environment-visitor@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98" + integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q== "@babel/helper-explode-assignable-expression@^7.18.6": version "7.18.6" @@ -299,48 +332,45 @@ dependencies: "@babel/types" "^7.18.6" -"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0", "@babel/helper-function-name@^7.21.0": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4" - integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg== +"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.21.0", "@babel/helper-function-name@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz#ede300828905bb15e582c037162f99d5183af1be" + integrity sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ== dependencies: - "@babel/template" "^7.20.7" - "@babel/types" "^7.21.0" + "@babel/template" "^7.22.5" + "@babel/types" "^7.22.5" -"@babel/helper-hoist-variables@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678" - integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q== +"@babel/helper-hoist-variables@^7.18.6", "@babel/helper-hoist-variables@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== dependencies: - "@babel/types" "^7.18.6" + "@babel/types" "^7.22.5" -"@babel/helper-member-expression-to-functions@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.18.9.tgz#1531661e8375af843ad37ac692c132841e2fd815" - integrity sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg== +"@babel/helper-member-expression-to-functions@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.5.tgz#3b1a009af932e586af77c1030fba9ee0bde396c0" + integrity sha512-nIcGfgwpH2u4n9GG1HpStW5Ogx7x7ekiFHbjjFRKXbn5zUvqO9ZgotCO4x1aNbKn/x/xOUaXEhyNHCwtFCpxWg== dependencies: - "@babel/types" "^7.18.9" + "@babel/types" "^7.21.5" -"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e" - integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA== +"@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.18.6", "@babel/helper-module-imports@^7.21.4", "@babel/helper-module-imports@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz#1a8f4c9f4027d23f520bd76b364d44434a72660c" + integrity sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg== dependencies: - "@babel/types" "^7.18.6" + "@babel/types" "^7.22.5" -"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.0", "@babel/helper-module-transforms@^7.21.2": - version "7.21.2" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz#160caafa4978ac8c00ac66636cb0fa37b024e2d2" - integrity sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ== +"@babel/helper-module-transforms@^7.12.1", "@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.20.11", "@babel/helper-module-transforms@^7.21.5", "@babel/helper-module-transforms@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz#92dfcb1fbbb2bc62529024f72d942a8c97142129" + integrity sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ== dependencies: - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-simple-access" "^7.20.2" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/helper-validator-identifier" "^7.19.1" - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.21.2" - "@babel/types" "^7.21.2" + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-module-imports" "^7.22.5" + "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/helper-validator-identifier" "^7.22.5" "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" @@ -354,12 +384,12 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.17.12", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629" - integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ== +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.17.12", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.21.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" + integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== -"@babel/helper-remap-async-to-generator@^7.18.6", "@babel/helper-remap-async-to-generator@^7.18.9": +"@babel/helper-remap-async-to-generator@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz#997458a0e3357080e54e1d79ec347f8a8cd28519" integrity sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA== @@ -369,52 +399,53 @@ "@babel/helper-wrap-function" "^7.18.9" "@babel/types" "^7.18.9" -"@babel/helper-replace-supers@^7.18.6", "@babel/helper-replace-supers@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz#1092e002feca980fbbb0bd4d51b74a65c6a500e6" - integrity sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ== +"@babel/helper-replace-supers@^7.18.6", "@babel/helper-replace-supers@^7.20.7", "@babel/helper-replace-supers@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.21.5.tgz#a6ad005ba1c7d9bc2973dfde05a1bba7065dde3c" + integrity sha512-/y7vBgsr9Idu4M6MprbOVUfH3vs7tsIfnVWv/Ml2xgwvyH6LTngdfbf5AdsKwkJy4zgy1X/kuNrEKvhhK28Yrg== dependencies: - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-member-expression-to-functions" "^7.18.9" + "@babel/helper-environment-visitor" "^7.21.5" + "@babel/helper-member-expression-to-functions" "^7.21.5" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/traverse" "^7.18.9" - "@babel/types" "^7.18.9" + "@babel/template" "^7.20.7" + "@babel/traverse" "^7.21.5" + "@babel/types" "^7.21.5" -"@babel/helper-simple-access@^7.18.6", "@babel/helper-simple-access@^7.20.2": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9" - integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA== +"@babel/helper-simple-access@^7.21.5", "@babel/helper-simple-access@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" + integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== dependencies: - "@babel/types" "^7.20.2" + "@babel/types" "^7.22.5" -"@babel/helper-skip-transparent-expression-wrappers@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.18.9.tgz#778d87b3a758d90b471e7b9918f34a9a02eb5818" - integrity sha512-imytd2gHi3cJPsybLRbmFrF7u5BIEuI2cNheyKi3/iOBC63kNn3q8Crn2xVuESli0aM4KYsyEqKyS7lFL8YVtw== +"@babel/helper-skip-transparent-expression-wrappers@^7.20.0": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.20.0.tgz#fbe4c52f60518cab8140d77101f0e63a8a230684" + integrity sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg== dependencies: - "@babel/types" "^7.18.9" + "@babel/types" "^7.20.0" -"@babel/helper-split-export-declaration@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075" - integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA== +"@babel/helper-split-export-declaration@^7.18.6", "@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== dependencies: - "@babel/types" "^7.18.6" + "@babel/types" "^7.22.5" -"@babel/helper-string-parser@^7.19.4": - version "7.19.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63" - integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw== +"@babel/helper-string-parser@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f" + integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw== -"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2" - integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w== +"@babel/helper-validator-identifier@^7.19.1", "@babel/helper-validator-identifier@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz#9544ef6a33999343c8740fa51350f30eeaaaf193" + integrity sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ== -"@babel/helper-validator-option@^7.18.6": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180" - integrity sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ== +"@babel/helper-validator-option@^7.18.6", "@babel/helper-validator-option@^7.21.0", "@babel/helper-validator-option@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz#de52000a15a177413c8234fa3a8af4ee8102d0ac" + integrity sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw== "@babel/helper-wrap-function@^7.18.9": version "7.18.9" @@ -426,28 +457,28 @@ "@babel/traverse" "^7.18.9" "@babel/types" "^7.18.9" -"@babel/helpers@^7.12.5", "@babel/helpers@^7.21.0": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.21.0.tgz#9dd184fb5599862037917cdc9eecb84577dc4e7e" - integrity sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA== +"@babel/helpers@^7.12.5", "@babel/helpers@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.6.tgz#8e61d3395a4f0c5a8060f309fb008200969b5ecd" + integrity sha512-YjDs6y/fVOYFV8hAf1rxd1QvR9wJe1pDBZ2AREKq/SDayfPzgk0PBnVuTCE5X1acEpMMNOVUqoe+OwiZGJ+OaA== dependencies: - "@babel/template" "^7.20.7" - "@babel/traverse" "^7.21.0" - "@babel/types" "^7.21.0" + "@babel/template" "^7.22.5" + "@babel/traverse" "^7.22.6" + "@babel/types" "^7.22.5" -"@babel/highlight@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" - integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== +"@babel/highlight@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.5.tgz#aa6c05c5407a67ebce408162b7ede789b4d22031" + integrity sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw== dependencies: - "@babel/helper-validator-identifier" "^7.18.6" + "@babel/helper-validator-identifier" "^7.22.5" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.18.8", "@babel/parser@^7.20.7", "@babel/parser@^7.21.2", "@babel/parser@^7.21.3": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.3.tgz#1d285d67a19162ff9daa358d4cb41d50c06220b3" - integrity sha512-lobG0d7aOfQRXh8AyklEAgZGvA4FShxo6xQbUrrT/cNBPUdIDojlokwJsQyCC/eKia7ifqM0yP+2DRZ4WKw2RQ== +"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.18.8", "@babel/parser@^7.20.7", "@babel/parser@^7.22.5", "@babel/parser@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae" + integrity sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": version "7.18.6" @@ -456,26 +487,26 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.18.9.tgz#a11af19aa373d68d561f08e0a57242350ed0ec50" - integrity sha512-AHrP9jadvH7qlOj6PINbgSuphjQUAK7AOT7DPjBo9EHoLhQTnnK5u45e1Hd4DbSQEO9nqPWtQ89r+XEOWFScKg== +"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.20.7.tgz#d9c85589258539a22a901033853101a6198d4ef1" + integrity sha512-sbr9+wNE5aXMBBFBICk01tt7sBf2Oc9ikRFEcem/ZORup9IMUdNhW7/wVLEbbtlWOsEubJet46mHAL2C8+2jKQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" - "@babel/plugin-proposal-optional-chaining" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" + "@babel/plugin-proposal-optional-chaining" "^7.20.7" -"@babel/plugin-proposal-async-generator-functions@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz#34f6f5174b688529342288cd264f80c9ea9fb4a7" - integrity sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q== +"@babel/plugin-proposal-async-generator-functions@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz#bfb7276d2d573cb67ba379984a2334e262ba5326" + integrity sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA== dependencies: "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-plugin-utils" "^7.19.0" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" -"@babel/plugin-proposal-class-properties@^7.18.6": +"@babel/plugin-proposal-class-properties@^7.14.5", "@babel/plugin-proposal-class-properties@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== @@ -483,15 +514,26 @@ "@babel/helper-create-class-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-proposal-class-static-block@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.18.6.tgz#8aa81d403ab72d3962fc06c26e222dacfc9b9020" - integrity sha512-+I3oIiNxrCpup3Gi8n5IGMwj0gOCAjcJUSQEcotNnCCPMEnixawOQ+KeJPlgfjzx+FKQ1QSyZOWe7wmoJp7vhw== +"@babel/plugin-proposal-class-static-block@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.21.0.tgz#77bdd66fb7b605f3a61302d224bdfacf5547977d" + integrity sha512-XP5G9MWNUskFuP30IfFSEFB0Z6HzLIUcjYM4bYOPHXl7eiJ9HFv8tWj6TXTN5QODiEhDZAeI4hLok2iHFFV4hw== dependencies: - "@babel/helper-create-class-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-class-static-block" "^7.14.5" +"@babel/plugin-proposal-decorators@^7.14.5": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.21.0.tgz#70e0c89fdcd7465c97593edb8f628ba6e4199d63" + integrity sha512-MfgX49uRrFUTL/HvWtmx3zmpyzMMr4MTj3d527MLlr/4RTT9G/ytFFP7qet2uM2Ve03b+BkpWUpK+lRXnQ+v9w== + dependencies: + "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-replace-supers" "^7.20.7" + "@babel/helper-split-export-declaration" "^7.18.6" + "@babel/plugin-syntax-decorators" "^7.21.0" + "@babel/plugin-proposal-dynamic-import@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz#72bcf8d408799f547d759298c3c27c7e7faa4d94" @@ -516,12 +558,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-json-strings" "^7.8.3" -"@babel/plugin-proposal-logical-assignment-operators@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.18.9.tgz#8148cbb350483bf6220af06fa6db3690e14b2e23" - integrity sha512-128YbMpjCrP35IOExw2Fq+x55LMP42DzhOhX2aNNIdI9avSWl2PI0yuBWarr3RYpZBSPtabfadkH2yeRiMD61Q== +"@babel/plugin-proposal-logical-assignment-operators@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.20.7.tgz#dfbcaa8f7b4d37b51e8bfb46d94a5aea2bb89d83" + integrity sha512-y7C7cZgpMIjWlKE5T7eJwp+tnRYM89HmRvWM5EQuB5BoHEONjmQ8lSNmBUwOyy/GFRsohJED51YBF79hE1djug== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-proposal-nullish-coalescing-operator@^7.18.6": @@ -549,16 +591,16 @@ "@babel/plugin-syntax-object-rest-spread" "^7.8.0" "@babel/plugin-transform-parameters" "^7.12.1" -"@babel/plugin-proposal-object-rest-spread@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz#f9434f6beb2c8cae9dfcf97d2a5941bbbf9ad4e7" - integrity sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q== +"@babel/plugin-proposal-object-rest-spread@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a" + integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg== dependencies: - "@babel/compat-data" "^7.18.8" - "@babel/helper-compilation-targets" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/compat-data" "^7.20.5" + "@babel/helper-compilation-targets" "^7.20.7" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.18.8" + "@babel/plugin-transform-parameters" "^7.20.7" "@babel/plugin-proposal-optional-catch-binding@^7.18.6": version "7.18.6" @@ -568,13 +610,13 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" -"@babel/plugin-proposal-optional-chaining@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.18.9.tgz#e8e8fe0723f2563960e4bf5e9690933691915993" - integrity sha512-v5nwt4IqBXihxGsW2QmCWMDS3B3bzGIk/EQVZz2ei7f3NJl8NzAJVvUmpDW5q1CRNY+Beb/k58UAH1Km1N411w== +"@babel/plugin-proposal-optional-chaining@^7.20.7", "@babel/plugin-proposal-optional-chaining@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz#886f5c8978deb7d30f678b2e24346b287234d3ea" + integrity sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-proposal-private-methods@^7.18.6": @@ -585,14 +627,14 @@ "@babel/helper-create-class-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-proposal-private-property-in-object@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.18.6.tgz#a64137b232f0aca3733a67eb1a144c192389c503" - integrity sha512-9Rysx7FOctvT5ouj5JODjAFAkgGoudQuLPamZb0v1TGLpapdNaftzifU8NTWQm0IRjqoYypdrSmyWgkocDQ8Dw== +"@babel/plugin-proposal-private-property-in-object@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0.tgz#19496bd9883dd83c23c7d7fc45dcd9ad02dfa1dc" + integrity sha512-ha4zfehbJjc5MmXBlHec1igel5TJXXLDDRbuJ4+XT2TJcyD9/V1919BA8gMvsdHcNMBy4WBUBiRb3nw/EQUtBw== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-create-class-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-create-class-features-plugin" "^7.21.0" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-proposal-unicode-property-regex@^7.18.6", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": @@ -631,6 +673,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" +"@babel/plugin-syntax-decorators@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.21.0.tgz#d2b3f31c3e86fa86e16bb540b7660c55bd7d0e78" + integrity sha512-tIoPpGBR8UuM4++ccWN3gifhVvQu7ZizuR1fklhRJrd5ewgbkUS+0KVFeWWxELtn18NTLoW32XV7zyOgIAiz+w== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-dynamic-import@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" @@ -645,14 +694,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-import-assertions@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz#cd6190500a4fa2fe31990a963ffab4b63e4505e4" - integrity sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ== +"@babel/plugin-syntax-import-assertions@^7.20.0": + version "7.20.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz#bb50e0d4bea0957235390641209394e87bdb9cc4" + integrity sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.19.0" -"@babel/plugin-syntax-import-meta@^7.8.3": +"@babel/plugin-syntax-import-meta@^7.10.4", "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== @@ -736,28 +785,28 @@ dependencies: "@babel/helper-plugin-utils" "^7.14.5" -"@babel/plugin-syntax-typescript@^7.18.6", "@babel/plugin-syntax-typescript@^7.7.2": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7" - integrity sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ== +"@babel/plugin-syntax-typescript@^7.18.6", "@babel/plugin-syntax-typescript@^7.3.3", "@babel/plugin-syntax-typescript@^7.7.2": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.21.4.tgz#2751948e9b7c6d771a8efa59340c15d4a2891ff8" + integrity sha512-xz0D39NvhQn4t4RNsHmDnnsaQizIlUkdtYvLs8La1BlfjQ6JEwxkJGeqJMW2tAXx+q6H+WFuUTXNdYVpEya0YA== dependencies: - "@babel/helper-plugin-utils" "^7.19.0" + "@babel/helper-plugin-utils" "^7.20.2" -"@babel/plugin-transform-arrow-functions@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz#19063fcf8771ec7b31d742339dac62433d0611fe" - integrity sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ== +"@babel/plugin-transform-arrow-functions@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.21.5.tgz#9bb42a53de447936a57ba256fbf537fc312b6929" + integrity sha512-wb1mhwGOCaXHDTcsRYMKF9e5bbMgqwxtqa2Y1ifH96dXJPwbuLX9qHy3clhrxVqgMz7nyNXs8VkxdH8UBcjKqA== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.21.5" -"@babel/plugin-transform-async-to-generator@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.18.6.tgz#ccda3d1ab9d5ced5265fdb13f1882d5476c71615" - integrity sha512-ARE5wZLKnTgPW7/1ftQmSi1CmkqqHo2DNmtztFhvgtOWSDfq0Cq9/9L+KnZNYSNrydBekhW3rwShduf59RoXag== +"@babel/plugin-transform-async-to-generator@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.20.7.tgz#dfee18623c8cb31deb796aa3ca84dda9cea94354" + integrity sha512-Uo5gwHPT9vgnSXQxqGtpdufUiWp96gk7yiP4Mp5bm1QMkEmLXBO7PAGYbKoJ6DhAwiNkcHFBol/x5zZZkL/t0Q== dependencies: "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/helper-remap-async-to-generator" "^7.18.6" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-transform-block-scoped-functions@^7.18.6": version "7.18.6" @@ -766,41 +815,42 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-block-scoping@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz#f9b7e018ac3f373c81452d6ada8bd5a18928926d" - integrity sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw== +"@babel/plugin-transform-block-scoping@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.21.0.tgz#e737b91037e5186ee16b76e7ae093358a5634f02" + integrity sha512-Mdrbunoh9SxwFZapeHVrwFmri16+oYotcZysSzhNIVDwIAb1UV+kvnxULSYq9J3/q5MDG+4X6w8QVgD1zhBXNQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" -"@babel/plugin-transform-classes@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz#0e61ec257fba409c41372175e7c1e606dc79bb20" - integrity sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A== +"@babel/plugin-transform-classes@^7.21.0": + version "7.21.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.21.0.tgz#f469d0b07a4c5a7dbb21afad9e27e57b47031665" + integrity sha512-RZhbYTCEUAe6ntPehC4hlslPWosNHDox+vAs4On/mCLRLfoDVHf6hVEd7kuxr1RnHwJmxFfUM3cZiZRmPxJPXQ== dependencies: "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-compilation-targets" "^7.19.0" + "@babel/helper-compilation-targets" "^7.20.7" "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" + "@babel/helper-function-name" "^7.21.0" "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/helper-replace-supers" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-replace-supers" "^7.20.7" "@babel/helper-split-export-declaration" "^7.18.6" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz#2357a8224d402dad623caf6259b611e56aec746e" - integrity sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw== +"@babel/plugin-transform-computed-properties@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.21.5.tgz#3a2d8bb771cd2ef1cd736435f6552fe502e11b44" + integrity sha512-TR653Ki3pAwxBxUe8srfF3e4Pe3FTA46uaNHYyQwIoM4oWKSoOZiDNyHJ0oIoDIUPSRQbQG7jzgVBX3FPVne1Q== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.21.5" + "@babel/template" "^7.20.7" -"@babel/plugin-transform-destructuring@^7.18.13": - version "7.18.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz#9e03bc4a94475d62b7f4114938e6c5c33372cbf5" - integrity sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow== +"@babel/plugin-transform-destructuring@^7.21.3": + version "7.21.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.21.3.tgz#73b46d0fd11cd6ef57dea8a381b1215f4959d401" + integrity sha512-bp6hwMFzuiE4HqYEyoGJ/V2LeIWn+hLVKc4pnj++E5XQptwhtcGmSayM029d/j2X1bPKGTlsyPwAubuU22KhMA== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-dotall-regex@^7.18.6", "@babel/plugin-transform-dotall-regex@^7.4.4": version "7.18.6" @@ -825,12 +875,12 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-for-of@^7.18.8": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz#6ef8a50b244eb6a0bdbad0c7c61877e4e30097c1" - integrity sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ== +"@babel/plugin-transform-for-of@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.21.5.tgz#e890032b535f5a2e237a18535f56a9fdaa7b83fc" + integrity sha512-nYWpjKW/7j/I/mZkGVgHJXh4bA1sfdFnJoOXwJuj4m3Q2EraO/8ZyrkCau9P5tbHQk01RMSt6KYLCsW7730SXQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.21.5" "@babel/plugin-transform-function-name@^7.18.9": version "7.18.9" @@ -855,35 +905,32 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-modules-amd@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz#8c91f8c5115d2202f277549848874027d7172d21" - integrity sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg== +"@babel/plugin-transform-modules-amd@^7.20.11": + version "7.20.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.20.11.tgz#3daccca8e4cc309f03c3a0c4b41dc4b26f55214a" + integrity sha512-NuzCt5IIYOW0O30UvqktzHYR2ud5bOWbY0yaxWZ6G+aFzOMJvrs5YHNikrbdaT15+KNO31nPOy5Fim3ku6Zb5g== dependencies: - "@babel/helper-module-transforms" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - babel-plugin-dynamic-import-node "^2.3.3" + "@babel/helper-module-transforms" "^7.20.11" + "@babel/helper-plugin-utils" "^7.20.2" -"@babel/plugin-transform-modules-commonjs@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz#afd243afba166cca69892e24a8fd8c9f2ca87883" - integrity sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q== +"@babel/plugin-transform-modules-commonjs@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.5.tgz#d69fb947eed51af91de82e4708f676864e5e47bc" + integrity sha512-OVryBEgKUbtqMoB7eG2rs6UFexJi6Zj6FDXx+esBLPTCxCNxAY9o+8Di7IsUGJ+AVhp5ncK0fxWUBd0/1gPhrQ== dependencies: - "@babel/helper-module-transforms" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/helper-simple-access" "^7.18.6" - babel-plugin-dynamic-import-node "^2.3.3" + "@babel/helper-module-transforms" "^7.21.5" + "@babel/helper-plugin-utils" "^7.21.5" + "@babel/helper-simple-access" "^7.21.5" -"@babel/plugin-transform-modules-systemjs@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz#5f20b471284430f02d9c5059d9b9a16d4b085a1f" - integrity sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A== +"@babel/plugin-transform-modules-systemjs@^7.20.11": + version "7.20.11" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.20.11.tgz#467ec6bba6b6a50634eea61c9c232654d8a4696e" + integrity sha512-vVu5g9BPQKSFEmvt2TA4Da5N+QVS66EX21d8uoOihC+OCpUoGvzVsXeqFdtAEfVa5BILAeFt+U7yVmLbQnAJmw== dependencies: "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-module-transforms" "^7.19.0" - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/helper-validator-identifier" "^7.18.6" - babel-plugin-dynamic-import-node "^2.3.3" + "@babel/helper-module-transforms" "^7.20.11" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-validator-identifier" "^7.19.1" "@babel/plugin-transform-modules-umd@^7.18.6": version "7.18.6" @@ -893,13 +940,13 @@ "@babel/helper-module-transforms" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-named-capturing-groups-regex@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.19.1.tgz#ec7455bab6cd8fb05c525a94876f435a48128888" - integrity sha512-oWk9l9WItWBQYS4FgXD4Uyy5kq898lvkXpXQxoJEY1RnvPk4R/Dvu2ebXU9q8lP+rlMwUQTFf2Ok6d78ODa0kw== +"@babel/plugin-transform-named-capturing-groups-regex@^7.20.5": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.20.5.tgz#626298dd62ea51d452c3be58b285d23195ba69a8" + integrity sha512-mOW4tTzi5iTLnw+78iEq3gr8Aoq4WNRGpmSlrogqaiCBoR1HFhpU4JkpQFOHfeYx3ReVIFWOQJS4aZBRvuZ6mA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.19.0" - "@babel/helper-plugin-utils" "^7.19.0" + "@babel/helper-create-regexp-features-plugin" "^7.20.5" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-new-target@^7.18.6": version "7.18.6" @@ -916,12 +963,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/helper-replace-supers" "^7.18.6" -"@babel/plugin-transform-parameters@^7.12.1", "@babel/plugin-transform-parameters@^7.18.8": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz#ee9f1a0ce6d78af58d0956a9378ea3427cccb48a" - integrity sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg== +"@babel/plugin-transform-parameters@^7.12.1", "@babel/plugin-transform-parameters@^7.20.7", "@babel/plugin-transform-parameters@^7.21.3": + version "7.21.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.21.3.tgz#18fc4e797cf6d6d972cb8c411dbe8a809fa157db" + integrity sha512-Wxc+TvppQG9xWFYatvCGPvZ6+SIUxQ2ZdiBP+PHYMIjnPXD+uThCshaz4NZOnODAtBjjcVQQ/3OKs9LW28purQ== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" + "@babel/helper-plugin-utils" "^7.20.2" "@babel/plugin-transform-property-literals@^7.18.6": version "7.18.6" @@ -970,13 +1017,13 @@ "@babel/helper-annotate-as-pure" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-regenerator@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.18.6.tgz#585c66cb84d4b4bf72519a34cfce761b8676ca73" - integrity sha512-poqRI2+qiSdeldcz4wTSTXBRryoq3Gc70ye7m7UD5Ww0nE29IXqMl6r7Nd15WBgRd74vloEMlShtH6CKxVzfmQ== +"@babel/plugin-transform-regenerator@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.21.5.tgz#576c62f9923f94bcb1c855adc53561fd7913724e" + integrity sha512-ZoYBKDb6LyMi5yCsByQ5jmXsHAQDDYeexT1Szvlmui+lADvfSecr5Dxd/PkrTC3pAD182Fcju1VQkB4oCp9M+w== dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - regenerator-transform "^0.15.0" + "@babel/helper-plugin-utils" "^7.21.5" + regenerator-transform "^0.15.1" "@babel/plugin-transform-reserved-words@^7.18.6": version "7.18.6" @@ -985,16 +1032,16 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-runtime@^7.18.6": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.18.9.tgz#d9e4b1b25719307bfafbf43065ed7fb3a83adb8f" - integrity sha512-wS8uJwBt7/b/mzE13ktsJdmS4JP/j7PQSaADtnb4I2wL0zK51MQ0pmF8/Jy0wUIS96fr+fXT6S/ifiPXnvrlSg== +"@babel/plugin-transform-runtime@^7.15.0", "@babel/plugin-transform-runtime@^7.18.6": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.21.4.tgz#2e1da21ca597a7d01fc96b699b21d8d2023191aa" + integrity sha512-1J4dhrw1h1PqnNNpzwxQ2UBymJUF8KuPjAAnlLwZcGhHAIqUigFW7cdK6GHoB64ubY4qXQNYknoUeks4Wz7CUA== dependencies: - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.9" - babel-plugin-polyfill-corejs2 "^0.3.1" - babel-plugin-polyfill-corejs3 "^0.5.2" - babel-plugin-polyfill-regenerator "^0.3.1" + "@babel/helper-module-imports" "^7.21.4" + "@babel/helper-plugin-utils" "^7.20.2" + babel-plugin-polyfill-corejs2 "^0.3.3" + babel-plugin-polyfill-corejs3 "^0.6.0" + babel-plugin-polyfill-regenerator "^0.4.1" semver "^6.3.0" "@babel/plugin-transform-shorthand-properties@^7.18.6": @@ -1004,13 +1051,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-spread@^7.19.0": - version "7.19.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.19.0.tgz#dd60b4620c2fec806d60cfaae364ec2188d593b6" - integrity sha512-RsuMk7j6n+r752EtzyScnWkQyuJdli6LdO5Klv8Yx0OfPVTcQkIUfS8clx5e9yHXzlnhOZF3CbQ8C2uP5j074w== +"@babel/plugin-transform-spread@^7.20.7": + version "7.20.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.20.7.tgz#c2d83e0b99d3bf83e07b11995ee24bf7ca09401e" + integrity sha512-ewBbHQ+1U/VnH1fxltbJqDeWBU1oNLG8Dj11uIv3xVf7nrQu0bPGe5Rf716r7K5Qz+SqtAOVswoVunoiBtGhxw== dependencies: - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/helper-skip-transparent-expression-wrappers" "^7.18.9" + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" "@babel/plugin-transform-sticky-regex@^7.18.6": version "7.18.6" @@ -1042,12 +1089,12 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-syntax-typescript" "^7.18.6" -"@babel/plugin-transform-unicode-escapes@^7.18.10": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz#1ecfb0eda83d09bbcb77c09970c2dd55832aa246" - integrity sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ== +"@babel/plugin-transform-unicode-escapes@^7.21.5": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.21.5.tgz#1e55ed6195259b0e9061d81f5ef45a9b009fb7f2" + integrity sha512-LYm/gTOwZqsYohlvFUe/8Tujz75LqqVC2w+2qPHLR+WyWHGCZPN1KBpJCJn+4Bk4gOkQy/IXKIge6az5MqwlOg== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-plugin-utils" "^7.21.5" "@babel/plugin-transform-unicode-regex@^7.18.6": version "7.18.6" @@ -1057,38 +1104,39 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.15.6", "@babel/preset-env@^7.18.6": - version "7.19.3" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.19.3.tgz#52cd19abaecb3f176a4ff9cc5e15b7bf06bec754" - integrity sha512-ziye1OTc9dGFOAXSWKUqQblYHNlBOaDl8wzqf2iKXJAltYiR3hKHUKmkt+S9PppW7RQpq4fFCrwwpIDj/f5P4w== +"@babel/preset-env@^7.11.0", "@babel/preset-env@^7.15.0", "@babel/preset-env@^7.15.6", "@babel/preset-env@^7.18.6": + version "7.21.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.21.5.tgz#db2089d99efd2297716f018aeead815ac3decffb" + integrity sha512-wH00QnTTldTbf/IefEVyChtRdw5RJvODT/Vb4Vcxq1AZvtXj6T0YeX0cAcXhI6/BdGuiP3GcNIL4OQbI2DVNxg== dependencies: - "@babel/compat-data" "^7.19.3" - "@babel/helper-compilation-targets" "^7.19.3" - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/helper-validator-option" "^7.18.6" + "@babel/compat-data" "^7.21.5" + "@babel/helper-compilation-targets" "^7.21.5" + "@babel/helper-plugin-utils" "^7.21.5" + "@babel/helper-validator-option" "^7.21.0" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.18.6" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.18.9" - "@babel/plugin-proposal-async-generator-functions" "^7.19.1" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.20.7" + "@babel/plugin-proposal-async-generator-functions" "^7.20.7" "@babel/plugin-proposal-class-properties" "^7.18.6" - "@babel/plugin-proposal-class-static-block" "^7.18.6" + "@babel/plugin-proposal-class-static-block" "^7.21.0" "@babel/plugin-proposal-dynamic-import" "^7.18.6" "@babel/plugin-proposal-export-namespace-from" "^7.18.9" "@babel/plugin-proposal-json-strings" "^7.18.6" - "@babel/plugin-proposal-logical-assignment-operators" "^7.18.9" + "@babel/plugin-proposal-logical-assignment-operators" "^7.20.7" "@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.6" "@babel/plugin-proposal-numeric-separator" "^7.18.6" - "@babel/plugin-proposal-object-rest-spread" "^7.18.9" + "@babel/plugin-proposal-object-rest-spread" "^7.20.7" "@babel/plugin-proposal-optional-catch-binding" "^7.18.6" - "@babel/plugin-proposal-optional-chaining" "^7.18.9" + "@babel/plugin-proposal-optional-chaining" "^7.21.0" "@babel/plugin-proposal-private-methods" "^7.18.6" - "@babel/plugin-proposal-private-property-in-object" "^7.18.6" + "@babel/plugin-proposal-private-property-in-object" "^7.21.0" "@babel/plugin-proposal-unicode-property-regex" "^7.18.6" "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-class-properties" "^7.12.13" "@babel/plugin-syntax-class-static-block" "^7.14.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - "@babel/plugin-syntax-import-assertions" "^7.18.6" + "@babel/plugin-syntax-import-assertions" "^7.20.0" + "@babel/plugin-syntax-import-meta" "^7.10.4" "@babel/plugin-syntax-json-strings" "^7.8.3" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" @@ -1098,40 +1146,40 @@ "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" - "@babel/plugin-transform-arrow-functions" "^7.18.6" - "@babel/plugin-transform-async-to-generator" "^7.18.6" + "@babel/plugin-transform-arrow-functions" "^7.21.5" + "@babel/plugin-transform-async-to-generator" "^7.20.7" "@babel/plugin-transform-block-scoped-functions" "^7.18.6" - "@babel/plugin-transform-block-scoping" "^7.18.9" - "@babel/plugin-transform-classes" "^7.19.0" - "@babel/plugin-transform-computed-properties" "^7.18.9" - "@babel/plugin-transform-destructuring" "^7.18.13" + "@babel/plugin-transform-block-scoping" "^7.21.0" + "@babel/plugin-transform-classes" "^7.21.0" + "@babel/plugin-transform-computed-properties" "^7.21.5" + "@babel/plugin-transform-destructuring" "^7.21.3" "@babel/plugin-transform-dotall-regex" "^7.18.6" "@babel/plugin-transform-duplicate-keys" "^7.18.9" "@babel/plugin-transform-exponentiation-operator" "^7.18.6" - "@babel/plugin-transform-for-of" "^7.18.8" + "@babel/plugin-transform-for-of" "^7.21.5" "@babel/plugin-transform-function-name" "^7.18.9" "@babel/plugin-transform-literals" "^7.18.9" "@babel/plugin-transform-member-expression-literals" "^7.18.6" - "@babel/plugin-transform-modules-amd" "^7.18.6" - "@babel/plugin-transform-modules-commonjs" "^7.18.6" - "@babel/plugin-transform-modules-systemjs" "^7.19.0" + "@babel/plugin-transform-modules-amd" "^7.20.11" + "@babel/plugin-transform-modules-commonjs" "^7.21.5" + "@babel/plugin-transform-modules-systemjs" "^7.20.11" "@babel/plugin-transform-modules-umd" "^7.18.6" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.19.1" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.20.5" "@babel/plugin-transform-new-target" "^7.18.6" "@babel/plugin-transform-object-super" "^7.18.6" - "@babel/plugin-transform-parameters" "^7.18.8" + "@babel/plugin-transform-parameters" "^7.21.3" "@babel/plugin-transform-property-literals" "^7.18.6" - "@babel/plugin-transform-regenerator" "^7.18.6" + "@babel/plugin-transform-regenerator" "^7.21.5" "@babel/plugin-transform-reserved-words" "^7.18.6" "@babel/plugin-transform-shorthand-properties" "^7.18.6" - "@babel/plugin-transform-spread" "^7.19.0" + "@babel/plugin-transform-spread" "^7.20.7" "@babel/plugin-transform-sticky-regex" "^7.18.6" "@babel/plugin-transform-template-literals" "^7.18.9" "@babel/plugin-transform-typeof-symbol" "^7.18.9" - "@babel/plugin-transform-unicode-escapes" "^7.18.10" + "@babel/plugin-transform-unicode-escapes" "^7.21.5" "@babel/plugin-transform-unicode-regex" "^7.18.6" "@babel/preset-modules" "^0.1.5" - "@babel/types" "^7.19.3" + "@babel/types" "^7.21.5" babel-plugin-polyfill-corejs2 "^0.3.3" babel-plugin-polyfill-corejs3 "^0.6.0" babel-plugin-polyfill-regenerator "^0.4.1" @@ -1170,6 +1218,11 @@ "@babel/helper-validator-option" "^7.18.6" "@babel/plugin-transform-typescript" "^7.18.6" +"@babel/regjsgen@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" + integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== + "@babel/runtime-corejs3@^7.18.6": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.18.9.tgz#7bacecd1cb2dd694eacd32a91fcf7021c20770ae" @@ -1178,57 +1231,47 @@ core-js-pure "^3.20.2" regenerator-runtime "^0.13.4" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.3", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.8.4": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673" - integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw== +"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.8", "@babel/runtime@^7.18.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.22.6", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.6.tgz#57d64b9ae3cff1d67eb067ae117dac087f5bd438" + integrity sha512-wDb5pWm4WDdF6LFUde3Jl8WzPA+3ZbxYqkC6xAXuD3irdEHN1k0NfTRrJD8ZD378SJ61miMLCqIOXYhd8x+AJQ== dependencies: regenerator-runtime "^0.13.11" -"@babel/template@^7.12.7", "@babel/template@^7.18.6", "@babel/template@^7.20.7", "@babel/template@^7.3.3": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8" - integrity sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/parser" "^7.20.7" - "@babel/types" "^7.20.7" - -"@babel/traverse@^7.12.9", "@babel/traverse@^7.18.8", "@babel/traverse@^7.18.9", "@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.21.3", "@babel/traverse@^7.7.2": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.3.tgz#4747c5e7903d224be71f90788b06798331896f67" - integrity sha512-XLyopNeaTancVitYZe2MlUEvgKb6YVVPXzofHgqHijCImG33b/uTurMS488ht/Hbsb2XK3U2BnSTxKVNGV3nGQ== - dependencies: - "@babel/code-frame" "^7.18.6" - "@babel/generator" "^7.21.3" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.21.0" - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-split-export-declaration" "^7.18.6" - "@babel/parser" "^7.21.3" - "@babel/types" "^7.21.3" +"@babel/template@^7.12.7", "@babel/template@^7.18.6", "@babel/template@^7.20.7", "@babel/template@^7.22.5", "@babel/template@^7.3.3": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.5.tgz#0c8c4d944509875849bd0344ff0050756eefc6ec" + integrity sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw== + dependencies: + "@babel/code-frame" "^7.22.5" + "@babel/parser" "^7.22.5" + "@babel/types" "^7.22.5" + +"@babel/traverse@^7.12.9", "@babel/traverse@^7.16.0", "@babel/traverse@^7.18.8", "@babel/traverse@^7.18.9", "@babel/traverse@^7.21.5", "@babel/traverse@^7.22.6", "@babel/traverse@^7.22.8": + version "7.22.8" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.8.tgz#4d4451d31bc34efeae01eac222b514a77aa4000e" + integrity sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw== + dependencies: + "@babel/code-frame" "^7.22.5" + "@babel/generator" "^7.22.7" + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-function-name" "^7.22.5" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.22.7" + "@babel/types" "^7.22.5" debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.7", "@babel/types@^7.15.6", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.19.3", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.21.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.21.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.3.tgz#4865a5357ce40f64e3400b0f3b737dc6d4f64d05" - integrity sha512-sBGdETxC+/M4o/zKC0sl6sjWv62WFR/uzxrJ6uYyMLZOUlPnwzw0tKgVHOXxaAd5l2g8pEDM5RZ495GPQI77kg== +"@babel/types@^7.0.0", "@babel/types@^7.12.7", "@babel/types@^7.15.6", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.20.0", "@babel/types@^7.20.7", "@babel/types@^7.21.5", "@babel/types@^7.22.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.22.5.tgz#cd93eeaab025880a3a47ec881f4b096a5b786fbe" + integrity sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA== dependencies: - "@babel/helper-string-parser" "^7.19.4" - "@babel/helper-validator-identifier" "^7.19.1" + "@babel/helper-string-parser" "^7.22.5" + "@babel/helper-validator-identifier" "^7.22.5" to-fast-properties "^2.0.0" -"@bcherny/json-schema-ref-parser@10.0.5-fork": - version "10.0.5-fork" - resolved "https://registry.yarnpkg.com/@bcherny/json-schema-ref-parser/-/json-schema-ref-parser-10.0.5-fork.tgz#9b5e1e7e07964ea61840174098e634edbe8197bc" - integrity sha512-E/jKbPoca1tfUPj3iSbitDZTGnq6FUFjkH6L8U2oDwSuwK1WhnnVtCG7oFOTg/DDnyoXbQYUiUiGOibHqaGVnw== - dependencies: - "@jsdevtools/ono" "^7.1.3" - "@types/json-schema" "^7.0.6" - call-me-maybe "^1.0.1" - js-yaml "^4.1.0" - "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1239,10 +1282,10 @@ resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== -"@cspell/cspell-bundled-dicts@6.30.2": - version "6.30.2" - resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-6.30.2.tgz#cfab603ac339b72ba4fc8535ab9a5f5153d3019d" - integrity sha512-M6Y7FKF6UVvCVS5QoMHZ9EeAaA1NUNHqp5hI+KWT8T0dbJnvSzYGuIMi6fMclip4uZeXMtVFiobJET8PacvzvA== +"@cspell/cspell-bundled-dicts@6.31.1": + version "6.31.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-6.31.1.tgz#69bacbdcceae490b50d2573877f004328416d6e8" + integrity sha512-rsIev+dk1Vd8H1OKZhNhXycIVsMfeWJaeW3QUi1l4oIoGwQfJVbs1ZPZPHE5cglzyHOW1jQNStXf34UKaC6siA== dependencies: "@cspell/dict-ada" "^4.0.1" "@cspell/dict-aws" "^3.0.0" @@ -1259,10 +1302,10 @@ "@cspell/dict-elixir" "^4.0.2" "@cspell/dict-en-common-misspellings" "^1.0.2" "@cspell/dict-en-gb" "1.1.33" - "@cspell/dict-en_us" "^4.3.1" + "@cspell/dict-en_us" "^4.3.2" "@cspell/dict-filetypes" "^3.0.0" "@cspell/dict-fonts" "^3.0.1" - "@cspell/dict-fullstack" "^3.1.4" + "@cspell/dict-fullstack" "^3.1.5" "@cspell/dict-gaming-terms" "^1.0.4" "@cspell/dict-git" "^2.0.0" "@cspell/dict-golang" "^6.0.1" @@ -1284,27 +1327,27 @@ "@cspell/dict-ruby" "^5.0.0" "@cspell/dict-rust" "^4.0.1" "@cspell/dict-scala" "^5.0.0" - "@cspell/dict-software-terms" "^3.1.5" + "@cspell/dict-software-terms" "^3.1.6" "@cspell/dict-sql" "^2.1.0" "@cspell/dict-svelte" "^1.0.2" "@cspell/dict-swift" "^2.0.1" "@cspell/dict-typescript" "^3.1.1" "@cspell/dict-vue" "^3.0.0" -"@cspell/cspell-pipe@6.30.2": - version "6.30.2" - resolved "https://registry.yarnpkg.com/@cspell/cspell-pipe/-/cspell-pipe-6.30.2.tgz#27176c0cbfe90b95b40eea786910473e7d932c4e" - integrity sha512-iPmlAM0qJetiMBY76kz4FpT41xL9wLjXfVP3Zb1xpSPxi38ElpJmJIOxSjyzagOnk4w1JQtdm3jGx3QFhgrKIA== +"@cspell/cspell-pipe@6.31.1": + version "6.31.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-pipe/-/cspell-pipe-6.31.1.tgz#6c8edc92039125695a894186a899290d56d0f2c7" + integrity sha512-zk1olZi4dr6GLm5PAjvsiZ01HURNSruUYFl1qSicGnTwYN8GaN4RhAwannAytcJ7zJPIcyXlid0YsB58nJf3wQ== -"@cspell/cspell-service-bus@6.30.2": - version "6.30.2" - resolved "https://registry.yarnpkg.com/@cspell/cspell-service-bus/-/cspell-service-bus-6.30.2.tgz#fc93e2b89a3547f762377a4a6aa2343cf7e77525" - integrity sha512-UxXLM1ViwM14MiJ/qfhfy8VNjieN02/kRdsUNBTVzWzitIzyU4q8Xa56/oH8iBCCEcruk0ft4uJe7mWW+Viq3A== +"@cspell/cspell-service-bus@6.31.1": + version "6.31.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-service-bus/-/cspell-service-bus-6.31.1.tgz#ede5859e180f8d9be760df500e02164dae0084fe" + integrity sha512-YyBicmJyZ1uwKVxujXw7sgs9x+Eps43OkWmCtDZmZlnq489HdTSuhF1kTbVi2yeFSeaXIS87+uHo12z97KkQpg== -"@cspell/cspell-types@6.30.2": - version "6.30.2" - resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-6.30.2.tgz#baf5fc33bae8e6e445bda9c6cb4f699ecc7e69de" - integrity sha512-UDnnR4hslBv2SIUlkHNnnX/VbSUBqeWRdM36lISDO5oLJV88g3sRLSSVJB6E9bhtfAXyxTdVio4C23NWf98Rng== +"@cspell/cspell-types@6.31.1": + version "6.31.1" + resolved "https://registry.yarnpkg.com/@cspell/cspell-types/-/cspell-types-6.31.1.tgz#b3737ef7743c0e5803d57e667f816418ac8da1cf" + integrity sha512-1KeTQFiHMssW1eRoF2NZIEg4gPVIfXLsL2+VSD/AV6YN7lBcuf6gRRgV5KWYarhxtEfjxhDdDTmu26l/iJEUtw== "@cspell/dict-ada@^4.0.1": version "4.0.1" @@ -1381,10 +1424,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-en-gb/-/dict-en-gb-1.1.33.tgz#7f1fd90fc364a5cb77111b5438fc9fcf9cc6da0e" integrity sha512-tKSSUf9BJEV+GJQAYGw5e+ouhEe2ZXE620S7BLKe3ZmpnjlNG9JqlnaBhkIMxKnNFkLY2BP/EARzw31AZnOv4g== -"@cspell/dict-en_us@^4.3.1": - version "4.3.1" - resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-4.3.1.tgz#88ae0fb555897ed77810867b849cc3495298f362" - integrity sha512-akfx/Q+4J3rfawtGaqe1Yp+fNyCGJCKmTQT14LXxGLN7DEjGvOFzlYoS+DdD3aDwAJih79bEFGiG+Lqs0zOauA== +"@cspell/dict-en_us@^4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@cspell/dict-en_us/-/dict-en_us-4.3.2.tgz#ffe6e9a4decc453a0673f8e9a49a3a53ee020d2d" + integrity sha512-o8xtHDLPNzW6hK5b1TaDTWt25vVi9lWlL6/dZ9YoS+ZMj+Dy/yuXatqfOgeGyU3a9+2gxC0kbr4oufMUQXI2mQ== "@cspell/dict-filetypes@^3.0.0": version "3.0.0" @@ -1396,10 +1439,10 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-fonts/-/dict-fonts-3.0.1.tgz#0e0b875d463a9bd65e78145c9b6649ecad017df5" integrity sha512-o2zVFKT3KcIBo88xlWhG4yOD0XQDjP7guc7C30ZZcSN8YCwaNc1nGoxU3QRea8iKcwk3cXH0G53nrQur7g9DjQ== -"@cspell/dict-fullstack@^3.1.4": - version "3.1.4" - resolved "https://registry.yarnpkg.com/@cspell/dict-fullstack/-/dict-fullstack-3.1.4.tgz#930a66a1397f463c807e54dd01b0c79ec3f7fc21" - integrity sha512-OnCIn3GgAhdhsU6xMYes7/WXnbV6R/5k/zRAu/d+WZP4Ltf48z7oFfNFjHXH6b8ZwnMhpekLAnCeIfT5dcxRqw== +"@cspell/dict-fullstack@^3.1.5": + version "3.1.5" + resolved "https://registry.yarnpkg.com/@cspell/dict-fullstack/-/dict-fullstack-3.1.5.tgz#35d18678161f214575cc613dd95564e05422a19c" + integrity sha512-6ppvo1dkXUZ3fbYn/wwzERxCa76RtDDl5Afzv2lijLoijGGUw5yYdLBKJnx8PJBGNLh829X352ftE7BElG4leA== "@cspell/dict-gaming-terms@^1.0.4": version "1.0.4" @@ -1506,7 +1549,7 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-scala/-/dict-scala-5.0.0.tgz#b64365ad559110a36d44ccd90edf7151ea648022" integrity sha512-ph0twaRoV+ylui022clEO1dZ35QbeEQaKTaV2sPOsdwIokABPIiK09oWwGK9qg7jRGQwVaRPEq0Vp+IG1GpqSQ== -"@cspell/dict-software-terms@^3.1.5": +"@cspell/dict-software-terms@^3.1.6": version "3.1.6" resolved "https://registry.yarnpkg.com/@cspell/dict-software-terms/-/dict-software-terms-3.1.6.tgz#27a6fd2919e7118bb793e541960ea1eeed6d0b3c" integrity sha512-w46+pIMRVtrDuTZXK/YxDP5NL5yVoX0ImEPO0s9WbxdyyfhzAF3sGYHBGN/50OGLHExcqe6Idb9feoRC9mCLxw== @@ -1536,17 +1579,17 @@ resolved "https://registry.yarnpkg.com/@cspell/dict-vue/-/dict-vue-3.0.0.tgz#68ccb432ad93fcb0fd665352d075ae9a64ea9250" integrity sha512-niiEMPWPV9IeRBRzZ0TBZmNnkK3olkOPYxC1Ny2AX4TGlYRajcW0WUtoSHmvvjZNfWLSg2L6ruiBeuPSbjnG6A== -"@cspell/dynamic-import@6.30.2": - version "6.30.2" - resolved "https://registry.yarnpkg.com/@cspell/dynamic-import/-/dynamic-import-6.30.2.tgz#6a3ccb98e5b4a8ba18d863831188a6217f4dba7e" - integrity sha512-q6oWWJx9SZMc0NXz2bPReBWqN8ZlEZovLDrC2fznMWenD+YflY9gqcc3Hl3Ebw+RujOVAETc/YUpWn1TTxKgzw== +"@cspell/dynamic-import@6.31.1": + version "6.31.1" + resolved "https://registry.yarnpkg.com/@cspell/dynamic-import/-/dynamic-import-6.31.1.tgz#26e218362e98158be5c88f970ce774458e53dd60" + integrity sha512-uliIUv9uZlnyYmjUlcw/Dm3p0xJOEnWJNczHAfqAl4Ytg6QZktw0GtUA9b1umbRXLv0KRTPtSC6nMq3cR7rRmQ== dependencies: import-meta-resolve "^2.2.2" -"@cspell/strong-weak-map@6.30.2": - version "6.30.2" - resolved "https://registry.yarnpkg.com/@cspell/strong-weak-map/-/strong-weak-map-6.30.2.tgz#766da6a63134015a4888d75a93a9e61390da47a7" - integrity sha512-ON7lhyER4jAanAjt1LOQxmwBYRKYBaAtpyQGV8eHzYl5pmf6HHevDSmd65HtFcM0Zq4MnQyk+W7qjd3BF6lMYw== +"@cspell/strong-weak-map@6.31.1": + version "6.31.1" + resolved "https://registry.yarnpkg.com/@cspell/strong-weak-map/-/strong-weak-map-6.31.1.tgz#370faeae5ecb0c9a55344a34cd70f1690c62de01" + integrity sha512-z8AuWvUuSnugFKJOA9Ke0aiFuehcqLFqia9bk8XaQNEWr44ahPVn3sEWnAncTxPbpWuUw5UajoJa0egRAE1CCg== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" @@ -1560,6 +1603,33 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@csstools/css-parser-algorithms@^2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@csstools/css-parser-algorithms/-/css-parser-algorithms-2.3.0.tgz#0cc3a656dc2d638370ecf6f98358973bfbd00141" + integrity sha512-dTKSIHHWc0zPvcS5cqGP+/TPFUJB0ekJ9dGKvMAFoNuBFhDPBt9OMGNZiIA5vTiNdGHHBeScYPXIGBMnVOahsA== + +"@csstools/css-tokenizer@^2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@csstools/css-tokenizer/-/css-tokenizer-2.1.1.tgz#07ae11a0a06365d7ec686549db7b729bc036528e" + integrity sha512-GbrTj2Z8MCTUv+52GE0RbFGM527xuXZ0Xa5g0Z+YN573uveS4G0qi6WNOMyz3yrFM/jaILTTwJ0+umx81EzqfA== + +"@csstools/media-query-list-parser@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@csstools/media-query-list-parser/-/media-query-list-parser-2.1.2.tgz#6ef642b728d30c1009bfbba3211c7e4c11302728" + integrity sha512-M8cFGGwl866o6++vIY7j1AKuq9v57cf+dGepScwCcbut9ypJNr4Cj+LLTWligYUZ0uyhEoJDKt5lvyBfh2L3ZQ== + +"@csstools/selector-specificity@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-3.0.0.tgz#798622546b63847e82389e473fd67f2707d82247" + integrity sha512-hBI9tfBtuPIi885ZsZ32IMEU/5nlZH/KOVYJCOh7gyMxaVLGmLedYqFN6Ui1LXkI8JlC8IsuC0rF0btcRZKd5g== + "@docsearch/css@3.1.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@docsearch/css/-/css-3.1.1.tgz#e0976bf995e383f8ee8657306311b9cb95016330" @@ -1575,10 +1645,10 @@ "@docsearch/css" "3.1.1" algoliasearch "^4.0.0" -"@docusaurus/core@2.2.0", "@docusaurus/core@~2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-2.2.0.tgz#64c9ee31502c23b93c869f8188f73afaf5fd4867" - integrity sha512-Vd6XOluKQqzG12fEs9prJgDtyn6DPok9vmUWDR2E6/nV5Fl9SVkhEQOBxwObjk3kQh7OY7vguFaLh0jqdApWsA== +"@docusaurus/core@2.4.1", "@docusaurus/core@~2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-2.4.1.tgz#4b8ff5766131ce3fbccaad0b1daf2ad4dc76f62d" + integrity sha512-SNsY7PshK3Ri7vtsLXVeAJGS50nJN3RgF836zkyUfAD01Fq+sAk5EwWgLw+nnm5KVNGDu7PRR2kRGDsWvqpo0g== dependencies: "@babel/core" "^7.18.6" "@babel/generator" "^7.18.7" @@ -1590,13 +1660,13 @@ "@babel/runtime" "^7.18.6" "@babel/runtime-corejs3" "^7.18.6" "@babel/traverse" "^7.18.8" - "@docusaurus/cssnano-preset" "2.2.0" - "@docusaurus/logger" "2.2.0" - "@docusaurus/mdx-loader" "2.2.0" + "@docusaurus/cssnano-preset" "2.4.1" + "@docusaurus/logger" "2.4.1" + "@docusaurus/mdx-loader" "2.4.1" "@docusaurus/react-loadable" "5.5.2" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-common" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-common" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" "@slorber/static-site-generator-webpack-plugin" "^4.0.7" "@svgr/webpack" "^6.2.1" autoprefixer "^10.4.7" @@ -1617,7 +1687,7 @@ del "^6.1.1" detect-port "^1.3.0" escape-html "^1.0.3" - eta "^1.12.3" + eta "^2.0.0" file-loader "^6.2.0" fs-extra "^10.1.0" html-minifier-terser "^6.1.0" @@ -1652,33 +1722,33 @@ webpack-merge "^5.8.0" webpackbar "^5.0.2" -"@docusaurus/cssnano-preset@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-2.2.0.tgz#fc05044659051ae74ab4482afcf4a9936e81d523" - integrity sha512-mAAwCo4n66TMWBH1kXnHVZsakW9VAXJzTO4yZukuL3ro4F+JtkMwKfh42EG75K/J/YIFQG5I/Bzy0UH/hFxaTg== +"@docusaurus/cssnano-preset@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/cssnano-preset/-/cssnano-preset-2.4.1.tgz#eacadefb1e2e0f59df3467a0fe83e4ff79eed163" + integrity sha512-ka+vqXwtcW1NbXxWsh6yA1Ckii1klY9E53cJ4O9J09nkMBgrNX3iEFED1fWdv8wf4mJjvGi5RLZ2p9hJNjsLyQ== dependencies: cssnano-preset-advanced "^5.3.8" postcss "^8.4.14" postcss-sort-media-queries "^4.2.1" tslib "^2.4.0" -"@docusaurus/logger@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-2.2.0.tgz#ea2f7feda7b8675485933b87f06d9c976d17423f" - integrity sha512-DF3j1cA5y2nNsu/vk8AG7xwpZu6f5MKkPPMaaIbgXLnWGfm6+wkOeW7kNrxnM95YOhKUkJUophX69nGUnLsm0A== +"@docusaurus/logger@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/logger/-/logger-2.4.1.tgz#4d2c0626b40752641f9fdd93ad9b5a7a0792f767" + integrity sha512-5h5ysIIWYIDHyTVd8BjheZmQZmEgWDR54aQ1BX9pjFfpyzFo5puKXKYrYJXbjEHGyVhEzmB9UXwbxGfaZhOjcg== dependencies: chalk "^4.1.2" tslib "^2.4.0" -"@docusaurus/mdx-loader@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-2.2.0.tgz#fd558f429e5d9403d284bd4214e54d9768b041a0" - integrity sha512-X2bzo3T0jW0VhUU+XdQofcEeozXOTmKQMvc8tUnWRdTnCvj4XEcBVdC3g+/jftceluiwSTNRAX4VBOJdNt18jA== +"@docusaurus/mdx-loader@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/mdx-loader/-/mdx-loader-2.4.1.tgz#6425075d7fc136dbfdc121349060cedd64118393" + integrity sha512-4KhUhEavteIAmbBj7LVFnrVYDiU51H5YWW1zY6SmBSte/YLhDutztLTBE0PQl1Grux1jzUJeaSvAzHpTn6JJDQ== dependencies: "@babel/parser" "^7.18.8" "@babel/traverse" "^7.18.8" - "@docusaurus/logger" "2.2.0" - "@docusaurus/utils" "2.2.0" + "@docusaurus/logger" "2.4.1" + "@docusaurus/utils" "2.4.1" "@mdx-js/mdx" "^1.6.22" escape-html "^1.0.3" file-loader "^6.2.0" @@ -1693,13 +1763,13 @@ url-loader "^4.1.1" webpack "^5.73.0" -"@docusaurus/module-type-aliases@2.2.0", "@docusaurus/module-type-aliases@~2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-2.2.0.tgz#1e23e54a1bbb6fde1961e4fa395b1b69f4803ba5" - integrity sha512-wDGW4IHKoOr9YuJgy7uYuKWrDrSpsUSDHLZnWQYM9fN7D5EpSmYHjFruUpKWVyxLpD/Wh0rW8hYZwdjJIQUQCQ== +"@docusaurus/module-type-aliases@2.4.1", "@docusaurus/module-type-aliases@~2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/module-type-aliases/-/module-type-aliases-2.4.1.tgz#38b3c2d2ae44bea6d57506eccd84280216f0171c" + integrity sha512-gLBuIFM8Dp2XOCWffUDSjtxY7jQgKvYujt7Mx5s4FCTfoL5dN1EVbnrn+O2Wvh8b0a77D57qoIDY7ghgmatR1A== dependencies: "@docusaurus/react-loadable" "5.5.2" - "@docusaurus/types" "2.2.0" + "@docusaurus/types" "2.4.1" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1707,18 +1777,18 @@ react-helmet-async "*" react-loadable "npm:@docusaurus/react-loadable@5.5.2" -"@docusaurus/plugin-content-blog@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.2.0.tgz#dc55982e76771f4e678ac10e26d10e1da2011dc1" - integrity sha512-0mWBinEh0a5J2+8ZJXJXbrCk1tSTNf7Nm4tYAl5h2/xx+PvH/Bnu0V+7mMljYm/1QlDYALNIIaT/JcoZQFUN3w== - dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/logger" "2.2.0" - "@docusaurus/mdx-loader" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-common" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" +"@docusaurus/plugin-content-blog@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-blog/-/plugin-content-blog-2.4.1.tgz#c705a8b1a36a34f181dcf43b7770532e4dcdc4a3" + integrity sha512-E2i7Knz5YIbE1XELI6RlTnZnGgS52cUO4BlCiCUCvQHbR+s1xeIWz4C6BtaVnlug0Ccz7nFSksfwDpVlkujg5Q== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/logger" "2.4.1" + "@docusaurus/mdx-loader" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-common" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" cheerio "^1.0.0-rc.12" feed "^4.2.2" fs-extra "^10.1.0" @@ -1729,18 +1799,18 @@ utility-types "^3.10.0" webpack "^5.73.0" -"@docusaurus/plugin-content-docs@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-2.2.0.tgz#0fcb85226fcdb80dc1e2d4a36ef442a650dcc84d" - integrity sha512-BOazBR0XjzsHE+2K1wpNxz5QZmrJgmm3+0Re0EVPYFGW8qndCWGNtXW/0lGKhecVPML8yyFeAmnUCIs7xM2wPw== - dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/logger" "2.2.0" - "@docusaurus/mdx-loader" "2.2.0" - "@docusaurus/module-type-aliases" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" +"@docusaurus/plugin-content-docs@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-docs/-/plugin-content-docs-2.4.1.tgz#ed94d9721b5ce7a956fb01cc06c40d8eee8dfca7" + integrity sha512-Lo7lSIcpswa2Kv4HEeUcGYqaasMUQNpjTXpV0N8G6jXgZaQurqp7E8NGYeGbDXnb48czmHWbzDL4S3+BbK0VzA== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/logger" "2.4.1" + "@docusaurus/mdx-loader" "2.4.1" + "@docusaurus/module-type-aliases" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" "@types/react-router-config" "^5.0.6" combine-promises "^1.1.0" fs-extra "^10.1.0" @@ -1751,65 +1821,75 @@ utility-types "^3.10.0" webpack "^5.73.0" -"@docusaurus/plugin-content-pages@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-2.2.0.tgz#e3f40408787bbe229545dd50595f87e1393bc3ae" - integrity sha512-+OTK3FQHk5WMvdelz8v19PbEbx+CNT6VSpx7nVOvMNs5yJCKvmqBJBQ2ZSxROxhVDYn+CZOlmyrC56NSXzHf6g== - dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/mdx-loader" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" +"@docusaurus/plugin-content-pages@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-content-pages/-/plugin-content-pages-2.4.1.tgz#c534f7e49967699a45bbe67050d1605ebbf3d285" + integrity sha512-/UjuH/76KLaUlL+o1OvyORynv6FURzjurSjvn2lbWTFc4tpYY2qLYTlKpTCBVPhlLUQsfyFnshEJDLmPneq2oA== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/mdx-loader" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" fs-extra "^10.1.0" tslib "^2.4.0" webpack "^5.73.0" -"@docusaurus/plugin-debug@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-2.2.0.tgz#b38741d2c492f405fee01ee0ef2e0029cedb689a" - integrity sha512-p9vOep8+7OVl6r/NREEYxf4HMAjV8JMYJ7Bos5fCFO0Wyi9AZEo0sCTliRd7R8+dlJXZEgcngSdxAUo/Q+CJow== +"@docusaurus/plugin-debug@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-debug/-/plugin-debug-2.4.1.tgz#461a2c77b0c5a91b2c05257c8f9585412aaa59dc" + integrity sha512-7Yu9UPzRShlrH/G8btOpR0e6INFZr0EegWplMjOqelIwAcx3PKyR8mgPTxGTxcqiYj6hxSCRN0D8R7YrzImwNA== dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" + "@docusaurus/core" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" fs-extra "^10.1.0" react-json-view "^1.21.3" tslib "^2.4.0" -"@docusaurus/plugin-google-analytics@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-2.2.0.tgz#63c7137eff5a1208d2059fea04b5207c037d7954" - integrity sha512-+eZVVxVeEnV5nVQJdey9ZsfyEVMls6VyWTIj8SmX0k5EbqGvnIfET+J2pYEuKQnDIHxy+syRMoRM6AHXdHYGIg== +"@docusaurus/plugin-google-analytics@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-analytics/-/plugin-google-analytics-2.4.1.tgz#30de1c35773bf9d52bb2d79b201b23eb98022613" + integrity sha512-dyZJdJiCoL+rcfnm0RPkLt/o732HvLiEwmtoNzOoz9MSZz117UH2J6U2vUDtzUzwtFLIf32KkeyzisbwUCgcaQ== dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" + "@docusaurus/core" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" tslib "^2.4.0" -"@docusaurus/plugin-google-gtag@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-2.2.0.tgz#7b086d169ac5fe9a88aca10ab0fd2bf00c6c6b12" - integrity sha512-6SOgczP/dYdkqUMGTRqgxAS1eTp6MnJDAQMy8VCF1QKbWZmlkx4agHDexihqmYyCujTYHqDAhm1hV26EET54NQ== +"@docusaurus/plugin-google-gtag@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-gtag/-/plugin-google-gtag-2.4.1.tgz#6a3eb91022714735e625c7ca70ef5188fa7bd0dc" + integrity sha512-mKIefK+2kGTQBYvloNEKtDmnRD7bxHLsBcxgnbt4oZwzi2nxCGjPX6+9SQO2KCN5HZbNrYmGo5GJfMgoRvy6uA== dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" + "@docusaurus/core" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" tslib "^2.4.0" -"@docusaurus/plugin-pwa@~2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-pwa/-/plugin-pwa-2.2.0.tgz#2aca00d268efbca8f3cf1c3e260b801e6f7f8af5" - integrity sha512-j1ldskYXkKYmWB6V1I0Lv2o9EUhSdGI6pCo0RFGaLijJKLlA9R+F5j+0kWvoyirXM7LRGknkXYYkc50i25R5Sw== +"@docusaurus/plugin-google-tag-manager@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-google-tag-manager/-/plugin-google-tag-manager-2.4.1.tgz#b99f71aec00b112bbf509ef2416e404a95eb607e" + integrity sha512-Zg4Ii9CMOLfpeV2nG74lVTWNtisFaH9QNtEw48R5QE1KIwDBdTVaiSA18G1EujZjrzJJzXN79VhINSbOJO/r3g== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" + tslib "^2.4.0" + +"@docusaurus/plugin-pwa@~2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-pwa/-/plugin-pwa-2.4.1.tgz#648a3dbe8e80927390cb7c8477bbb2b1e98ade3b" + integrity sha512-kiD4qu5u3Nhwa6dPFrBDGInJYI/MWu01mbeLJFLk7oFqbkvLrHPKyB6KxrKQQfx/sAJKro79RYejigUDj0Ahig== dependencies: "@babel/core" "^7.18.6" "@babel/preset-env" "^7.18.6" - "@docusaurus/core" "2.2.0" - "@docusaurus/theme-common" "2.2.0" - "@docusaurus/theme-translations" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" + "@docusaurus/core" "2.4.1" + "@docusaurus/theme-common" "2.4.1" + "@docusaurus/theme-translations" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" babel-loader "^8.2.5" clsx "^1.2.1" core-js "^3.23.3" @@ -1821,38 +1901,39 @@ workbox-precaching "^6.5.3" workbox-window "^6.5.3" -"@docusaurus/plugin-sitemap@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-2.2.0.tgz#876da60937886032d63143253d420db6a4b34773" - integrity sha512-0jAmyRDN/aI265CbWZNZuQpFqiZuo+5otk2MylU9iVrz/4J7gSc+ZJ9cy4EHrEsW7PV8s1w18hIEsmcA1YgkKg== - dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/logger" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-common" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" +"@docusaurus/plugin-sitemap@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/plugin-sitemap/-/plugin-sitemap-2.4.1.tgz#8a7a76ed69dc3e6b4474b6abb10bb03336a9de6d" + integrity sha512-lZx+ijt/+atQ3FVE8FOHV/+X3kuok688OydDXrqKRJyXBJZKgGjA2Qa8RjQ4f27V2woaXhtnyrdPop/+OjVMRg== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/logger" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-common" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" fs-extra "^10.1.0" sitemap "^7.1.1" tslib "^2.4.0" -"@docusaurus/preset-classic@~2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-2.2.0.tgz#bece5a043eeb74430f7c6c7510000b9c43669eb7" - integrity sha512-yKIWPGNx7BT8v2wjFIWvYrS+nvN04W+UameSFf8lEiJk6pss0kL6SG2MRvyULiI3BDxH+tj6qe02ncpSPGwumg== - dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/plugin-content-blog" "2.2.0" - "@docusaurus/plugin-content-docs" "2.2.0" - "@docusaurus/plugin-content-pages" "2.2.0" - "@docusaurus/plugin-debug" "2.2.0" - "@docusaurus/plugin-google-analytics" "2.2.0" - "@docusaurus/plugin-google-gtag" "2.2.0" - "@docusaurus/plugin-sitemap" "2.2.0" - "@docusaurus/theme-classic" "2.2.0" - "@docusaurus/theme-common" "2.2.0" - "@docusaurus/theme-search-algolia" "2.2.0" - "@docusaurus/types" "2.2.0" +"@docusaurus/preset-classic@~2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/preset-classic/-/preset-classic-2.4.1.tgz#072f22d0332588e9c5f512d4bded8d7c99f91497" + integrity sha512-P4//+I4zDqQJ+UDgoFrjIFaQ1MeS9UD1cvxVQaI6O7iBmiHQm0MGROP1TbE7HlxlDPXFJjZUK3x3cAoK63smGQ== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/plugin-content-blog" "2.4.1" + "@docusaurus/plugin-content-docs" "2.4.1" + "@docusaurus/plugin-content-pages" "2.4.1" + "@docusaurus/plugin-debug" "2.4.1" + "@docusaurus/plugin-google-analytics" "2.4.1" + "@docusaurus/plugin-google-gtag" "2.4.1" + "@docusaurus/plugin-google-tag-manager" "2.4.1" + "@docusaurus/plugin-sitemap" "2.4.1" + "@docusaurus/theme-classic" "2.4.1" + "@docusaurus/theme-common" "2.4.1" + "@docusaurus/theme-search-algolia" "2.4.1" + "@docusaurus/types" "2.4.1" "@docusaurus/react-loadable@5.5.2", "react-loadable@npm:@docusaurus/react-loadable@5.5.2": version "5.5.2" @@ -1862,36 +1943,36 @@ "@types/react" "*" prop-types "^15.6.2" -"@docusaurus/remark-plugin-npm2yarn@~2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/remark-plugin-npm2yarn/-/remark-plugin-npm2yarn-2.2.0.tgz#12d433eda8986c475277dd7fb8624b10c8a976ea" - integrity sha512-CFiwzk+0QrlBjkcx4cNV8LQZHgo15aQ3piO0Iao0vGXLc7eupGigDLuE7q3Phc10ELweO+P2gRQTjlBqIQTC+Q== +"@docusaurus/remark-plugin-npm2yarn@~2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/remark-plugin-npm2yarn/-/remark-plugin-npm2yarn-2.4.1.tgz#c67f5bc97cc6a4adee5eec0f3e97238b674b844b" + integrity sha512-RTX4hGCrwibqjDVf6edWVNwdvWHjx+YmfKwxqXxfhNnYjypTCXWTAyKeIfCUW2DNdtqAI2ZM0zFhB1maua2JbQ== dependencies: - npm-to-yarn "^1.0.1" - tslib "^2.4.0" + npm-to-yarn "^2.0.0" + tslib "^2.4.1" unist-util-visit "^2.0.3" -"@docusaurus/theme-classic@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-2.2.0.tgz#a048bb1bc077dee74b28bec25f4b84b481863742" - integrity sha512-kjbg/qJPwZ6H1CU/i9d4l/LcFgnuzeiGgMQlt6yPqKo0SOJIBMPuz7Rnu3r/WWbZFPi//o8acclacOzmXdUUEg== - dependencies: - "@docusaurus/core" "2.2.0" - "@docusaurus/mdx-loader" "2.2.0" - "@docusaurus/module-type-aliases" "2.2.0" - "@docusaurus/plugin-content-blog" "2.2.0" - "@docusaurus/plugin-content-docs" "2.2.0" - "@docusaurus/plugin-content-pages" "2.2.0" - "@docusaurus/theme-common" "2.2.0" - "@docusaurus/theme-translations" "2.2.0" - "@docusaurus/types" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-common" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" +"@docusaurus/theme-classic@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-2.4.1.tgz#0060cb263c1a73a33ac33f79bb6bc2a12a56ad9e" + integrity sha512-Rz0wKUa+LTW1PLXmwnf8mn85EBzaGSt6qamqtmnh9Hflkc+EqiYMhtUJeLdV+wsgYq4aG0ANc+bpUDpsUhdnwg== + dependencies: + "@docusaurus/core" "2.4.1" + "@docusaurus/mdx-loader" "2.4.1" + "@docusaurus/module-type-aliases" "2.4.1" + "@docusaurus/plugin-content-blog" "2.4.1" + "@docusaurus/plugin-content-docs" "2.4.1" + "@docusaurus/plugin-content-pages" "2.4.1" + "@docusaurus/theme-common" "2.4.1" + "@docusaurus/theme-translations" "2.4.1" + "@docusaurus/types" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-common" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" "@mdx-js/react" "^1.6.22" clsx "^1.2.1" copy-text-to-clipboard "^3.0.1" - infima "0.2.0-alpha.42" + infima "0.2.0-alpha.43" lodash "^4.17.21" nprogress "^0.2.0" postcss "^8.4.14" @@ -1902,17 +1983,18 @@ tslib "^2.4.0" utility-types "^3.10.0" -"@docusaurus/theme-common@2.2.0", "@docusaurus/theme-common@~2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-2.2.0.tgz#2303498d80448aafdd588b597ce9d6f4cfa930e4" - integrity sha512-R8BnDjYoN90DCL75gP7qYQfSjyitXuP9TdzgsKDmSFPNyrdE3twtPNa2dIN+h+p/pr+PagfxwWbd6dn722A1Dw== - dependencies: - "@docusaurus/mdx-loader" "2.2.0" - "@docusaurus/module-type-aliases" "2.2.0" - "@docusaurus/plugin-content-blog" "2.2.0" - "@docusaurus/plugin-content-docs" "2.2.0" - "@docusaurus/plugin-content-pages" "2.2.0" - "@docusaurus/utils" "2.2.0" +"@docusaurus/theme-common@2.4.1", "@docusaurus/theme-common@~2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-common/-/theme-common-2.4.1.tgz#03e16f7aa96455e952f3243ac99757b01a3c83d4" + integrity sha512-G7Zau1W5rQTaFFB3x3soQoZpkgMbl/SYNG8PfMFIjKa3M3q8n0m/GRf5/H/e5BqOvt8c+ZWIXGCiz+kUCSHovA== + dependencies: + "@docusaurus/mdx-loader" "2.4.1" + "@docusaurus/module-type-aliases" "2.4.1" + "@docusaurus/plugin-content-blog" "2.4.1" + "@docusaurus/plugin-content-docs" "2.4.1" + "@docusaurus/plugin-content-pages" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-common" "2.4.1" "@types/history" "^4.7.11" "@types/react" "*" "@types/react-router-config" "*" @@ -1920,42 +2002,43 @@ parse-numeric-range "^1.3.0" prism-react-renderer "^1.3.5" tslib "^2.4.0" + use-sync-external-store "^1.2.0" utility-types "^3.10.0" -"@docusaurus/theme-search-algolia@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-2.2.0.tgz#77fd9f7a600917e6024fe3ac7fb6cfdf2ce84737" - integrity sha512-2h38B0tqlxgR2FZ9LpAkGrpDWVdXZ7vltfmTdX+4RsDs3A7khiNsmZB+x/x6sA4+G2V2CvrsPMlsYBy5X+cY1w== +"@docusaurus/theme-search-algolia@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-search-algolia/-/theme-search-algolia-2.4.1.tgz#906bd2cca3fced0241985ef502c892f58ff380fc" + integrity sha512-6BcqW2lnLhZCXuMAvPRezFs1DpmEKzXFKlYjruuas+Xy3AQeFzDJKTJFIm49N77WFCTyxff8d3E4Q9pi/+5McQ== dependencies: "@docsearch/react" "^3.1.1" - "@docusaurus/core" "2.2.0" - "@docusaurus/logger" "2.2.0" - "@docusaurus/plugin-content-docs" "2.2.0" - "@docusaurus/theme-common" "2.2.0" - "@docusaurus/theme-translations" "2.2.0" - "@docusaurus/utils" "2.2.0" - "@docusaurus/utils-validation" "2.2.0" + "@docusaurus/core" "2.4.1" + "@docusaurus/logger" "2.4.1" + "@docusaurus/plugin-content-docs" "2.4.1" + "@docusaurus/theme-common" "2.4.1" + "@docusaurus/theme-translations" "2.4.1" + "@docusaurus/utils" "2.4.1" + "@docusaurus/utils-validation" "2.4.1" algoliasearch "^4.13.1" algoliasearch-helper "^3.10.0" clsx "^1.2.1" - eta "^1.12.3" + eta "^2.0.0" fs-extra "^10.1.0" lodash "^4.17.21" tslib "^2.4.0" utility-types "^3.10.0" -"@docusaurus/theme-translations@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-2.2.0.tgz#5fbd4693679806f80c26eeae1381e1f2c23d83e7" - integrity sha512-3T140AG11OjJrtKlY4pMZ5BzbGRDjNs2co5hJ6uYJG1bVWlhcaFGqkaZ5lCgKflaNHD7UHBHU9Ec5f69jTdd6w== +"@docusaurus/theme-translations@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/theme-translations/-/theme-translations-2.4.1.tgz#4d49df5865dae9ef4b98a19284ede62ae6f98726" + integrity sha512-T1RAGP+f86CA1kfE8ejZ3T3pUU3XcyvrGMfC/zxCtc2BsnoexuNI9Vk2CmuKCb+Tacvhxjv5unhxXce0+NKyvA== dependencies: fs-extra "^10.1.0" tslib "^2.4.0" -"@docusaurus/types@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-2.2.0.tgz#02c577a4041ab7d058a3c214ccb13647e21a9857" - integrity sha512-b6xxyoexfbRNRI8gjblzVOnLr4peCJhGbYGPpJ3LFqpi5nsFfoK4mmDLvWdeah0B7gmJeXabN7nQkFoqeSdmOw== +"@docusaurus/types@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/types/-/types-2.4.1.tgz#d8e82f9e0f704984f98df1f93d6b4554d5458705" + integrity sha512-0R+cbhpMkhbRXX138UOc/2XZFF8hiZa6ooZAEEJFp5scytzCw4tC1gChMFXrpa3d2tYE6AX8IrOEpSonLmfQuQ== dependencies: "@types/history" "^4.7.11" "@types/react" "*" @@ -1966,31 +2049,32 @@ webpack "^5.73.0" webpack-merge "^5.8.0" -"@docusaurus/utils-common@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-2.2.0.tgz#a401c1b93a8697dd566baf6ac64f0fdff1641a78" - integrity sha512-qebnerHp+cyovdUseDQyYFvMW1n1nv61zGe5JJfoNQUnjKuApch3IVsz+/lZ9a38pId8kqehC1Ao2bW/s0ntDA== +"@docusaurus/utils-common@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-common/-/utils-common-2.4.1.tgz#7f72e873e49bd5179588869cc3ab7449a56aae63" + integrity sha512-bCVGdZU+z/qVcIiEQdyx0K13OC5mYwxhSuDUR95oFbKVuXYRrTVrwZIqQljuo1fyJvFTKHiL9L9skQOPokuFNQ== dependencies: tslib "^2.4.0" -"@docusaurus/utils-validation@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-2.2.0.tgz#04d4d103137ad0145883971d3aa497f4a1315f25" - integrity sha512-I1hcsG3yoCkasOL5qQAYAfnmVoLei7apugT6m4crQjmDGxq+UkiRrq55UqmDDyZlac/6ax/JC0p+usZ6W4nVyg== +"@docusaurus/utils-validation@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/utils-validation/-/utils-validation-2.4.1.tgz#19959856d4a886af0c5cfb357f4ef68b51151244" + integrity sha512-unII3hlJlDwZ3w8U+pMO3Lx3RhI4YEbY3YNsQj4yzrkZzlpqZOLuAiZK2JyULnD+TKbceKU0WyWkQXtYbLNDFA== dependencies: - "@docusaurus/logger" "2.2.0" - "@docusaurus/utils" "2.2.0" + "@docusaurus/logger" "2.4.1" + "@docusaurus/utils" "2.4.1" joi "^17.6.0" js-yaml "^4.1.0" tslib "^2.4.0" -"@docusaurus/utils@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-2.2.0.tgz#3d6f9b7a69168d5c92d371bf21c556a4f50d1da6" - integrity sha512-oNk3cjvx7Tt1Lgh/aeZAmFpGV2pDr5nHKrBVx6hTkzGhrnMuQqLt6UPlQjdYQ3QHXwyF/ZtZMO1D5Pfi0lu7SA== +"@docusaurus/utils@2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@docusaurus/utils/-/utils-2.4.1.tgz#9c5f76eae37b71f3819c1c1f0e26e6807c99a4fc" + integrity sha512-1lvEZdAQhKNht9aPXPoh69eeKnV0/62ROhQeFKKxmzd0zkcuE/Oc5Gpnt00y/f5bIsmOsYMY7Pqfm/5rteT5GA== dependencies: - "@docusaurus/logger" "2.2.0" + "@docusaurus/logger" "2.4.1" "@svgr/webpack" "^6.2.1" + escape-string-regexp "^4.0.0" file-loader "^6.2.0" fs-extra "^10.1.0" github-slugger "^1.4.0" @@ -2029,136 +2113,136 @@ "@esbuild-kit/core-utils" "^3.0.0" get-tsconfig "^4.4.0" -"@esbuild/android-arm64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.12.tgz#15a8e2b407d03989b899e325151dc2e96d19c620" - integrity sha512-WQ9p5oiXXYJ33F2EkE3r0FRDFVpEdcDiwNX3u7Xaibxfx6vQE0Sb8ytrfQsA5WO6kDn6mDfKLh6KrPBjvkk7xA== - -"@esbuild/android-arm@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.12.tgz#677a09297e1f4f37aba7b4fc4f31088b00484985" - integrity sha512-E/sgkvwoIfj4aMAPL2e35VnUJspzVYl7+M1B2cqeubdBhADV4uPon0KCc8p2G+LqSJ6i8ocYPCqY3A4GGq0zkQ== - -"@esbuild/android-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.12.tgz#b292729eef4e0060ae1941f6a021c4d2542a3521" - integrity sha512-m4OsaCr5gT+se25rFPHKQXARMyAehHTQAz4XX1Vk3d27VtqiX0ALMBPoXZsGaB6JYryCLfgGwUslMqTfqeLU0w== - -"@esbuild/darwin-arm64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.12.tgz#efa35318df931da05825894e1787b976d55adbe3" - integrity sha512-O3GCZghRIx+RAN0NDPhyyhRgwa19MoKlzGonIb5hgTj78krqp9XZbYCvFr9N1eUxg0ZQEpiiZ4QvsOQwBpP+lg== - -"@esbuild/darwin-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.12.tgz#e7b54bb3f6dc81aadfd0485cd1623c648157e64d" - integrity sha512-5D48jM3tW27h1qjaD9UNRuN+4v0zvksqZSPZqeSWggfMlsVdAhH3pwSfQIFJwcs9QJ9BRibPS4ViZgs3d2wsCA== - -"@esbuild/freebsd-arm64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.12.tgz#99a18a8579d6299c449566fe91d9b6a54cf2a591" - integrity sha512-OWvHzmLNTdF1erSvrfoEBGlN94IE6vCEaGEkEH29uo/VoONqPnoDFfShi41Ew+yKimx4vrmmAJEGNoyyP+OgOQ== - -"@esbuild/freebsd-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.12.tgz#0e090190fede307fb4022f671791a50dd5121abd" - integrity sha512-A0Xg5CZv8MU9xh4a+7NUpi5VHBKh1RaGJKqjxe4KG87X+mTjDE6ZvlJqpWoeJxgfXHT7IMP9tDFu7IZ03OtJAw== - -"@esbuild/linux-arm64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.12.tgz#7fe2a69f8a1a7153fa2b0f44aabcadb59475c7e0" - integrity sha512-cK3AjkEc+8v8YG02hYLQIQlOznW+v9N+OI9BAFuyqkfQFR+DnDLhEM5N8QRxAUz99cJTo1rLNXqRrvY15gbQUg== - -"@esbuild/linux-arm@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.12.tgz#b87c76ebf1fe03e01fd6bb5cfc2f3c5becd5ee93" - integrity sha512-WsHyJ7b7vzHdJ1fv67Yf++2dz3D726oO3QCu8iNYik4fb5YuuReOI9OtA+n7Mk0xyQivNTPbl181s+5oZ38gyA== - -"@esbuild/linux-ia32@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.12.tgz#9e9357090254524d32e6708883a47328f3037858" - integrity sha512-jdOBXJqcgHlah/nYHnj3Hrnl9l63RjtQ4vn9+bohjQPI2QafASB5MtHAoEv0JQHVb/xYQTFOeuHnNYE1zF7tYw== - -"@esbuild/linux-loong64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.12.tgz#9deb605f9e2c82f59412ddfefb4b6b96d54b5b5b" - integrity sha512-GTOEtj8h9qPKXCyiBBnHconSCV9LwFyx/gv3Phw0pa25qPYjVuuGZ4Dk14bGCfGX3qKF0+ceeQvwmtI+aYBbVA== - -"@esbuild/linux-mips64el@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.12.tgz#6ef170b974ddf5e6acdfa5b05f22b6e9dfd2b003" - integrity sha512-o8CIhfBwKcxmEENOH9RwmUejs5jFiNoDw7YgS0EJTF6kgPgcqLFjgoc5kDey5cMHRVCIWc6kK2ShUePOcc7RbA== - -"@esbuild/linux-ppc64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.12.tgz#1638d3d4acf1d34aaf37cf8908c2e1cefed16204" - integrity sha512-biMLH6NR/GR4z+ap0oJYb877LdBpGac8KfZoEnDiBKd7MD/xt8eaw1SFfYRUeMVx519kVkAOL2GExdFmYnZx3A== - -"@esbuild/linux-riscv64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.12.tgz#135b6e9270a8e2de2b9094bb21a287517df520ef" - integrity sha512-jkphYUiO38wZGeWlfIBMB72auOllNA2sLfiZPGDtOBb1ELN8lmqBrlMiucgL8awBw1zBXN69PmZM6g4yTX84TA== - -"@esbuild/linux-s390x@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.12.tgz#21e40830770c5d08368e300842bde382ce97d615" - integrity sha512-j3ucLdeY9HBcvODhCY4b+Ds3hWGO8t+SAidtmWu/ukfLLG/oYDMaA+dnugTVAg5fnUOGNbIYL9TOjhWgQB8W5g== - -"@esbuild/linux-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.12.tgz#76c1c199871d48e1aaa47a762fb9e0dca52e1f7a" - integrity sha512-uo5JL3cgaEGotaqSaJdRfFNSCUJOIliKLnDGWaVCgIKkHxwhYMm95pfMbWZ9l7GeW9kDg0tSxcy9NYdEtjwwmA== - -"@esbuild/netbsd-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.12.tgz#c7c3b3017a4b938c76c35f66af529baf62eac527" - integrity sha512-DNdoRg8JX+gGsbqt2gPgkgb00mqOgOO27KnrWZtdABl6yWTST30aibGJ6geBq3WM2TIeW6COs5AScnC7GwtGPg== - -"@esbuild/openbsd-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.12.tgz#05d04217d980e049001afdbeacbb58d31bb5cefb" - integrity sha512-aVsENlr7B64w8I1lhHShND5o8cW6sB9n9MUtLumFlPhG3elhNWtE7M1TFpj3m7lT3sKQUMkGFjTQBrvDDO1YWA== - -"@esbuild/sunos-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.12.tgz#cf3862521600e4eb6c440ec3bad31ed40fb87ef3" - integrity sha512-qbHGVQdKSwi0JQJuZznS4SyY27tYXYF0mrgthbxXrZI3AHKuRvU+Eqbg/F0rmLDpW/jkIZBlCO1XfHUBMNJ1pg== - -"@esbuild/win32-arm64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.12.tgz#43dd7fb5be77bf12a1550355ab2b123efd60868e" - integrity sha512-zsCp8Ql+96xXTVTmm6ffvoTSZSV2B/LzzkUXAY33F/76EajNw1m+jZ9zPfNJlJ3Rh4EzOszNDHsmG/fZOhtqDg== - -"@esbuild/win32-ia32@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.12.tgz#9940963d0bff4ea3035a84e2b4c6e41c5e6296eb" - integrity sha512-FfrFjR4id7wcFYOdqbDfDET3tjxCozUgbqdkOABsSFzoZGFC92UK7mg4JKRc/B3NNEf1s2WHxJ7VfTdVDPN3ng== - -"@esbuild/win32-x64@0.17.12": - version "0.17.12" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.12.tgz#3a11d13e9a5b0c05db88991b234d8baba1f96487" - integrity sha512-JOOxw49BVZx2/5tW3FqkdjSD/5gXYeVGPDcB0lvap0gLQshkh1Nyel1QazC+wNxus3xPlsYAgqU1BUmrmCvWtw== - -"@eslint-community/eslint-utils@^4.1.2", "@eslint-community/eslint-utils@^4.2.0": - version "4.3.0" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.3.0.tgz#a556790523a351b4e47e9d385f47265eaaf9780a" - integrity sha512-v3oplH6FYCULtFuCeqyuTd9D2WKO937Dxdq+GmHOLL72TTRriLxz2VLlNfkZRsvj6PKnOPAtuT6dwrs/pA5DvA== +"@esbuild/android-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" + integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== + +"@esbuild/android-arm@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" + integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== + +"@esbuild/android-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" + integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== + +"@esbuild/darwin-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" + integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== + +"@esbuild/darwin-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" + integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== + +"@esbuild/freebsd-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" + integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== + +"@esbuild/freebsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" + integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== + +"@esbuild/linux-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" + integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== + +"@esbuild/linux-arm@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" + integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== + +"@esbuild/linux-ia32@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" + integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== + +"@esbuild/linux-loong64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" + integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== + +"@esbuild/linux-mips64el@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" + integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== + +"@esbuild/linux-ppc64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" + integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== + +"@esbuild/linux-riscv64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" + integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== + +"@esbuild/linux-s390x@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" + integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== + +"@esbuild/linux-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" + integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== + +"@esbuild/netbsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" + integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== + +"@esbuild/openbsd-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" + integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== + +"@esbuild/sunos-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" + integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== + +"@esbuild/win32-arm64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" + integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== + +"@esbuild/win32-ia32@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" + integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== + +"@esbuild/win32-x64@0.17.19": + version "0.17.19" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" + integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== + +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.4.0.tgz#3e61c564fcd6b921cb789838631c5ee44df09403" - integrity sha512-A9983Q0LnDGdLPjxyXQ00sbV+K+O+ko2Dr+CZigbHWtX9pNfxlaBkMR8X1CztI73zuEyEBXTVjx7CE+/VSwDiQ== +"@eslint-community/regexpp@^4.4.0", "@eslint-community/regexpp@^4.5.1": + version "4.5.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884" + integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ== -"@eslint/eslintrc@^2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.1.tgz#7888fe7ec8f21bc26d646dbd2c11cd776e21192d" - integrity sha512-eFRmABvW2E5Ho6f5fHLqgena46rOj7r7OKHYfLElqcBfGFHHpjBhivyi5+jOEQuSpdc/1phIZJlbC2te+tZNIw== +"@eslint/eslintrc@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.0.tgz#82256f164cc9e0b59669efc19d57f8092706841d" + integrity sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.5.0" + espree "^9.6.0" globals "^13.19.0" ignore "^5.2.0" import-fresh "^3.2.1" @@ -2166,10 +2250,15 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.36.0": - version "8.36.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.36.0.tgz#9837f768c03a1e4a30bd304a64fb8844f0e72efe" - integrity sha512-lxJ9R5ygVm8ZWgYdUweoq5ownDlJ4upvoWmO4eLxBYHdMo+vZ/Rx0EN6MbKWDJOSUGrqJy2Gt+Dyv/VKml0fjg== +"@eslint/js@8.44.0": + version "8.44.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" + integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== + +"@eslint/js@8.45.0": + version "8.45.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.45.0.tgz#b0d59168e76993bded2897a19aef618ebfc33ceb" + integrity sha512-p/4a2uaWVHCbAPLxPcv9rkhooU1FVfUUiLoZq09v1dOgtLym/Qlsyw2L3JWr9inVRt1XaLKPP5PBcDtTxRUJPg== "@gar/promisify@^1.1.3": version "1.1.3" @@ -2188,10 +2277,10 @@ dependencies: "@hapi/hoek" "^9.0.0" -"@humanwhocodes/config-array@^0.11.8": - version "0.11.8" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9" - integrity sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g== +"@humanwhocodes/config-array@^0.11.10": + version "0.11.10" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.10.tgz#5a3ffe32cc9306365fb3fd572596cd602d5e12d2" + integrity sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ== dependencies: "@humanwhocodes/object-schema" "^1.2.1" debug "^4.1.1" @@ -2212,10 +2301,17 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== -"@isaacs/string-locale-compare@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz#291c227e93fd407a96ecd59879a35809120e432b" - integrity sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ== +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -2233,117 +2329,117 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^29.1.2", "@jest/console@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.5.0.tgz#593a6c5c0d3f75689835f1b3b4688c4f8544cb57" - integrity sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ== +"@jest/console@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.6.1.tgz#b48ba7b9c34b51483e6d590f46e5837f1ab5f639" + integrity sha512-Aj772AYgwTSr5w8qnyoJ0eDYvN6bMsH3ORH1ivMotrInHLKdUz6BDlaEXHdM6kODaBIkNIyQGzsMvRdOv7VG7Q== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^29.5.0" - jest-util "^29.5.0" + jest-message-util "^29.6.1" + jest-util "^29.6.1" slash "^3.0.0" -"@jest/core@^29.1.2": - version "29.1.2" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.1.2.tgz#e5ce7a71e7da45156a96fb5eeed11d18b67bd112" - integrity sha512-sCO2Va1gikvQU2ynDN8V4+6wB7iVrD2CvT0zaRst4rglf56yLly0NQ9nuRRAWFeimRf+tCdFsb1Vk1N9LrrMPA== +"@jest/core@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.6.1.tgz#fac0d9ddf320490c93356ba201451825231e95f6" + integrity sha512-CcowHypRSm5oYQ1obz1wfvkjZZ2qoQlrKKvlfPwh5jUXVU12TWr2qMeH8chLMuTFzHh5a1g2yaqlqDICbr+ukQ== dependencies: - "@jest/console" "^29.1.2" - "@jest/reporters" "^29.1.2" - "@jest/test-result" "^29.1.2" - "@jest/transform" "^29.1.2" - "@jest/types" "^29.1.2" + "@jest/console" "^29.6.1" + "@jest/reporters" "^29.6.1" + "@jest/test-result" "^29.6.1" + "@jest/transform" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^29.0.0" - jest-config "^29.1.2" - jest-haste-map "^29.1.2" - jest-message-util "^29.1.2" - jest-regex-util "^29.0.0" - jest-resolve "^29.1.2" - jest-resolve-dependencies "^29.1.2" - jest-runner "^29.1.2" - jest-runtime "^29.1.2" - jest-snapshot "^29.1.2" - jest-util "^29.1.2" - jest-validate "^29.1.2" - jest-watcher "^29.1.2" + jest-changed-files "^29.5.0" + jest-config "^29.6.1" + jest-haste-map "^29.6.1" + jest-message-util "^29.6.1" + jest-regex-util "^29.4.3" + jest-resolve "^29.6.1" + jest-resolve-dependencies "^29.6.1" + jest-runner "^29.6.1" + jest-runtime "^29.6.1" + jest-snapshot "^29.6.1" + jest-util "^29.6.1" + jest-validate "^29.6.1" + jest-watcher "^29.6.1" micromatch "^4.0.4" - pretty-format "^29.1.2" + pretty-format "^29.6.1" slash "^3.0.0" strip-ansi "^6.0.0" "@jest/create-cache-key-function@^27.4.2", "@jest/create-cache-key-function@^29": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.5.0.tgz#24e019d03e634be4affe8bcee787d75a36ae57a2" - integrity sha512-LIDZyZgnZss7uikvBKBB/USWwG+GO8+GnwRWT+YkCGDGsqLQlhm9BC3z6+7+eMs1kUlvXQIWEzBR8Q2Pnvx6lg== + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.6.1.tgz#eb69da959e78e8457757451166b4b0f7b64fe679" + integrity sha512-d77/1BbNLbJDBV6tH7ctYpau+3tnU5YMhg36uGabW4VDrl1Arp6E0jDRioHFoFqIbm+BXMVbyQc9MpfKo6OIQQ== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" -"@jest/environment@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.5.0.tgz#9152d56317c1fdb1af389c46640ba74ef0bb4c65" - integrity sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ== +"@jest/environment@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.6.1.tgz#ee358fff2f68168394b4a50f18c68278a21fe82f" + integrity sha512-RMMXx4ws+Gbvw3DfLSuo2cfQlK7IwGbpuEWXCqyYDcqYTI+9Ju3a5hDnXaxjNsa6uKh9PQF2v+qg+RLe63tz5A== dependencies: - "@jest/fake-timers" "^29.5.0" - "@jest/types" "^29.5.0" + "@jest/fake-timers" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" - jest-mock "^29.5.0" + jest-mock "^29.6.1" -"@jest/expect-utils@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.5.0.tgz#f74fad6b6e20f924582dc8ecbf2cb800fe43a036" - integrity sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg== +"@jest/expect-utils@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.6.1.tgz#ab83b27a15cdd203fe5f68230ea22767d5c3acc5" + integrity sha512-o319vIf5pEMx0LmzSxxkYYxo4wrRLKHq9dP1yJU7FoPTB0LfAKSz8SWD6D/6U3v/O52t9cF5t+MeJiRsfk7zMw== dependencies: jest-get-type "^29.4.3" -"@jest/expect@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.5.0.tgz#80952f5316b23c483fbca4363ce822af79c38fba" - integrity sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g== +"@jest/expect@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.6.1.tgz#fef18265188f6a97601f1ea0a2912d81a85b4657" + integrity sha512-N5xlPrAYaRNyFgVf2s9Uyyvr795jnB6rObuPx4QFvNJz8aAjpZUDfO4bh5G/xuplMID8PrnuF1+SfSyDxhsgYg== dependencies: - expect "^29.5.0" - jest-snapshot "^29.5.0" + expect "^29.6.1" + jest-snapshot "^29.6.1" -"@jest/fake-timers@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.5.0.tgz#d4d09ec3286b3d90c60bdcd66ed28d35f1b4dc2c" - integrity sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg== +"@jest/fake-timers@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.6.1.tgz#c773efddbc61e1d2efcccac008139f621de57c69" + integrity sha512-RdgHgbXyosCDMVYmj7lLpUwXA4c69vcNzhrt69dJJdf8azUrpRh3ckFCaTPNjsEeRi27Cig0oKDGxy5j7hOgHg== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" - jest-message-util "^29.5.0" - jest-mock "^29.5.0" - jest-util "^29.5.0" + jest-message-util "^29.6.1" + jest-mock "^29.6.1" + jest-util "^29.6.1" -"@jest/globals@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.5.0.tgz#6166c0bfc374c58268677539d0c181f9c1833298" - integrity sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ== +"@jest/globals@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.6.1.tgz#c8a8923e05efd757308082cc22893d82b8aa138f" + integrity sha512-2VjpaGy78JY9n9370H8zGRCFbYVWwjY6RdDMhoJHa1sYfwe6XM/azGN0SjY8kk7BOZApIejQ1BFPyH7FPG0w3A== dependencies: - "@jest/environment" "^29.5.0" - "@jest/expect" "^29.5.0" - "@jest/types" "^29.5.0" - jest-mock "^29.5.0" + "@jest/environment" "^29.6.1" + "@jest/expect" "^29.6.1" + "@jest/types" "^29.6.1" + jest-mock "^29.6.1" -"@jest/reporters@28.1.1", "@jest/reporters@^29", "@jest/reporters@^29.1.2": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.5.0.tgz#985dfd91290cd78ddae4914ba7921bcbabe8ac9b" - integrity sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA== +"@jest/reporters@^29", "@jest/reporters@^29.4.1", "@jest/reporters@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.6.1.tgz#3325a89c9ead3cf97ad93df3a427549d16179863" + integrity sha512-9zuaI9QKr9JnoZtFQlw4GREQbxgmNYXU6QuWtmuODvk5nvPUeBYapVR/VYMyi2WSx3jXTLJTJji8rN6+Cm4+FA== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^29.5.0" - "@jest/test-result" "^29.5.0" - "@jest/transform" "^29.5.0" - "@jest/types" "^29.5.0" - "@jridgewell/trace-mapping" "^0.3.15" + "@jest/console" "^29.6.1" + "@jest/test-result" "^29.6.1" + "@jest/transform" "^29.6.1" + "@jest/types" "^29.6.1" + "@jridgewell/trace-mapping" "^0.3.18" "@types/node" "*" chalk "^4.0.0" collect-v8-coverage "^1.0.0" @@ -2355,167 +2451,167 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" - jest-message-util "^29.5.0" - jest-util "^29.5.0" - jest-worker "^29.5.0" + jest-message-util "^29.6.1" + jest-util "^29.6.1" + jest-worker "^29.6.1" slash "^3.0.0" string-length "^4.0.1" strip-ansi "^6.0.0" v8-to-istanbul "^9.0.1" -"@jest/schemas@^29.4.3": - version "29.4.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788" - integrity sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg== +"@jest/schemas@^29.6.0": + version "29.6.0" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.0.tgz#0f4cb2c8e3dca80c135507ba5635a4fd755b0040" + integrity sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ== dependencies: - "@sinclair/typebox" "^0.25.16" + "@sinclair/typebox" "^0.27.8" -"@jest/source-map@^29.4.3": - version "29.4.3" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.4.3.tgz#ff8d05cbfff875d4a791ab679b4333df47951d20" - integrity sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w== +"@jest/source-map@^29.6.0": + version "29.6.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.0.tgz#bd34a05b5737cb1a99d43e1957020ac8e5b9ddb1" + integrity sha512-oA+I2SHHQGxDCZpbrsCQSoMLb3Bz547JnM+jUr9qEbuw0vQlWZfpPS7CO9J7XiwKicEz9OFn/IYoLkkiUD7bzA== dependencies: - "@jridgewell/trace-mapping" "^0.3.15" + "@jridgewell/trace-mapping" "^0.3.18" callsites "^3.0.0" graceful-fs "^4.2.9" -"@jest/test-result@28.1.1", "@jest/test-result@^29", "@jest/test-result@^29.1.2", "@jest/test-result@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.5.0.tgz#7c856a6ca84f45cc36926a4e9c6b57f1973f1408" - integrity sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ== +"@jest/test-result@^29", "@jest/test-result@^29.4.1", "@jest/test-result@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.6.1.tgz#850e565a3f58ee8ca6ec424db00cb0f2d83c36ba" + integrity sha512-Ynr13ZRcpX6INak0TPUukU8GWRfm/vAytE3JbJNGAvINySWYdfE7dGZMbk36oVuK4CigpbhMn8eg1dixZ7ZJOw== dependencies: - "@jest/console" "^29.5.0" - "@jest/types" "^29.5.0" + "@jest/console" "^29.6.1" + "@jest/types" "^29.6.1" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz#34d7d82d3081abd523dbddc038a3ddcb9f6d3cc4" - integrity sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ== +"@jest/test-sequencer@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.6.1.tgz#e3e582ee074dd24ea9687d7d1aaf05ee3a9b068e" + integrity sha512-oBkC36PCDf/wb6dWeQIhaviU0l5u6VCsXa119yqdUosYAt7/FbQU2M2UoziO3igj/HBDEgp57ONQ3fm0v9uyyg== dependencies: - "@jest/test-result" "^29.5.0" + "@jest/test-result" "^29.6.1" graceful-fs "^4.2.9" - jest-haste-map "^29.5.0" + jest-haste-map "^29.6.1" slash "^3.0.0" -"@jest/transform@^29.1.2", "@jest/transform@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.5.0.tgz#cf9c872d0965f0cbd32f1458aa44a2b1988b00f9" - integrity sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw== +"@jest/transform@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.6.1.tgz#acb5606019a197cb99beda3c05404b851f441c92" + integrity sha512-URnTneIU3ZjRSaf906cvf6Hpox3hIeJXRnz3VDSw5/X93gR8ycdfSIEy19FlVx8NFmpN7fe3Gb1xF+NjXaQLWg== dependencies: "@babel/core" "^7.11.6" - "@jest/types" "^29.5.0" - "@jridgewell/trace-mapping" "^0.3.15" + "@jest/types" "^29.6.1" + "@jridgewell/trace-mapping" "^0.3.18" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" convert-source-map "^2.0.0" fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^29.5.0" + jest-haste-map "^29.6.1" jest-regex-util "^29.4.3" - jest-util "^29.5.0" + jest-util "^29.6.1" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" write-file-atomic "^4.0.2" -"@jest/types@^29.1.2", "@jest/types@^29.5.0": - version "29.5.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.5.0.tgz#f59ef9b031ced83047c67032700d8c807d6e1593" - integrity sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog== +"@jest/types@^29.6.1": + version "29.6.1" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.1.tgz#ae79080278acff0a6af5eb49d063385aaa897bf2" + integrity sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw== dependencies: - "@jest/schemas" "^29.4.3" + "@jest/schemas" "^29.6.0" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" "@types/yargs" "^17.0.8" chalk "^4.0.0" -"@jridgewell/gen-mapping@^0.1.0": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996" - integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w== - dependencies: - "@jridgewell/set-array" "^1.0.0" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" - integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== dependencies: "@jridgewell/set-array" "^1.0.1" "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/resolve-uri@3.1.0": +"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3": version "3.1.0" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== -"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1": +"@jridgewell/set-array@^1.0.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== -"@jridgewell/source-map@^0.3.2": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" - integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== +"@jridgewell/source-map@^0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.3.tgz#8108265659d4c33e72ffe14e33d6cc5eb59f2fda" + integrity sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg== dependencies: "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.13": +"@jridgewell/sourcemap-codec@1.4.14": version "1.4.14" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.7", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.17" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" - integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.9": + version "0.3.18" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" + integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== dependencies: "@jridgewell/resolve-uri" "3.1.0" "@jridgewell/sourcemap-codec" "1.4.14" -"@jsdevtools/ono@^7.1.3": - version "7.1.3" - resolved "https://registry.yarnpkg.com/@jsdevtools/ono/-/ono-7.1.3.tgz#9df03bbd7c696a5c58885c34aa06da41c8543796" - integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== - "@leichtgewicht/ip-codec@^2.0.1": version "2.0.4" resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== -"@lerna/child-process@6.5.1": - version "6.5.1" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-6.5.1.tgz#da9161ba00e8d67fa7241a709703e5cc5e4a5e5e" - integrity sha512-QfyleXSD9slh4qM54wDaqKVPvtUH1NJMgsFc9BabqSHO1Ttpandv1EAvTCN9Lu73RbCX3LJpn+BfJmnjHbjCyw== +"@lerna/child-process@7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-7.1.3.tgz#8037449080e0d2fdbff957e15bf1877a5d9872c3" + integrity sha512-ZXHo30G5Ia/RCWKVyBm+3kAe/liWy7KaRF+CPWZpxYo+ysFPBIJ/7XZlGMzmq8fQaMsPj1z61q4wyqeAlUwuvQ== dependencies: chalk "^4.1.0" execa "^5.0.0" strong-log-transformer "^2.1.0" -"@lerna/create@6.5.1": - version "6.5.1" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-6.5.1.tgz#326b5d26c247bfc9e2d8728aa1f69419840cec8c" - integrity sha512-ejERJnfA36jEuKrfM+94feLiyf2/hF2NoG923N0rE4rsmvRFPr1XLVPvAKleXW+Gdi/t1p410lJ7NKaLRMYCYw== +"@lerna/create@7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-7.1.3.tgz#497b50cee176083f7457a7ac1cd5e8f180761e73" + integrity sha512-i/xUmT7sMNTUhGpSUuQJ8N776YiT/fJaKPrzMSAoxqDBhyDryi4o4JUR+rrN9oELOEsO+SOXQEusBdkmUdVTMg== dependencies: - "@lerna/child-process" "6.5.1" - dedent "^0.7.0" - fs-extra "^9.1.0" - init-package-json "^3.0.2" + "@lerna/child-process" "7.1.3" + dedent "0.7.0" + fs-extra "^11.1.1" + init-package-json "5.0.0" npm-package-arg "8.1.1" p-reduce "^2.1.0" - pacote "^13.6.1" - pify "^5.0.0" + pacote "^15.2.0" + pify "5.0.0" semver "^7.3.4" slash "^3.0.0" validate-npm-package-license "^3.0.4" - validate-npm-package-name "^4.0.0" + validate-npm-package-name "5.0.0" yargs-parser "20.2.4" "@mdx-js/mdx@^1.6.22": @@ -2553,32 +2649,32 @@ resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.22.tgz#219dfd89ae5b97a8801f015323ffa4b62f45718b" integrity sha512-H1rQc1ZOHANWBvPcW+JpGwr+juXSxM8Q8YCkm3GhZd8REu1fHR3z99CErO1p9pkcfcxZnMdIZdIsXkOHY0NilA== -"@microsoft/api-extractor-model@7.26.4": - version "7.26.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.26.4.tgz#77f2c17140249b846a61eea41e565289cc77181f" - integrity sha512-PDCgCzXDo+SLY5bsfl4bS7hxaeEtnXj7XtuzEE+BtALp7B5mK/NrS2kHWU69pohgsRmEALycQdaQPXoyT2i5MQ== +"@microsoft/api-extractor-model@7.27.4": + version "7.27.4" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.27.4.tgz#ddc566ead99737c1032d692829edd954870f7d35" + integrity sha512-HjqQFmuGPOS20rtnu+9Jj0QrqZyR59E+piUWXPMZTTn4jaZI+4UmsHSf3Id8vyueAhOBH2cgwBuRTE5R+MfSMw== dependencies: "@microsoft/tsdoc" "0.14.2" "@microsoft/tsdoc-config" "~0.16.1" - "@rushstack/node-core-library" "3.55.2" + "@rushstack/node-core-library" "3.59.5" -"@microsoft/api-extractor@^7.34.4": - version "7.34.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.34.4.tgz#80677b5059b437bc07e9e55832c0cbde671c16a1" - integrity sha512-HOdcci2nT40ejhwPC3Xja9G+WSJmWhCUKKryRfQYsmE9cD+pxmBaKBKCbuS9jUcl6bLLb4Gz+h7xEN5r0QiXnQ== +"@microsoft/api-extractor@^7.36.1": + version "7.36.2" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.36.2.tgz#8f7696fcc3c9c0c43469e6f59c56349bc1631193" + integrity sha512-ONe/jOmTZtR3OjTkWKHmeSV1P5ozbHDxHr6FV3KoWyIl1AcPk2B3dmvVBM5eOlZB5bgM66nxcWQTZ6msQo2hHg== dependencies: - "@microsoft/api-extractor-model" "7.26.4" + "@microsoft/api-extractor-model" "7.27.4" "@microsoft/tsdoc" "0.14.2" "@microsoft/tsdoc-config" "~0.16.1" - "@rushstack/node-core-library" "3.55.2" - "@rushstack/rig-package" "0.3.18" - "@rushstack/ts-command-line" "4.13.2" + "@rushstack/node-core-library" "3.59.5" + "@rushstack/rig-package" "0.4.0" + "@rushstack/ts-command-line" "4.15.1" colors "~1.2.1" lodash "~4.17.15" resolve "~1.22.1" semver "~7.3.0" source-map "~0.6.1" - typescript "~4.8.4" + typescript "~5.0.4" "@microsoft/tsdoc-config@~0.16.1": version "0.16.1" @@ -2600,6 +2696,11 @@ resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz#c3ec604a0b54b9a9b87e9735dfc59e1a5da6a5fb" integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== +"@netlify/open-api@^2.19.1": + version "2.19.1" + resolved "https://registry.yarnpkg.com/@netlify/open-api/-/open-api-2.19.1.tgz#041ddb16ba219332a256ce84dffc6fdd2c964922" + integrity sha512-RkucRf8o0vYhCDXCRHWU/EdhkVE3JhkqKmZFvMW6qCPD206GV2Cfo9JGSKb0NdN+nmHSNaYmd+9dvT6I9MP4pw== + "@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": version "5.1.1-v1" resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129" @@ -2628,46 +2729,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@npmcli/arborist@5.3.0": - version "5.3.0" - resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-5.3.0.tgz#321d9424677bfc08569e98a5ac445ee781f32053" - integrity sha512-+rZ9zgL1lnbl8Xbb1NQdMjveOMwj4lIYfcDtyJHHi5x4X8jtR6m8SXooJMZy5vmFVZ8w7A2Bnd/oX9eTuU8w5A== - dependencies: - "@isaacs/string-locale-compare" "^1.1.0" - "@npmcli/installed-package-contents" "^1.0.7" - "@npmcli/map-workspaces" "^2.0.3" - "@npmcli/metavuln-calculator" "^3.0.1" - "@npmcli/move-file" "^2.0.0" - "@npmcli/name-from-folder" "^1.0.1" - "@npmcli/node-gyp" "^2.0.0" - "@npmcli/package-json" "^2.0.0" - "@npmcli/run-script" "^4.1.3" - bin-links "^3.0.0" - cacache "^16.0.6" - common-ancestor-path "^1.0.1" - json-parse-even-better-errors "^2.3.1" - json-stringify-nice "^1.1.4" - mkdirp "^1.0.4" - mkdirp-infer-owner "^2.0.0" - nopt "^5.0.0" - npm-install-checks "^5.0.0" - npm-package-arg "^9.0.0" - npm-pick-manifest "^7.0.0" - npm-registry-fetch "^13.0.0" - npmlog "^6.0.2" - pacote "^13.6.1" - parse-conflict-json "^2.0.1" - proc-log "^2.0.0" - promise-all-reject-late "^1.0.0" - promise-call-limit "^1.0.1" - read-package-json-fast "^2.0.2" - readdir-scoped-modules "^1.1.0" - rimraf "^3.0.2" - semver "^7.3.7" - ssri "^9.0.0" - treeverse "^2.0.0" - walk-up-path "^1.0.0" - "@npmcli/fs@^2.1.0": version "2.1.0" resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-2.1.0.tgz#f2a21c28386e299d1a9fae8051d35ad180e33109" @@ -2676,48 +2737,34 @@ "@gar/promisify" "^1.1.3" semver "^7.3.5" -"@npmcli/git@^3.0.0": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-3.0.1.tgz#049b99b1381a2ddf7dc56ba3e91eaf76ca803a8d" - integrity sha512-UU85F/T+F1oVn3IsB/L6k9zXIMpXBuUBE25QDH0SsURwT6IOBqkC7M16uqo2vVZIyji3X1K4XH9luip7YekH1A== +"@npmcli/fs@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-3.1.0.tgz#233d43a25a91d68c3a863ba0da6a3f00924a173e" + integrity sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w== + dependencies: + semver "^7.3.5" + +"@npmcli/git@^4.0.0": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-4.0.4.tgz#cdf74f21b1d440c0756fb28159d935129d9daa33" + integrity sha512-5yZghx+u5M47LghaybLCkdSyFzV/w4OuH12d96HO389Ik9CDsLaDZJVynSGGVJOLn6gy/k7Dz5XYcplM3uxXRg== dependencies: - "@npmcli/promise-spawn" "^3.0.0" + "@npmcli/promise-spawn" "^6.0.0" lru-cache "^7.4.4" - mkdirp "^1.0.4" - npm-pick-manifest "^7.0.0" - proc-log "^2.0.0" + npm-pick-manifest "^8.0.0" + proc-log "^3.0.0" promise-inflight "^1.0.1" promise-retry "^2.0.1" semver "^7.3.5" - which "^2.0.2" - -"@npmcli/installed-package-contents@^1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz#ab7408c6147911b970a8abe261ce512232a3f4fa" - integrity sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw== - dependencies: - npm-bundled "^1.1.1" - npm-normalize-package-bin "^1.0.1" + which "^3.0.0" -"@npmcli/map-workspaces@^2.0.3": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@npmcli/map-workspaces/-/map-workspaces-2.0.3.tgz#2d3c75119ee53246e9aa75bc469a55281cd5f08f" - integrity sha512-X6suAun5QyupNM8iHkNPh0AHdRC2rb1W+MTdMvvA/2ixgmqZwlq5cGUBgmKHUHT2LgrkKJMAXbfAoTxOigpK8Q== +"@npmcli/installed-package-contents@^2.0.1": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@npmcli/installed-package-contents/-/installed-package-contents-2.0.2.tgz#bfd817eccd9e8df200919e73f57f9e3d9e4f9e33" + integrity sha512-xACzLPhnfD51GKvTOOuNX2/V4G4mz9/1I2MfDoye9kBM3RYe5g2YbscsaGoTlaWqkxeiapBWyseULVKpSVHtKQ== dependencies: - "@npmcli/name-from-folder" "^1.0.1" - glob "^8.0.1" - minimatch "^5.0.1" - read-package-json-fast "^2.0.3" - -"@npmcli/metavuln-calculator@^3.0.1": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-3.1.0.tgz#b1c2f0991c4f2d992b1615a54d4358c05efc3702" - integrity sha512-Q5fbQqGDlYqk7kWrbg6E2j/mtqQjZop0ZE6735wYA1tYNHguIDjAuWs+kFb5rJCkLIlXllfapvsyotYKiZOTBA== - dependencies: - cacache "^16.0.0" - json-parse-even-better-errors "^2.3.1" - pacote "^13.0.3" - semver "^7.3.5" + npm-bundled "^3.0.0" + npm-normalize-package-bin "^3.0.0" "@npmcli/move-file@^2.0.0": version "2.0.0" @@ -2727,171 +2774,285 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@npmcli/name-from-folder@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@npmcli/name-from-folder/-/name-from-folder-1.0.1.tgz#77ecd0a4fcb772ba6fe927e2e2e155fbec2e6b1a" - integrity sha512-qq3oEfcLFwNfEYOQ8HLimRGKlD8WSeGEdtUa7hmzpR8Sa7haL1KVQrvgO6wqMjhWFFVjgtrh1gIxDz+P8sjUaA== +"@npmcli/node-gyp@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-3.0.0.tgz#101b2d0490ef1aa20ed460e4c0813f0db560545a" + integrity sha512-gp8pRXC2oOxu0DUE1/M3bYtb1b3/DbJ5aM113+XJBgfXdussRAsX0YOrOhdd8WvnAR6auDBvJomGAkLKA5ydxA== -"@npmcli/node-gyp@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-2.0.0.tgz#8c20e53e34e9078d18815c1d2dda6f2420d75e35" - integrity sha512-doNI35wIe3bBaEgrlPfdJPaCpUR89pJWep4Hq3aRdh6gKazIVWfs0jHttvSSoq47ZXgC7h73kDsUl8AoIQUB+A== +"@npmcli/promise-spawn@^6.0.0", "@npmcli/promise-spawn@^6.0.1": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@npmcli/promise-spawn/-/promise-spawn-6.0.2.tgz#c8bc4fa2bd0f01cb979d8798ba038f314cfa70f2" + integrity sha512-gGq0NJkIGSwdbUt4yhdF8ZrmkGKVz9vAdVzpOfnom+V8PLSmSOVhZwbNvZZS1EYcJN5hzzKBxmmVVAInM6HQLg== + dependencies: + which "^3.0.0" -"@npmcli/package-json@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/package-json/-/package-json-2.0.0.tgz#3bbcf4677e21055adbe673d9f08c9f9cde942e4a" - integrity sha512-42jnZ6yl16GzjWSH7vtrmWyJDGVa/LXPdpN2rcUWolFjc9ON2N3uz0qdBbQACfmhuJZ2lbKYtmK5qx68ZPLHMA== +"@npmcli/run-script@6.0.2", "@npmcli/run-script@^6.0.0": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-6.0.2.tgz#a25452d45ee7f7fb8c16dfaf9624423c0c0eb885" + integrity sha512-NCcr1uQo1k5U+SYlnIrbAh3cxy+OQT1VtqiAbxdymSlptbzBb62AjH2xXgjNCoP073hoa1CfCAcwoZ8k96C4nA== dependencies: - json-parse-even-better-errors "^2.3.1" + "@npmcli/node-gyp" "^3.0.0" + "@npmcli/promise-spawn" "^6.0.0" + node-gyp "^9.0.0" + read-package-json-fast "^3.0.0" + which "^3.0.0" -"@npmcli/promise-spawn@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz#53283b5f18f855c6925f23c24e67c911501ef573" - integrity sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g== +"@nrwl/devkit@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-16.5.1.tgz#43985cc1105e85afd8323586477c4a0d1b2eeee3" + integrity sha512-NB+DE/+AFJ7lKH/WBFyatJEhcZGj25F24ncDkwjZ6MzEiSOGOJS0LaV/R+VUsmS5EHTPXYOpn3zHWWAcJhyOmA== dependencies: - infer-owner "^1.0.4" + "@nx/devkit" "16.5.1" -"@npmcli/run-script@4.1.7": - version "4.1.7" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-4.1.7.tgz#b1a2f57568eb738e45e9ea3123fb054b400a86f7" - integrity sha512-WXr/MyM4tpKA4BotB81NccGAv8B48lNH0gRoILucbcAhTQXLCoi6HflMV3KdXubIqvP9SuLsFn68Z7r4jl+ppw== +"@nrwl/devkit@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-16.5.2.tgz#eedcf4e546e2ebd3d01babcf5c97bc2b6bf08408" + integrity sha512-4L8cHD6cDTVWqylzM9vNbh8MuujsBpEP0yiTKQOBfAkTWpp/PcyFsnCMtYEiaWIQ5xSrruVbL5pb9KEL4ayLAg== dependencies: - "@npmcli/node-gyp" "^2.0.0" - "@npmcli/promise-spawn" "^3.0.0" - node-gyp "^9.0.0" - read-package-json-fast "^2.0.3" - which "^2.0.2" + "@nx/devkit" "16.5.2" -"@npmcli/run-script@^4.1.0", "@npmcli/run-script@^4.1.3": - version "4.2.0" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-4.2.0.tgz#2c25758f80831ba138afe25225d456e89acedac3" - integrity sha512-e/QgLg7j2wSJp1/7JRl0GC8c7PMX+uYlA/1Tb+IDOLdSM4T7K1VQ9mm9IGU3WRtY5vEIObpqCLb3aCNCug18DA== +"@nrwl/jest@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nrwl/jest/-/jest-16.5.2.tgz#8ff6176e5a9604a094f6c02793e163f41db5298c" + integrity sha512-Chd4YGyo+8G1OmqAd9k0dtMjo9rO7Uh8vsUkWFtEDIyxmmElEReBC9nGBE/9FQYZFoc+xP1a5IaceGqupZX8bQ== dependencies: - "@npmcli/node-gyp" "^2.0.0" - "@npmcli/promise-spawn" "^3.0.0" - node-gyp "^9.0.0" - read-package-json-fast "^2.0.3" - which "^2.0.2" + "@nx/jest" "16.5.2" + +"@nrwl/js@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nrwl/js/-/js-16.5.2.tgz#cb1bedaa7c033fa3f892adfd2199166a0dd59faf" + integrity sha512-5kr4h869oq3qoKPiVELSWBrb18szZKjKHmCOxJvyL1AUeNR+F7AQxYcuyqNwLKQXBVMhQU2cAUJjqUc0gezlnA== + dependencies: + "@nx/js" "16.5.2" + +"@nrwl/linter@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nrwl/linter/-/linter-16.5.2.tgz#16a7cd8ce025d4efbd80af60b489ea4d92321fa2" + integrity sha512-8P9rxKVOWvckwn80YUJwI7PUI2Tegp0ecbwZi2gju0KATV1sEGxrrR2luHHaxfgC+lXGj1B88LzgxpDaD8Q9Hw== + dependencies: + "@nx/linter" "16.5.2" -"@nrwl/cli@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-15.7.2.tgz#fd705b022e628f2ed23d9fc5c3542e4d652b8710" - integrity sha512-A/72FAW1e0ku8YB/PaCqN9BpVvciO83MS5F5bvX5PA8xCNqe1+iXp/5T2ASnN2lB9zR3fQJmvR7mHKTKQlqQQQ== +"@nrwl/nx-cloud@16.1.0": + version "16.1.0" + resolved "https://registry.yarnpkg.com/@nrwl/nx-cloud/-/nx-cloud-16.1.0.tgz#627f7d7599aa312a424ec016f45ce63b21bae292" + integrity sha512-OFjbSqdCuZq9KRYU/mOlIN8SYLZREsLlZYqYpObZqXJ5meUgBDJbUSwRweUSUvt73fgRixLEau2jPysiLHKxSQ== dependencies: - nx "15.7.2" + nx-cloud "16.1.0" -"@nrwl/devkit@15.7.2", "@nrwl/devkit@>=15.5.2 < 16": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-15.7.2.tgz#079d30898bf7ddf374e2aaa9f2c52b31447b84ce" - integrity sha512-HMGi7L6w2g4IrYwhb04snD8Zr24Z/gzau5i9WUNkwzrjeR1xAm0Cc9WRre221zaeohtK11gyBt7BerT1tgkNwA== +"@nrwl/tao@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-16.5.1.tgz#e6e6b1ab73238497d4d9f014b30af18722e73503" + integrity sha512-x+gi/fKdM6uQNIti9exFlm3V5LBP3Y8vOEziO42HdOigyrXa0S0HD2WMpccmp6PclYKhwEDUjKJ39xh5sdh4Ig== dependencies: - "@phenomnomnominal/tsquery" "4.1.1" + nx "16.5.1" + +"@nrwl/tao@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-16.5.2.tgz#6b46b880e36ff0af4cceaf2409fd2055bf2cf2b1" + integrity sha512-4vQt0Jj9xHc8SpNgM2TxkPZrkjf4ayNW7elgt5rlOT1yD3Q1Fn3/VHb3cWtm/RC2vSckB4qUEuFGpdEU8wEnCg== + dependencies: + nx "16.5.2" + +"@nrwl/workspace@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nrwl/workspace/-/workspace-16.5.2.tgz#22c9e8f5ebd2d1cdc7ca5762d733422e4b5f61b8" + integrity sha512-ht3//ryb2lXKtiLyKTCITyoMsyPg0NycueU42rpmR8Gs3jFTHePQVLfSS9pdck8apors9i+Pg/tJPXdSpjY07A== + dependencies: + "@nx/workspace" "16.5.2" + +"@nx/devkit@16.5.1", "@nx/devkit@>=16.1.3 < 17": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/devkit/-/devkit-16.5.1.tgz#1d6a27895a7c85edebe0ba31e0a394839ad5fdd2" + integrity sha512-T1acZrVVmJw/sJ4PIGidCBYBiBqlg/jT9e8nIGXLSDS20xcLvfo4zBQf8UZLrmHglnwwpDpOWuVJCp2rYA5aDg== + dependencies: + "@nrwl/devkit" "16.5.1" ejs "^3.1.7" ignore "^5.0.4" - semver "7.3.4" + semver "7.5.3" + tmp "~0.2.1" tslib "^2.3.0" -"@nrwl/jest@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/jest/-/jest-15.7.2.tgz#2e28ad4727e9819f3f86afba0b1b60ab801c8d8a" - integrity sha512-ajTnC5AsOa4glNY5fTaK7fYSzN/MYvtMmAK1D7alQf7Ow0oF4eJYnAbhZgcZJTfsFnBDsnMf7SQOjdA1OPnN5Q== +"@nx/devkit@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/devkit/-/devkit-16.5.2.tgz#0a30fc4e3beeea7d7bf16a0496d1ff3c5fa05299" + integrity sha512-QDOQeFzVhQCA65g+2RfoGKZBUnCb151+F7/PvwRESEM+jybXHoXwR9PSE3ClnnmO/d0LUKB2ohU3Z9WQrQDALQ== dependencies: - "@jest/reporters" "28.1.1" - "@jest/test-result" "28.1.1" - "@nrwl/devkit" "15.7.2" - "@phenomnomnominal/tsquery" "4.1.1" + "@nrwl/devkit" "16.5.2" + ejs "^3.1.7" + ignore "^5.0.4" + semver "7.5.3" + tmp "~0.2.1" + tslib "^2.3.0" + +"@nx/jest@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/jest/-/jest-16.5.2.tgz#f4de39379b5b2e6ffcf3047193ffffb4c569f740" + integrity sha512-EVELIF4cy9iri8dSSLA2ZvEkExq/3DMTritxbI2mqI/iHixybqJ2D4aSw26gzbCz8rilMgPacriADDbkhGiFkw== + dependencies: + "@jest/reporters" "^29.4.1" + "@jest/test-result" "^29.4.1" + "@nrwl/jest" "16.5.2" + "@nx/devkit" "16.5.2" + "@nx/js" "16.5.2" + "@phenomnomnominal/tsquery" "~5.0.1" chalk "^4.1.0" dotenv "~10.0.0" identity-obj-proxy "3.0.0" - jest-config "28.1.1" - jest-resolve "28.1.1" - jest-util "28.1.1" + jest-config "^29.4.1" + jest-resolve "^29.4.1" + jest-util "^29.4.1" resolve.exports "1.1.0" tslib "^2.3.0" -"@nrwl/linter@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/linter/-/linter-15.7.2.tgz#994b1900d32fbc2c87dcdfb1011d72250e1b5dba" - integrity sha512-6l0jHvTJBWnFGNJ1LJCldaxNO+p13QOD5g8W0pN9pfubVloU/lYCdSEvUrMVDqCjd34mPBzTZU7/N9ga745mnA== +"@nx/js@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/js/-/js-16.5.2.tgz#200e1ddad3f61f8a200397717edbeb4d51e23d47" + integrity sha512-CuV0I3erdx9Kv3QParQrdUnIxzHt9iWOMI6hhrcGARrP0C2l2cxQ10X/pG7pA9XMMWw5aibfHj7sPQzHXWWkSw== dependencies: - "@nrwl/devkit" "15.7.2" - "@phenomnomnominal/tsquery" "4.1.1" - tmp "~0.2.1" + "@babel/core" "^7.15.0" + "@babel/plugin-proposal-class-properties" "^7.14.5" + "@babel/plugin-proposal-decorators" "^7.14.5" + "@babel/plugin-transform-runtime" "^7.15.0" + "@babel/preset-env" "^7.15.0" + "@babel/preset-typescript" "^7.15.0" + "@babel/runtime" "^7.14.8" + "@nrwl/js" "16.5.2" + "@nx/devkit" "16.5.2" + "@nx/workspace" "16.5.2" + "@phenomnomnominal/tsquery" "~5.0.1" + babel-plugin-const-enum "^1.0.1" + babel-plugin-macros "^2.8.0" + babel-plugin-transform-typescript-metadata "^0.3.1" + chalk "^4.1.0" + detect-port "^1.5.1" + fast-glob "3.2.7" + fs-extra "^11.1.0" + ignore "^5.0.4" + js-tokens "^4.0.0" + minimatch "3.0.5" + semver "7.5.3" + source-map-support "0.5.19" tslib "^2.3.0" -"@nrwl/nx-cloud@15.0.3": - version "15.0.3" - resolved "https://registry.yarnpkg.com/@nrwl/nx-cloud/-/nx-cloud-15.0.3.tgz#e24428969aebafcf0989d9504d941d42d51a12db" - integrity sha512-KvwM8/IbCOlbWIzi+Tm14tJkEdQK3ruN6TPUmeKnkeFZsJyoFw4GCyKJMOLs8y4MQokHgskg3nbF822JLR9xJg== +"@nx/linter@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/linter/-/linter-16.5.2.tgz#59cf9a0116fc01b544c6c63960c781715e1677d5" + integrity sha512-d9HPiVCcYb8s5bYrjI7uqwZO640arOwB6FKn3AdIo6SHge1wn8rNvsytDx1IB0C3TcGQhjIC+4X7ZxN5GmfRbw== dependencies: - axios "^0.21.2" - chalk "4.1.0" - dotenv "~10.0.0" - fs-extra "^10.1.0" - node-machine-id "^1.1.12" - strip-json-comments "^3.1.1" - tar "6.1.11" - yargs-parser ">=21.0.1" - -"@nrwl/nx-darwin-arm64@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-darwin-arm64/-/nx-darwin-arm64-15.7.2.tgz#08cf48f474f8e4e0d02998e4f095ba8c60b5c15a" - integrity sha512-F82exjuqkAkElSTxEcTFeLMhHpbGiccfTQh2VjXMS+ONldxM+Kd7atJjtUG8wKNXfg0lxxjjAdnzLy3iBuN/HQ== - -"@nrwl/nx-darwin-x64@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-darwin-x64/-/nx-darwin-x64-15.7.2.tgz#674941b2fc157df70f6b435e3193a6053f261a08" - integrity sha512-MNT7Bxz6yhoVLCgGpR0NtVkj20SER1CbrCaY7tmsKVNY9iA/EOZhz9qa3LeA1KZ4lw8Gpi2vD42mOngn7Mwr7w== - -"@nrwl/nx-linux-arm-gnueabihf@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-15.7.2.tgz#e647a52c503483ad586116af79bee56fc9b3e736" - integrity sha512-QGyPkYnZ9LnUnuCzrP50bwsMJ9n6r8K2bNC1sQQwioijY+4MHNL+bMTOGWc8+lYBP7Ju3gpTqozGV3FQVkaM2w== - -"@nrwl/nx-linux-arm64-gnu@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-15.7.2.tgz#43fe691eb56241357242bb85e86bb34c03f08b5b" - integrity sha512-HqufFVIvuunfChEFGkIhsLhhQjWLTFcCH2aQBSNesHpm6AhFVRGyokNu+PT6NNobr+BTrqJMocBqNQR1uvSyRQ== - -"@nrwl/nx-linux-arm64-musl@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-linux-arm64-musl/-/nx-linux-arm64-musl-15.7.2.tgz#8fa5f886f17f2636acdbce1f9b2f45cd33d1f56a" - integrity sha512-9B8q6I/OVyQuYe+Yg2wNyxza/CsbvejIUsrK3QGGWUwHlkklqOSmUOHyTrcyMHUSped6CWPyKdIywngYOQzltQ== - -"@nrwl/nx-linux-x64-gnu@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-linux-x64-gnu/-/nx-linux-x64-gnu-15.7.2.tgz#3e40aff8a4b0bce02dfc80f0ac4a16e5fbc11fa3" - integrity sha512-8/6WtQn4derYKUWu5SxWWM+1dGihSZXMhDW9l/sXOr/qbMZu3XBmM2XZSguw/+p9gEVHcMmN0+D+Cai+q6/vDQ== - -"@nrwl/nx-linux-x64-musl@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-linux-x64-musl/-/nx-linux-x64-musl-15.7.2.tgz#8303afde8e9c78aa0a02b0c9157d85a34c808592" - integrity sha512-c5SbqYZZBeBHhH5E30xwb4cHzCMVa/GQMCyTpZgsS/AHAPHbdkv+pO6bxxALvLPTyimcub7V+xbLCL7rgALzyw== - -"@nrwl/nx-win32-arm64-msvc@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-15.7.2.tgz#c3f44bfc8a5b124a23910de0974b5c8666d50cbb" - integrity sha512-gWD/+gSO3XBma8PHX1Dp86fM6EcntHFfa7n/BISwDFkZ19MfV/gK6HbO847fkD6I34/IcDM/z1PsFwoIpTeoow== - -"@nrwl/nx-win32-x64-msvc@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/nx-win32-x64-msvc/-/nx-win32-x64-msvc-15.7.2.tgz#cb622a96c0f85c37973420c4817e383783237a84" - integrity sha512-ARE4qGPgk+e+pSm0uPhHan5UCRtwNYc5ddVNS88NFrVoDTPm5MxYLGdvLnshWWio/Bx526FcwUMSCBWSW8HIFw== - -"@nrwl/tao@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/tao/-/tao-15.7.2.tgz#6c9264cd815d15d02710202e5046aba3e68156db" - integrity sha512-srx9heMIt/QIyuqfewiVYbRpFcD/2pHkTkrEEUKspPd25kzAL2adcAITQKVCHI7/VS2sPdDR67pVsGQPZFBMRQ== - dependencies: - nx "15.7.2" - -"@nrwl/workspace@15.7.2": - version "15.7.2" - resolved "https://registry.yarnpkg.com/@nrwl/workspace/-/workspace-15.7.2.tgz#a144314629eeb5cec666cebe64b7050c1fec43e5" - integrity sha512-b1XwQs+6qFFGBhkIQHgxz6nUmVbzNgjeYusBVPcZjR3rDKooEjc//72P4H34FbpCbf9GPfCj7s2ZtlDXn9+dFw== - dependencies: - "@nrwl/devkit" "15.7.2" - "@nrwl/linter" "15.7.2" + "@nrwl/linter" "16.5.2" + "@nx/devkit" "16.5.2" + "@nx/js" "16.5.2" + "@phenomnomnominal/tsquery" "~5.0.1" + tmp "~0.2.1" + tslib "^2.3.0" + +"@nx/nx-darwin-arm64@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-darwin-arm64/-/nx-darwin-arm64-16.5.1.tgz#87111664de492e5ae270ef2adc74553e03d77341" + integrity sha512-q98TFI4B/9N9PmKUr1jcbtD4yAFs1HfYd9jUXXTQOlfO9SbDjnrYJgZ4Fp9rMNfrBhgIQ4x1qx0AukZccKmH9Q== + +"@nx/nx-darwin-arm64@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-darwin-arm64/-/nx-darwin-arm64-16.5.2.tgz#0efcc62881eddd20e5bb8f881e6c8cc082c864f8" + integrity sha512-myiNbDJLhhVHRLo6z3TeiaUeYTWdvBR3RdHQq4szTgb82Bnn8ruzteRGGJwKZd551YlttRcieBysxzUzHkmVBg== + +"@nx/nx-darwin-x64@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-darwin-x64/-/nx-darwin-x64-16.5.1.tgz#05c34ce8f8f23eeae0529d3c1022ee3e95a608a1" + integrity sha512-j9HmL1l8k7EVJ3eOM5y8COF93gqrydpxCDoz23ZEtsY+JHY77VAiRQsmqBgEx9GGA2dXi9VEdS67B0+1vKariw== + +"@nx/nx-darwin-x64@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-darwin-x64/-/nx-darwin-x64-16.5.2.tgz#6b03c1f4569411db7f8f90df90c820b083bde65f" + integrity sha512-m354qmKrv7a5eD9Qv8bGEmrLCBEyCS6/y0PyOR32Dmi7qwlgHsQ4FfVkOnlWefC5ednhFLJQT6yxwhg8cFGDxw== + +"@nx/nx-freebsd-x64@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-freebsd-x64/-/nx-freebsd-x64-16.5.1.tgz#b4303ac5066f5c8ced7768097d6c85e8055c7d3a" + integrity sha512-CXSPT01aVS869tvCCF2tZ7LnCa8l41wJ3mTVtWBkjmRde68E5Up093hklRMyXb3kfiDYlfIKWGwrV4r0eH6x1A== + +"@nx/nx-freebsd-x64@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-freebsd-x64/-/nx-freebsd-x64-16.5.2.tgz#931e8be5c70d87b87f17d8faf0b9089383df0505" + integrity sha512-qrR9yxcC2BLnw9JulecILmyp6Jco9unHHzQcfhLZTpw5c1PNHmZzHwJ3i3iNEf1o2kXEIa+SlOCis9ndvNQQVA== + +"@nx/nx-linux-arm-gnueabihf@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-16.5.1.tgz#4dde9e8c79da9c5a213b6938dff74f65dd79c157" + integrity sha512-BhrumqJSZCWFfLFUKl4CAUwR0Y0G2H5EfFVGKivVecEQbb+INAek1aa6c89evg2/OvetQYsJ+51QknskwqvLsA== + +"@nx/nx-linux-arm-gnueabihf@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm-gnueabihf/-/nx-linux-arm-gnueabihf-16.5.2.tgz#d9d865f99ba1128f6aa5b6bf0887bb743590eeb6" + integrity sha512-+I1Oj54caDymMsQuRu/l4ULS4RVvwDUM1nXey5JhWulDOUF//09Ckz03Q9p0NCnvBvQd3SyE65++PMfZrrurbA== + +"@nx/nx-linux-arm64-gnu@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-16.5.1.tgz#43dcdbd9b39fa91923ab949d161aa25c650f56d9" + integrity sha512-x7MsSG0W+X43WVv7JhiSq2eKvH2suNKdlUHEG09Yt0vm3z0bhtym1UCMUg3IUAK7jy9hhLeDaFVFkC6zo+H/XQ== + +"@nx/nx-linux-arm64-gnu@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-gnu/-/nx-linux-arm64-gnu-16.5.2.tgz#c442df598108776cce297561555520ffbce251ea" + integrity sha512-4Q4jpgtNBTb4lMegFKS9hkzS/WttH3MxkgM//8qs1zhgUz/AsuXTitBo71E3xCnQl/i38p0eIpiKXXwBJeHgDw== + +"@nx/nx-linux-arm64-musl@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-16.5.1.tgz#fc33960cecb0064c3dd3330f393e3a38be8a71b7" + integrity sha512-J+/v/mFjOm74I0PNtH5Ka+fDd+/dWbKhpcZ2R1/6b9agzZk+Ff/SrwJcSYFXXWKbPX+uQ4RcJoytT06Zs3s0ow== + +"@nx/nx-linux-arm64-musl@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-arm64-musl/-/nx-linux-arm64-musl-16.5.2.tgz#e07c0031f60372e726d2272fac5f3743c4d9591c" + integrity sha512-VLukS/pfenr/Qw/EUn3GPAREDVXuSmfKeYBQKkALXEK6cRVQhXFXMLGHgMemCYbpoUJyFtFEO94PKV7VU7wZPg== + +"@nx/nx-linux-x64-gnu@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-16.5.1.tgz#2b2ffbb80e29455b6900ec20d4249055590dc58f" + integrity sha512-igooWJ5YxQ94Zft7IqgL+Lw0qHaY15Btw4gfK756g/YTYLZEt4tTvR1y6RnK/wdpE3sa68bFTLVBNCGTyiTiDQ== + +"@nx/nx-linux-x64-gnu@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-gnu/-/nx-linux-x64-gnu-16.5.2.tgz#0748beae6944b42276f4705bc41b9e06cefb1d55" + integrity sha512-TAGmY+MXbNl/aGg2KMvtg53rbmX0XHwnJRQtjhjqjAyvaOfFWI/WOqTU7xf/QCkXBUIK0D9xHWpALfA/fZFCBA== + +"@nx/nx-linux-x64-musl@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-16.5.1.tgz#955b2eae615ee6cf1954e24d42c205b1de8772bf" + integrity sha512-zF/exnPqFYbrLAduGhTmZ7zNEyADid2bzNQiIjJkh8Y6NpDwrQIwVIyvIxqynsjMrIs51kBH+8TUjKjj2Jgf5A== + +"@nx/nx-linux-x64-musl@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-linux-x64-musl/-/nx-linux-x64-musl-16.5.2.tgz#7b150081e21ba7aa0da511f80aae1c5d230d1664" + integrity sha512-YyWmqcNbZgU76+LThAt+0arx9C2ewfI5UUI6kooZRniAd408EA2xl5fx2AWLLrISGH4nTb5p20HGmeWfGqjHPA== + +"@nx/nx-win32-arm64-msvc@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-16.5.1.tgz#1dc4a7e3662eb757214c46d8db432f61e43a3dd9" + integrity sha512-qtqiLS9Y9TYyAbbpq58kRoOroko4ZXg5oWVqIWFHoxc5bGPweQSJCROEqd1AOl2ZDC6BxfuVHfhDDop1kK05WA== + +"@nx/nx-win32-arm64-msvc@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-win32-arm64-msvc/-/nx-win32-arm64-msvc-16.5.2.tgz#f06f74b876c92d6b12cd351baff016b18bfd9a73" + integrity sha512-pl7LluCc/57kl9VZ1ES27ym16ps4zgfCIeJiF8Ne8C6ALgt7C3PEG6417sFqbQw5J7NhsZ1aTb3eJ9fa9hurhA== + +"@nx/nx-win32-x64-msvc@16.5.1": + version "16.5.1" + resolved "https://registry.yarnpkg.com/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-16.5.1.tgz#d2f4a1b2bf675bceb6fb16174b836438293f9dca" + integrity sha512-kUJBLakK7iyA9WfsGGQBVennA4jwf5XIgm0lu35oMOphtZIluvzItMt0EYBmylEROpmpEIhHq0P6J9FA+WH0Rg== + +"@nx/nx-win32-x64-msvc@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/nx-win32-x64-msvc/-/nx-win32-x64-msvc-16.5.2.tgz#6ae96b6a90924daba81350863da4f9d12884fe8e" + integrity sha512-bKSMElhzP37MkzWQ/Y12pQlesZ6TxwOOqwoaK/vHe6ZtxPxvG2+U8tQ21Nw5L3KyrDCnU5MJHGFtQVHHHt5MwA== + +"@nx/workspace@16.5.2": + version "16.5.2" + resolved "https://registry.yarnpkg.com/@nx/workspace/-/workspace-16.5.2.tgz#7d8b84550c51bc3bebc2e6e701fd41a5995fcbca" + integrity sha512-j+EUQW0q2AtYmd1lWxnVJzzGHWbHbdjkV4b6VYG839CaK0+mWZ/t4EYzpGn7m4WU8rmyxh9YwU8uAl2nvc1JaQ== + dependencies: + "@nrwl/workspace" "16.5.2" + "@nx/devkit" "16.5.2" "@parcel/watcher" "2.0.4" chalk "^4.1.0" chokidar "^3.5.1" @@ -2900,19 +3061,24 @@ dotenv "~10.0.0" figures "3.2.0" flat "^5.0.2" - glob "7.1.4" ignore "^5.0.4" minimatch "3.0.5" npm-run-path "^4.0.1" - nx "15.7.2" + nx "16.5.2" open "^8.4.0" - rxjs "^6.5.4" - semver "7.3.4" + rxjs "^7.8.0" tmp "~0.2.1" tslib "^2.3.0" yargs "^17.6.2" yargs-parser "21.1.1" +"@octokit/auth-token@^2.4.4": + version "2.5.0" + resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.5.0.tgz#27c37ea26c205f28443402477ffd261311f21e36" + integrity sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g== + dependencies: + "@octokit/types" "^6.0.3" + "@octokit/auth-token@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-3.0.0.tgz#6f22c5fc56445c496628488ba6810131558fa4a9" @@ -2920,19 +3086,41 @@ dependencies: "@octokit/types" "^6.0.3" -"@octokit/core@^4.0.0": - version "4.0.4" - resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.0.4.tgz#335d9b377691e3264ce57a9e5a1f6cda783e5838" - integrity sha512-sUpR/hc4Gc7K34o60bWC7WUH6Q7T6ftZ2dUmepSyJr9PRF76/qqkWjE2SOEzCqLA5W83SaISymwKtxks+96hPQ== +"@octokit/core@^3.6.0": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.6.0.tgz#3376cb9f3008d9b3d110370d90e0a1fcd5fe6085" + integrity sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q== + dependencies: + "@octokit/auth-token" "^2.4.4" + "@octokit/graphql" "^4.5.8" + "@octokit/request" "^5.6.3" + "@octokit/request-error" "^2.0.5" + "@octokit/types" "^6.0.3" + before-after-hook "^2.2.0" + universal-user-agent "^6.0.0" + +"@octokit/core@^4.2.1": + version "4.2.4" + resolved "https://registry.yarnpkg.com/@octokit/core/-/core-4.2.4.tgz#d8769ec2b43ff37cc3ea89ec4681a20ba58ef907" + integrity sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ== dependencies: "@octokit/auth-token" "^3.0.0" "@octokit/graphql" "^5.0.0" "@octokit/request" "^6.0.0" "@octokit/request-error" "^3.0.0" - "@octokit/types" "^6.0.3" + "@octokit/types" "^9.0.0" before-after-hook "^2.2.0" universal-user-agent "^6.0.0" +"@octokit/endpoint@^6.0.1": + version "6.0.12" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-6.0.12.tgz#3b4d47a4b0e79b1027fb8d75d4221928b2d05658" + integrity sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA== + dependencies: + "@octokit/types" "^6.0.3" + is-plain-object "^5.0.0" + universal-user-agent "^6.0.0" + "@octokit/endpoint@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-7.0.0.tgz#be758a1236d68d6bbb505e686dd50881c327a519" @@ -2942,6 +3130,15 @@ is-plain-object "^5.0.0" universal-user-agent "^6.0.0" +"@octokit/graphql@^4.5.8": + version "4.8.0" + resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.8.0.tgz#664d9b11c0e12112cbf78e10f49a05959aa22cc3" + integrity sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg== + dependencies: + "@octokit/request" "^5.6.0" + "@octokit/types" "^6.0.3" + universal-user-agent "^6.0.0" + "@octokit/graphql@^5.0.0": version "5.0.0" resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-5.0.0.tgz#2cc6eb3bf8e0278656df1a7d0ca0d7591599e3b3" @@ -2956,31 +3153,60 @@ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-12.10.1.tgz#57b5cc6c7b4e55d8642c93d06401fb1af4839899" integrity sha512-P+SukKanjFY0ZhsK6wSVnQmxTP2eVPPE8OPSNuxaMYtgVzwJZgfGdwlYjf4RlRU4vLEw4ts2fsE2icG4nZ5ddQ== +"@octokit/openapi-types@^18.0.0": + version "18.0.0" + resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-18.0.0.tgz#f43d765b3c7533fd6fb88f3f25df079c24fccf69" + integrity sha512-V8GImKs3TeQRxRtXFpG2wl19V7444NIOTDF24AWuIbmNaNYOQMWRbjcGDXV5B+0n887fgDcuMNOmlul+k+oJtw== + "@octokit/plugin-enterprise-rest@6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/@octokit/plugin-enterprise-rest/-/plugin-enterprise-rest-6.0.1.tgz#e07896739618dab8da7d4077c658003775f95437" integrity sha512-93uGjlhUD+iNg1iWhUENAtJata6w5nE+V4urXOAlIXdco6xNZtUSfYY8dzp3Udy74aqO/B5UZL80x/YMa5PKRw== -"@octokit/plugin-paginate-rest@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-3.0.0.tgz#df779de686aeb21b5e776e4318defc33b0418566" - integrity sha512-fvw0Q5IXnn60D32sKeLIxgXCEZ7BTSAjJd8cFAE6QU5qUp0xo7LjFUjjX1J5D7HgN355CN4EXE4+Q1/96JaNUA== +"@octokit/plugin-paginate-rest@^2.17.0": + version "2.21.3" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz#7f12532797775640dbb8224da577da7dc210c87e" + integrity sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw== dependencies: - "@octokit/types" "^6.39.0" + "@octokit/types" "^6.40.0" + +"@octokit/plugin-paginate-rest@^6.1.2": + version "6.1.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-6.1.2.tgz#f86456a7a1fe9e58fec6385a85cf1b34072341f8" + integrity sha512-qhrmtQeHU/IivxucOV1bbI/xZyC/iOBhclokv7Sut5vnejAIAEXVcGQeRpQlU39E0WwK9lNvJHphHri/DB6lbQ== + dependencies: + "@octokit/tsconfig" "^1.0.2" + "@octokit/types" "^9.2.3" "@octokit/plugin-request-log@^1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz#5e50ed7083a613816b1e4a28aeec5fb7f1462e85" integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== -"@octokit/plugin-rest-endpoint-methods@^6.0.0": - version "6.1.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-6.1.2.tgz#bbf55cfc43acf177514441ecd1d26031006f73ed" - integrity sha512-sAfSKtLHNq0UQ2iFuI41I6m5SK6bnKFRJ5kUjDRVbmQXiRVi4aQiIcgG4cM7bt+bhSiWL4HwnTxDkWFlKeKClA== +"@octokit/plugin-rest-endpoint-methods@^5.13.0": + version "5.16.2" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz#7ee8bf586df97dd6868cf68f641354e908c25342" + integrity sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw== dependencies: - "@octokit/types" "^6.40.0" + "@octokit/types" "^6.39.0" deprecation "^2.3.1" +"@octokit/plugin-rest-endpoint-methods@^7.1.2": + version "7.2.3" + resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-7.2.3.tgz#37a84b171a6cb6658816c82c4082ac3512021797" + integrity sha512-I5Gml6kTAkzVlN7KCtjOM+Ruwe/rQppp0QU372K1GP7kNOYEKe8Xn5BW4sE62JAHdwpq95OQK/qGNyKQMUzVgA== + dependencies: + "@octokit/types" "^10.0.0" + +"@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.1.0.tgz#9e150357831bfc788d13a4fd4b1913d60c74d677" + integrity sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg== + dependencies: + "@octokit/types" "^6.0.3" + deprecation "^2.0.0" + once "^1.4.0" + "@octokit/request-error@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-3.0.0.tgz#f527d178f115a3b62d76ce4804dd5bdbc0270a81" @@ -2990,6 +3216,18 @@ deprecation "^2.0.0" once "^1.4.0" +"@octokit/request@^5.6.0", "@octokit/request@^5.6.3": + version "5.6.3" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.6.3.tgz#19a022515a5bba965ac06c9d1334514eb50c48b0" + integrity sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A== + dependencies: + "@octokit/endpoint" "^6.0.1" + "@octokit/request-error" "^2.1.0" + "@octokit/types" "^6.16.1" + is-plain-object "^5.0.0" + node-fetch "^2.6.7" + universal-user-agent "^6.0.0" + "@octokit/request@^6.0.0": version "6.2.0" resolved "https://registry.yarnpkg.com/@octokit/request/-/request-6.2.0.tgz#9c25606df84e6f2ccbcc2c58e1d35438e20b688b" @@ -3002,15 +3240,27 @@ node-fetch "^2.6.7" universal-user-agent "^6.0.0" -"@octokit/rest@19.0.3": - version "19.0.3" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-19.0.3.tgz#b9a4e8dc8d53e030d611c053153ee6045f080f02" - integrity sha512-5arkTsnnRT7/sbI4fqgSJ35KiFaN7zQm0uQiQtivNQLI8RQx8EHwJCajcTUwmaCMNDg7tdCvqAnc7uvHHPxrtQ== +"@octokit/rest@19.0.11": + version "19.0.11" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-19.0.11.tgz#2ae01634fed4bd1fca5b642767205ed3fd36177c" + integrity sha512-m2a9VhaP5/tUw8FwfnW2ICXlXpLPIqxtg3XcAiGMLj/Xhw3RSBfZ8le/466ktO1Gcjr8oXudGnHhxV1TXJgFxw== dependencies: - "@octokit/core" "^4.0.0" - "@octokit/plugin-paginate-rest" "^3.0.0" + "@octokit/core" "^4.2.1" + "@octokit/plugin-paginate-rest" "^6.1.2" "@octokit/plugin-request-log" "^1.0.4" - "@octokit/plugin-rest-endpoint-methods" "^6.0.0" + "@octokit/plugin-rest-endpoint-methods" "^7.1.2" + +"@octokit/tsconfig@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@octokit/tsconfig/-/tsconfig-1.0.2.tgz#59b024d6f3c0ed82f00d08ead5b3750469125af7" + integrity sha512-I0vDR0rdtP8p2lGMzvsJzbhdOWy405HcGovrspJ8RRibHnyRgggUSNO5AIox5LmqiwmatHKYsvj6VGFHkqS7lA== + +"@octokit/types@^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-10.0.0.tgz#7ee19c464ea4ada306c43f1a45d444000f419a4a" + integrity sha512-Vm8IddVmhCgU1fxC1eyinpwqzXPEYu0NrYzD3YZjlGjyftdLBTeqNblRC0jmJmgxbJIsQlyogVeGnrNaaMVzIg== + dependencies: + "@octokit/openapi-types" "^18.0.0" "@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.39.0", "@octokit/types@^6.40.0": version "6.40.0" @@ -3019,6 +3269,13 @@ dependencies: "@octokit/openapi-types" "^12.10.0" +"@octokit/types@^9.0.0", "@octokit/types@^9.2.3": + version "9.3.2" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-9.3.2.tgz#3f5f89903b69f6a2d196d78ec35f888c0013cac5" + integrity sha512-D4iHGTdAnEEVsB8fl95m1hiz7D5YiRdQ9b/OEb3BYRVwbLsGHcRVPz+u+BgRLNk0Q0/4iZCBqDN96j2XNxfXrA== + dependencies: + "@octokit/openapi-types" "^18.0.0" + "@parcel/watcher@2.0.4": version "2.0.4" resolved "https://registry.yarnpkg.com/@parcel/watcher/-/watcher-2.0.4.tgz#f300fef4cc38008ff4b8c29d92588eced3ce014b" @@ -3027,20 +3284,25 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" -"@phenomnomnominal/tsquery@4.1.1": - version "4.1.1" - resolved "https://registry.yarnpkg.com/@phenomnomnominal/tsquery/-/tsquery-4.1.1.tgz#42971b83590e9d853d024ddb04a18085a36518df" - integrity sha512-jjMmK1tnZbm1Jq5a7fBliM4gQwjxMU7TFoRNwIyzwlO+eHPRCFv/Nv+H/Gi1jc3WR7QURG8D5d0Tn12YGrUqBQ== +"@phenomnomnominal/tsquery@~5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@phenomnomnominal/tsquery/-/tsquery-5.0.1.tgz#a2a5abc89f92c01562a32806655817516653a388" + integrity sha512-3nVv+e2FQwsW8Aw6qTU6f+1rfcJ3hrcnvH/mu9i8YhxO+9sqbOfpL8m6PbET5+xKOlz/VSbp0RoYWYCtIsnmuA== dependencies: - esquery "^1.0.1" + esquery "^1.4.0" + +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== -"@playwright/test@^1.27.1": - version "1.31.2" - resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.31.2.tgz#426d8545143a97a6fed250a2a27aa1c8e5e2548e" - integrity sha512-BYVutxDI4JeZKV1+ups6dt5WiqKhjBtIYowyZIJ3kBDmJgsuPKsqqKNIMFbUePLSCmp2cZu+BDL427RcNKTRYw== +"@playwright/test@^1.36.0": + version "1.36.1" + resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.36.1.tgz#0b1247d279f142ac0876ce25e7daf15439d5367b" + integrity sha512-YK7yGWK0N3C2QInPU6iaf/L3N95dlGdbsezLya4n0ZCh3IL7VgPGxC6Gnznh9ApWdOmkJeleT2kMTcWPRZvzqg== dependencies: "@types/node" "*" - playwright-core "1.31.2" + playwright-core "1.36.1" optionalDependencies: fsevents "2.3.2" @@ -3057,25 +3319,6 @@ "@babel/helper-module-imports" "^7.10.4" "@rollup/pluginutils" "^3.1.0" -"@rollup/plugin-commonjs@^23.0.0": - version "23.0.7" - resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-23.0.7.tgz#7d26d879caa54283086de1974b66f512ef60abdc" - integrity sha512-hsSD5Qzyuat/swzrExGG5l7EuIlPhwTsT7KwKbSCQzIcJWjRxiimi/0tyMYY2bByitNb3i1p+6JWEDGa0NvT0Q== - dependencies: - "@rollup/pluginutils" "^5.0.1" - commondir "^1.0.1" - estree-walker "^2.0.2" - glob "^8.0.3" - is-reference "1.2.1" - magic-string "^0.27.0" - -"@rollup/plugin-json@^5.0.0": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-5.0.2.tgz#d7dbbac62ff74064876b3e5d0d863cb3ad1e7cdb" - integrity sha512-D1CoOT2wPvadWLhVcmpkDnesTzjhNIQRWLsc3fA49IFOP2Y84cFOOJ+nKGYedvXHKUsPeq07HR4hXpBBr+CHlA== - dependencies: - "@rollup/pluginutils" "^5.0.1" - "@rollup/plugin-node-resolve@^11.2.1": version "11.2.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-11.2.1.tgz#82aa59397a29cd4e13248b106e6a4a1880362a60" @@ -3088,18 +3331,6 @@ is-module "^1.0.0" resolve "^1.19.0" -"@rollup/plugin-node-resolve@^15.0.0": - version "15.0.1" - resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.1.tgz#72be449b8e06f6367168d5b3cd5e2802e0248971" - integrity sha512-ReY88T7JhJjeRVbfCyNj+NXAG3IIsVMsX9b5/9jC98dRP8/yxlZdz7mHZbHk5zHr24wZZICS5AcXsFZAXYUQEg== - dependencies: - "@rollup/pluginutils" "^5.0.1" - "@types/resolve" "1.20.2" - deepmerge "^4.2.2" - is-builtin-module "^3.2.0" - is-module "^1.0.0" - resolve "^1.22.1" - "@rollup/plugin-replace@^2.4.1": version "2.4.2" resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz#a2d539314fbc77c244858faa523012825068510a" @@ -3108,15 +3339,6 @@ "@rollup/pluginutils" "^3.1.0" magic-string "^0.25.7" -"@rollup/plugin-terser@^0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@rollup/plugin-terser/-/plugin-terser-0.4.0.tgz#4c76249ad337f3eb04ab409332f23717af2c1fbf" - integrity sha512-Ipcf3LPNerey1q9ZMjiaWHlNPEHNU/B5/uh9zXLltfEQ1lVSLLeZSgAtTPWGyw8Ip1guOeq+mDtdOlEj/wNxQw== - dependencies: - serialize-javascript "^6.0.0" - smob "^0.0.6" - terser "^5.15.1" - "@rollup/pluginutils@^3.1.0": version "3.1.0" resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" @@ -3126,19 +3348,10 @@ estree-walker "^1.0.1" picomatch "^2.2.2" -"@rollup/pluginutils@^5.0.0", "@rollup/pluginutils@^5.0.1": - version "5.0.2" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.0.2.tgz#012b8f53c71e4f6f9cb317e311df1404f56e7a33" - integrity sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA== - dependencies: - "@types/estree" "^1.0.0" - estree-walker "^2.0.2" - picomatch "^2.3.1" - -"@rushstack/node-core-library@3.55.2": - version "3.55.2" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.55.2.tgz#d951470bac98171de13a8a351d4537c63fbfd0b6" - integrity sha512-SaLe/x/Q/uBVdNFK5V1xXvsVps0y7h1sN7aSJllQyFbugyOaxhNRF25bwEDnicARNEjJw0pk0lYnJQ9Kr6ev0A== +"@rushstack/node-core-library@3.59.5": + version "3.59.5" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.59.5.tgz#38034d4c38b5ddd7d1c7f04233ce1b2209b7ae1f" + integrity sha512-1IpV7LufrI1EoVO8hYsb3t6L8L+yp40Sa0OaOV2CIu1zx4e6ZeVNaVIEXFgMXBKdGXkAh21MnCaIzlDNpG6ZQw== dependencies: colors "~1.2.1" fs-extra "~7.0.1" @@ -3148,18 +3361,18 @@ semver "~7.3.0" z-schema "~5.0.2" -"@rushstack/rig-package@0.3.18": - version "0.3.18" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.18.tgz#2b59eb8ed482e8cd6ad8d396414bf3200efdd682" - integrity sha512-SGEwNTwNq9bI3pkdd01yCaH+gAsHqs0uxfGvtw9b0LJXH52qooWXnrFTRRLG1aL9pf+M2CARdrA9HLHJys3jiQ== +"@rushstack/rig-package@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.4.0.tgz#1dade94da5cd81321ca9ec630b6ceed2d57cc826" + integrity sha512-FnM1TQLJYwSiurP6aYSnansprK5l8WUK8VG38CmAaZs29ZeL1msjK0AP1VS4ejD33G0kE/2cpsPsS9jDenBMxw== dependencies: resolve "~1.22.1" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.13.2": - version "4.13.2" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.13.2.tgz#2dfdcf418d58256671433b1da4a3b67e1814cc7a" - integrity sha512-bCU8qoL9HyWiciltfzg7GqdfODUeda/JpI0602kbN5YH22rzTxyqYvv7aRLENCM7XCQ1VRs7nMkEqgJUOU8Sag== +"@rushstack/ts-command-line@4.15.1": + version "4.15.1" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.15.1.tgz#8f2ebde6bb19deb2c5b65363854b84aea1bf59f0" + integrity sha512-EL4jxZe5fhb1uVL/P/wQO+Z8Rc8FMiWJ1G7VgnPDvdIt5GVjRfK7vwzder1CZQiX3x0PY6uxENYLNGTFd1InRQ== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -3183,16 +3396,37 @@ resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== -"@sinclair/typebox@^0.25.16": - version "0.25.24" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" - integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ== +"@sigstore/protobuf-specs@^0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@sigstore/protobuf-specs/-/protobuf-specs-0.1.0.tgz#957cb64ea2f5ce527cc9cf02a096baeb0d2b99b4" + integrity sha512-a31EnjuIDSX8IXBUib3cYLDRlPMU36AWX4xS8ysLaNu4ZzUesDiPt83pgrW2X1YLMe5L2HbDyaKK5BrL4cNKaQ== + +"@sigstore/tuf@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@sigstore/tuf/-/tuf-1.0.0.tgz#13b69323e7bf8de458cd6c952c57acd1169772a5" + integrity sha512-bLzi9GeZgMCvjJeLUIfs8LJYCxrPRA8IXQkzUtaFKKVPTz0mucRyqFcV2U20yg9K+kYAD0YSitzGfRZCFLjdHQ== + dependencies: + "@sigstore/protobuf-specs" "^0.1.0" + make-fetch-happen "^11.0.1" + tuf-js "^1.1.3" + +"@sinclair/typebox@^0.27.8": + version "0.27.8" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== "@sindresorhus/is@^0.14.0": version "0.14.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea" integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ== +"@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.3": + version "1.8.6" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" + integrity sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ== + dependencies: + type-detect "4.0.8" + "@sinonjs/commons@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3" @@ -3207,6 +3441,27 @@ dependencies: "@sinonjs/commons" "^2.0.0" +"@sinonjs/fake-timers@^7.1.2": + version "7.1.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz#2524eae70c4910edccf99b2f4e6efc5894aff7b5" + integrity sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg== + dependencies: + "@sinonjs/commons" "^1.7.0" + +"@sinonjs/samsam@^6.0.2": + version "6.1.3" + resolved "https://registry.yarnpkg.com/@sinonjs/samsam/-/samsam-6.1.3.tgz#4e30bcd4700336363302a7d72cbec9b9ab87b104" + integrity sha512-nhOb2dWPeb1sd3IQXL/dVPnKHDOAFfvichtBf4xV00/rU1QbPCQqKMbvIheIjqwVjh7qIgf2AHTHi391yMOMpQ== + dependencies: + "@sinonjs/commons" "^1.6.0" + lodash.get "^4.4.2" + type-detect "^4.0.8" + +"@sinonjs/text-encoding@^0.7.1": + version "0.7.2" + resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz#5981a8db18b56ba38ef0efb7d995b12aa7b51918" + integrity sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ== + "@slorber/static-site-generator-webpack-plugin@^4.0.7": version "4.0.7" resolved "https://registry.yarnpkg.com/@slorber/static-site-generator-webpack-plugin/-/static-site-generator-webpack-plugin-4.0.7.tgz#fc1678bddefab014e2145cbe25b3ce4e1cfc36f3" @@ -3330,56 +3585,103 @@ "@svgr/plugin-jsx" "^6.2.1" "@svgr/plugin-svgo" "^6.2.0" -"@swc/core-android-arm-eabi@npm:dummypkg-a@1.0.0", "@swc/core-android-arm64@npm:dummypkg-a@1.0.0", "@swc/core-freebsd-x64@npm:dummypkg-a@1.0.0", "@swc/core-linux-arm-gnueabihf@1.3.41", "@swc/core-linux-arm-gnueabihf@npm:dummypkg-a@1.0.0", "@swc/core-linux-arm64-gnu@1.3.41", "@swc/core-linux-arm64-gnu@npm:dummypkg-a@1.0.0", "@swc/core-linux-arm64-musl@1.3.41", "@swc/core-linux-arm64-musl@npm:dummypkg-a@1.0.0", "@swc/core-win32-arm64-msvc@1.3.41", "@swc/core-win32-arm64-msvc@npm:dummypkg-a@1.0.0", "@swc/core-win32-ia32-msvc@1.3.41", "@swc/core-win32-ia32-msvc@npm:dummypkg-a@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/dummypkg-a/-/dummypkg-a-1.0.0.tgz#02868251461af84d70603446ef5908b72c5c8435" - integrity sha512-V9qLfUzVlmSW/ayzlchss1XjAqWXqHmJtzGwnfg/jsnloIUyLKR5a0Djfdgj/Jv3yoNAljIUaelTVjptxtTyGA== - -"@swc/core-darwin-arm64@1.3.41": - version "1.3.41" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.41.tgz#c8ec25fb3171e1e53546d0fbf4044c33d5ab42c5" - integrity sha512-D4fybODToO/BvuP35bionDUrSuTVVr8eW+mApr1unOqb3mfiqOrVv0VP2fpWNRYiA+xMq+oBCB6KcGpL60HKWQ== - -"@swc/core-darwin-x64@1.3.41": - version "1.3.41" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.41.tgz#0f9d7077762f4274d50a8ef76a56b76096a8f0ff" - integrity sha512-0RoVyiPCnylf3TG77C3S86PRSmaq+SaYB4VDLJFz3qcEHz1pfP0LhyskhgX4wjQV1mveDzFEn1BVAuo0eOMwZA== - -"@swc/core-linux-x64-gnu@1.3.41": - version "1.3.41" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.41.tgz#5b2bf83493e6fa0a58c3fb1815b9e59b923e300f" - integrity sha512-h4sv1sCfZQgRIwmykz8WPqVpbvHb13Qm3SsrbOudhAp2MuzpWzsgMP5hAEpdCP/nWreiCz3aoM6L8JeakRDq0g== - -"@swc/core-linux-x64-musl@1.3.41": - version "1.3.41" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.41.tgz#146547ea3e62466ca971d71ebcc4cfeed3008bda" - integrity sha512-Z7c26i38378d0NT/dcz8qPSAXm41lqhNzykdhKhI+95mA9m4pskP18T/0I45rmyx1ywifypu+Ip+SXmKeVSPgQ== - -"@swc/core-win32-x64-msvc@1.3.41": - version "1.3.41" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.41.tgz#a8d766fc7a68752a3060276a90b7328d9f266631" - integrity sha512-Mfp8qD1hNwWWRy0ISdwQJu1g0UYoVTtuQlO0z3aGbXqL51ew9e56+8j3M1U9i95lXFyWkARgjDCcKkQi+WezyA== - -"@swc/core@^1.3.1": - version "1.3.41" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.41.tgz#8f10559db269da1a5df9863c92653f8afd0bd7c1" - integrity sha512-v6P2dfqJDpZ/7RXPvWge9oI6YgolDM0jtNhQZ2qdXrLBzaWQdDoBGBTJ8KN/nTgGhX3IkNvSB1fafXQ+nVnqAQ== +"@swc/core-android-arm-eabi@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-android-arm64@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-darwin-arm64@1.3.69": + version "1.3.69" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.69.tgz#e22032471244ec80c22bee8efc2100e456bb9488" + integrity sha512-IjZTf12zIPWkV3D7toaLDoJPSkLhQ4fDH8G6/yCJUI27cBFOI3L8LXqptYmISoN5yYdrcnNpdqdapD09JPuNJg== + +"@swc/core-darwin-x64@1.3.69": + version "1.3.69" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.69.tgz#4c2034ba409b9e061b9e8ad56a762b8bb7815f18" + integrity sha512-/wBO0Rn5oS5dJI/L9kJRkPAdksVwl5H9nleW/NM3A40N98VV8T7h/i1nO051mxIjq0R6qXVGOWFbBoLrPYucJg== + +"@swc/core-freebsd-x64@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-linux-arm-gnueabihf@1.3.69": + version "0.0.0" + uid "" + +"@swc/core-linux-arm-gnueabihf@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-linux-arm64-gnu@1.3.69": + version "0.0.0" + uid "" + +"@swc/core-linux-arm64-gnu@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-linux-arm64-musl@1.3.69": + version "0.0.0" + uid "" + +"@swc/core-linux-arm64-musl@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-linux-x64-gnu@1.3.69": + version "1.3.69" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.69.tgz#6879057d28f261b051fac52daca6c256f3a7fb7d" + integrity sha512-b+DUlVxYox3BwD3PyTwhLvqtu6TYZtW+S6O0FnttH11o4skHN0XyJ/cUZSI0X2biSmfDsizRDUt1PWPFM+F7SA== + +"@swc/core-linux-x64-musl@1.3.69": + version "1.3.69" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.69.tgz#bf4f9a74156524211472bb713d34f0bb7265669f" + integrity sha512-QXjsI+f8n9XPZHUvmGgkABpzN4M9kdSbhqBOZmv3o0AsDGNCA4uVowQqgZoPFAqlJTpwHeDmrv5sQ13HN+LOGw== + +"@swc/core-win32-arm64-msvc@1.3.69": + version "0.0.0" + uid "" + +"@swc/core-win32-arm64-msvc@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-win32-ia32-msvc@1.3.69": + version "0.0.0" + uid "" + +"@swc/core-win32-ia32-msvc@link:./tools/dummypkg": + version "0.0.0" + uid "" + +"@swc/core-win32-x64-msvc@1.3.69": + version "1.3.69" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.69.tgz#304e1050d59bae21215a15839b05668d48a92837" + integrity sha512-ieBscU0gUgKjaseFI07tAaGqHvKyweNknPeSYEZOasVZUczhD6fK2GRnVREhv2RB2qdKC/VGFBsgRDMgzq1VLw== + +"@swc/core@^1.3.68": + version "1.3.69" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.69.tgz#b4a41e84de11832c233fbe714c6e412d8404bab0" + integrity sha512-Khc/DE9D5+2tYTHgAIp5DZARbs8kldWg3b0Jp6l8FQLjelcLFmlQWSwKhVZrgv4oIbgZydIp8jInsvTalMHqnQ== optionalDependencies: - "@swc/core-darwin-arm64" "1.3.41" - "@swc/core-darwin-x64" "1.3.41" - "@swc/core-linux-arm-gnueabihf" "1.3.41" - "@swc/core-linux-arm64-gnu" "1.3.41" - "@swc/core-linux-arm64-musl" "1.3.41" - "@swc/core-linux-x64-gnu" "1.3.41" - "@swc/core-linux-x64-musl" "1.3.41" - "@swc/core-win32-arm64-msvc" "1.3.41" - "@swc/core-win32-ia32-msvc" "1.3.41" - "@swc/core-win32-x64-msvc" "1.3.41" - -"@swc/jest@^0.2.21": - version "0.2.24" - resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.24.tgz#35d9377ede049613cd5fdd6c24af2b8dcf622875" - integrity sha512-fwgxQbM1wXzyKzl1+IW0aGrRvAA8k0Y3NxFhKigbPjOJ4mCKnWEcNX9HQS3gshflcxq8YKhadabGUVfdwjCr6Q== + "@swc/core-darwin-arm64" "1.3.69" + "@swc/core-darwin-x64" "1.3.69" + "@swc/core-linux-arm-gnueabihf" "1.3.69" + "@swc/core-linux-arm64-gnu" "1.3.69" + "@swc/core-linux-arm64-musl" "1.3.69" + "@swc/core-linux-x64-gnu" "1.3.69" + "@swc/core-linux-x64-musl" "1.3.69" + "@swc/core-win32-arm64-msvc" "1.3.69" + "@swc/core-win32-ia32-msvc" "1.3.69" + "@swc/core-win32-x64-msvc" "1.3.69" + +"@swc/jest@^0.2.26": + version "0.2.26" + resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.26.tgz#6ef2d6d31869e3aaddc132603bc21f2e4c57cc5d" + integrity sha512-7lAi7q7ShTO3E5Gt1Xqf3pIhRbERxR1DUxvtVa9WKzIB+HGQ7wZP5sYx86zqnaEoKKGhmOoZ7gyW0IRu8Br5+A== dependencies: "@jest/create-cache-key-function" "^27.4.2" jsonc-parser "^3.2.0" @@ -3421,20 +3723,33 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== +"@tufjs/canonical-json@1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz#eade9fd1f537993bc1f0949f3aea276ecc4fab31" + integrity sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ== + +"@tufjs/models@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tufjs/models/-/models-1.0.4.tgz#5a689630f6b9dbda338d4b208019336562f176ef" + integrity sha512-qaGV9ltJP0EO25YfFUPhxRVK0evXFIAGicsVXuRim4Ed9cjPxYhNnNJ49SFmbeLgtxpslIkX317IgpfcHPVj/A== + dependencies: + "@tufjs/canonical-json" "1.0.0" + minimatch "^9.0.0" + "@types/argparse@1.0.38": version "1.0.38" resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== -"@types/babel__code-frame@*", "@types/babel__code-frame@^7.0.3": +"@types/babel__code-frame@^7.0.3": version "7.0.3" resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz#eda94e1b7c9326700a4b69c485ebbc9498a0b63f" integrity sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw== -"@types/babel__core@*", "@types/babel__core@^7.1.14": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.0.tgz#61bc5a4cae505ce98e1e36c5445e4bee060d8891" - integrity sha512-+n8dL/9GWblDO0iU6eZAwEIJVr5DWigtle+Q6HLOrh/pdbXOhOtqzq8VPPE2zvNJzSKY4vH/z3iT3tn0A3ypiQ== +"@types/babel__core@^7.1.14", "@types/babel__core@^7.20.1": + version "7.20.1" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b" + integrity sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw== dependencies: "@babel/parser" "^7.20.7" "@babel/types" "^7.20.7" @@ -3494,55 +3809,43 @@ dependencies: "@types/node" "*" -"@types/debug@*", "@types/debug@^4.1.7": - version "4.1.7" - resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.7.tgz#7cc0ea761509124709b8b2d1090d8f6c17aadb82" - integrity sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg== +"@types/debug@*", "@types/debug@^4.1.8": + version "4.1.8" + resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.8.tgz#cef723a5d0a90990313faec2d1e22aee5eecb317" + integrity sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ== dependencies: "@types/ms" "*" "@types/eslint-scope@^3.7.3": - version "3.7.3" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.3.tgz#125b88504b61e3c8bc6f870882003253005c3224" - integrity sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" + version "0.0.0" + uid "" -"@types/eslint-visitor-keys@*", "@types/eslint-visitor-keys@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" - integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== - -"@types/eslint@*": - version "7.28.2" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.28.2.tgz#0ff2947cdd305897c52d5372294e8c76f351db68" - integrity sha512-KubbADPkfoU75KgKeKLsFHXnU4ipH7wYg0TRT33NK3N3yiu7jlFAAoygIWBV+KbuHx/G+AvuGX6DllnK35gfJA== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" +"@types/eslint-scope@link:./tools/dummypkg": + version "0.0.0" + uid "" -"@types/esquery@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@types/esquery/-/esquery-1.0.2.tgz#ccab4b6bd1aec356d5daa5b3abc55eac703c332d" - integrity sha512-qeAoHiWfqF4ST6An3DM2r1743bWL7B5hW4oNR9tWkdOjFUR1aK2j0jnYvW6h30VGDeXQ+1bWOYTej4JVo/5+PA== +"@types/eslint-visitor-keys@*": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#8a2482cdf6c3f0c36310dd1b010ec9a1eec2dd3c" + integrity sha512-Occsmzv0PEJYna7gJdHg28/LNm/Ur+ivQRqvN12bfUiAuNKtUzMzGl/nzc59IJfjRbng4eul/0mEYyMDpaWKBw== dependencies: - "@types/estree" "*" + eslint-visitor-keys "*" -"@types/estree@*", "@types/estree@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" - integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== +"@types/eslint@link:./tools/dummypkg": + version "0.0.0" + uid "" "@types/estree@0.0.39": - version "0.0.39" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" - integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + version "0.0.0" + uid "" -"@types/estree@^0.0.51": - version "0.0.51" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.51.tgz#cfd70924a25a3fd32b218e5e420e6897e1ac4f40" - integrity sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ== +"@types/estree@^1.0.0": + version "0.0.0" + uid "" + +"@types/estree@link:./tools/dummypkg": + version "0.0.0" + uid "" "@types/express-serve-static-core@*", "@types/express-serve-static-core@^4.17.18": version "4.17.28" @@ -3563,7 +3866,7 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/glob@*", "@types/glob@^8.0.0": +"@types/glob@*": version "8.1.0" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.1.0.tgz#b63e70155391b0584dce44e7ea25190bbc38f2fc" integrity sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w== @@ -3571,14 +3874,6 @@ "@types/minimatch" "^5.1.2" "@types/node" "*" -"@types/glob@^7.1.3": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.2.0.tgz#bc1b5bf3aa92f25bd5dd39f35c57361bdce5b2eb" - integrity sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - "@types/graceful-fs@^4.1.3": version "4.1.6" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae" @@ -3610,7 +3905,7 @@ dependencies: "@types/node" "*" -"@types/is-glob@*", "@types/is-glob@^4.0.2": +"@types/is-glob@^4.0.2": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/is-glob/-/is-glob-4.0.2.tgz#c243dd0d09eac2992130142419ff2308ffd988bf" integrity sha512-4j5G9Y5jljDSICQ1R2f/Rcyoj6DZmYGneny+p/cDkjep0rkqNg0W73Ty0bVjMUTZgLXHf8oiMjg1XC3CDwCz+g== @@ -3634,45 +3929,52 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest-specific-snapshot@^0.5.5": +"@types/jest-specific-snapshot@^0.5.6": version "0.5.6" resolved "https://registry.yarnpkg.com/@types/jest-specific-snapshot/-/jest-specific-snapshot-0.5.6.tgz#ce47102408981649a6fb1a57ee8062adb5591eac" integrity sha512-AQdUbEyTwO6JR2yZK7PTXDzK32AlkviDZJZEukZnrZtBjITYBtExFh59HTNTZeFSs+k1b1bqCHmWUwj3VHeh/A== dependencies: "@types/jest" "*" -"@types/jest@*", "@types/jest@^29.0.2": - version "29.1.1" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.1.1.tgz#cf21a0835a1ba9a30ea1966019f1261c6a114c92" - integrity sha512-U9Ey07dGWl6fUFaIaUQUKWG5NoKi/zizeVQCGV8s4nSU0jPgqphVZvS64+8BtWYvrc3ZGw6wo943NSYPxkrp/g== +"@types/jest@*", "@types/jest@29.5.3": + version "29.5.3" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.3.tgz#7a35dc0044ffb8b56325c6802a4781a626b05777" + integrity sha512-1Nq7YrO/vJE/FYnqYyw0FS8LdrjExSgIiHyKg7xPpn+yi8Q4huZryKnkJatN1ZRH89Kw2v33/8ZMB7DuZeSLlA== dependencies: expect "^29.0.0" pretty-format "^29.0.0" -"@types/json-schema@*", "@types/json-schema@^7.0.11", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.6", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": - version "7.0.11" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" - integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== +"@types/json-schema@^7.0.12", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": + version "7.0.12" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb" + integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== -"@types/lodash@*", "@types/lodash@^4.14.182": - version "4.14.191" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.191.tgz#09511e7f7cba275acd8b419ddac8da9a6a79e2fa" - integrity sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ== +"@types/lodash.merge@4.6.7": + version "4.6.7" + resolved "https://registry.yarnpkg.com/@types/lodash.merge/-/lodash.merge-4.6.7.tgz#0af6555dd8bc6568ef73e5e0d820a027362946b1" + integrity sha512-OwxUJ9E50gw3LnAefSHJPHaBLGEKmQBQ7CZe/xflHkyy/wH2zVyEIAKReHvVrrn7zKdF58p16We9kMfh7v0RRQ== + dependencies: + "@types/lodash" "*" + +"@types/lodash@*": + version "4.14.192" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.192.tgz#5790406361a2852d332d41635d927f1600811285" + integrity sha512-km+Vyn3BYm5ytMO13k9KTp27O75rbQ0NFw+U//g+PX7VZyjCioXaRFisqSIJRECljcTv73G3i6BpglNGHgUQ5A== -"@types/marked@*", "@types/marked@^4.0.3": - version "4.0.8" - resolved "https://registry.yarnpkg.com/@types/marked/-/marked-4.0.8.tgz#b316887ab3499d0a8f4c70b7bd8508f92d477955" - integrity sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw== +"@types/marked@*", "@types/marked@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@types/marked/-/marked-5.0.0.tgz#3235b9133054e6586eedabfb77aa7d4a4bafbfcf" + integrity sha512-YcZe50jhltsCq7rc9MNZC/4QB/OnA2Pd6hrOSTOFajtabN+38slqgDDCeE/0F83SjkKBQcsZUj7VLWR0H5cKRA== "@types/mdast@^3.0.0": - version "3.0.10" - resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.10.tgz#4724244a82a4598884cbbe9bcfd73dff927ee8af" - integrity sha512-W864tg/Osz1+9f4lrGTZpCSO5/z4608eUp19tbozkq2HJK6i3z1kT0H9tlADXuYIb1YYOBByU4Jsqkk75q48qA== + version "3.0.11" + resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.11.tgz#dc130f7e7d9306124286f6d6cee40cf4d14a3dc0" + integrity sha512-Y/uImid8aAwrEA24/1tcRZwpxX3pIFTSilcNDKSPn+Y2iDywSEachzRuvgAYYLR3wpGXAsMbv5lvKLDZLeYPAw== dependencies: "@types/unist" "*" @@ -3681,17 +3983,17 @@ resolved "https://registry.yarnpkg.com/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== -"@types/minimatch@*", "@types/minimatch@^5.1.2": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - "@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== -"@types/minimist@^1.2.0": +"@types/minimatch@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + +"@types/minimist@^1.2.0", "@types/minimist@^1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== @@ -3701,10 +4003,10 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/natural-compare-lite@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@types/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#90724682da3c304dd8d643b4e9ba00f53f29d454" - integrity sha512-ZDcj/yWsRPacqKPpCExWWFq9X1JQwEOfHsu8deN1Qfa6M02z6tN4DK6AMf2IkM7709gp3QW6Bo7m2NFDhA485w== +"@types/natural-compare@*", "@types/natural-compare@^1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@types/natural-compare/-/natural-compare-1.4.1.tgz#fc2b11ea100d380b0de7af15768bef209157bfb9" + integrity sha512-9dr4UakpvN0QUvwNefk9+o14Sr1pPPIDWkgCxPkHcg3kyjtc9eKK1ng6dZ23vRwByloCqXYtZ1T5nJxkk3Ib3A== "@types/ncp@^2.0.5": version "2.0.5" @@ -3713,10 +4015,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@^17.0.5", "@types/node@^18.11.9": - version "18.15.3" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.3.tgz#f0b991c32cfc6a4e7f3399d6cb4b8cf9a0315014" - integrity sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw== +"@types/node@*", "@types/node@^17.0.5", "@types/node@^18.16.19": + version "18.16.19" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.19.tgz#cb03fca8910fdeb7595b755126a8a78144714eea" + integrity sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA== "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -3733,10 +4035,10 @@ resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109" integrity sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw== -"@types/prettier@*", "@types/prettier@^2.1.5", "@types/prettier@^2.6.0", "@types/prettier@^2.6.1": - version "2.7.2" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.2.tgz#6c2324641cc4ba050a8c710b2b251b377581fbf0" - integrity sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg== +"@types/prettier@*", "@types/prettier@^2.1.5", "@types/prettier@^2.7.2": + version "2.7.3" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" + integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== "@types/prop-types@*": version "15.7.5" @@ -3753,7 +4055,7 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== -"@types/react-helmet@^6.1.5": +"@types/react-helmet@^6.1.6": version "6.1.6" resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-6.1.6.tgz#7d1afd8cbf099616894e8240e9ef70e3c6d7506d" integrity sha512-ZKcoOdW/Tg+kiUbkFCBtvDw0k3nD4HJ/h/B9yWxN4uDO8OkRksWTO+EL+z/Qu3aHTeTll3Ro0Cc/8UhwBCMG5A== @@ -3786,10 +4088,10 @@ "@types/history" "*" "@types/react" "*" -"@types/react@*", "@types/react@^18.0.9": - version "18.0.28" - resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.28.tgz#accaeb8b86f4908057ad629a26635fe641480065" - integrity sha512-RD0ivG1kEztNBdoAK7lekI9M+azSnitIn85h4iOiaLjaTrMjzslhaqCGaI4IyCJ1RljWiLCEu4jyrLLgqxBTew== +"@types/react@*", "@types/react@^18.2.14": + version "18.2.15" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.15.tgz#14792b35df676c20ec3cf595b262f8c615a73066" + integrity sha512-oEjE7TQt1fFTFSbf8kkNuc798ahTUzn3Le67/PWjE8MAfYAD/qB7O8hSTcromLFqHCt9bcdOg5GXMokzTjJ5SA== dependencies: "@types/prop-types" "*" "@types/scheduler" "*" @@ -3802,24 +4104,11 @@ dependencies: "@types/node" "*" -"@types/resolve@1.20.2": - version "1.20.2" - resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" - integrity sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q== - "@types/retry@^0.12.0": version "0.12.1" resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065" integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g== -"@types/rimraf@^3.0.2": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-3.0.2.tgz#a63d175b331748e5220ad48c901d7bbf1f44eef8" - integrity sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ== - dependencies: - "@types/glob" "*" - "@types/node" "*" - "@types/sax@^1.2.1": version "1.2.4" resolved "https://registry.yarnpkg.com/@types/sax/-/sax-1.2.4.tgz#8221affa7f4f3cb21abd22f244cfabfa63e6a69e" @@ -3828,14 +4117,14 @@ "@types/node" "*" "@types/scheduler@*": - version "0.16.2" - resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" - integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== + version "0.16.3" + resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5" + integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ== -"@types/semver@*", "@types/semver@^7.3.12", "@types/semver@^7.3.9": - version "7.3.13" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91" - integrity sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw== +"@types/semver@^7.3.12", "@types/semver@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.0.tgz#591c1ce3a702c45ee15f47a42ade72c2fd78978a" + integrity sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw== "@types/serve-index@^1.9.1": version "1.9.1" @@ -3864,7 +4153,7 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" integrity sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw== -"@types/tmp@*", "@types/tmp@^0.2.3": +"@types/tmp@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@types/tmp/-/tmp-0.2.3.tgz#908bfb113419fd6a42273674c00994d40902c165" integrity sha512-dDZH/tXzwjutnuk4UacGgFRwV+JSLaXL1ikvidfJprkb7L9Nx1njcRHHmi3Dsvt7pgqqTEeucQuOrWHPFgzVHA== @@ -3892,131 +4181,184 @@ integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== "@types/yargs@^17.0.8": - version "17.0.23" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.23.tgz#a7db3a2062c95ca1a5e0d5d5ddb6521cbc649e35" - integrity sha512-yuogunc04OnzGQCrfHx+Kk883Q4X0aSwmYZhKjI21m+SVYzjIbrWl8dOOwSv5hf2Um2pdCOXWo9isteZTNXUZQ== + version "17.0.24" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.24.tgz#b3ef8d50ad4aa6aecf6ddc97c580a00f5aa11902" + integrity sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw== dependencies: "@types/yargs-parser" "*" -"@webassemblyjs/ast@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" - integrity sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw== +"@typescript-eslint/scope-manager@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" + integrity sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w== dependencies: - "@webassemblyjs/helper-numbers" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" -"@webassemblyjs/floating-point-hex-parser@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz#f6c61a705f0fd7a6aecaa4e8198f23d9dc179e4f" - integrity sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ== +"@typescript-eslint/types@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.62.0.tgz#258607e60effa309f067608931c3df6fed41fd2f" + integrity sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ== -"@webassemblyjs/helper-api-error@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz#1a63192d8788e5c012800ba6a7a46c705288fd16" - integrity sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg== +"@typescript-eslint/typescript-estree@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" + integrity sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA== + dependencies: + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/visitor-keys" "5.62.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.3.7" + tsutils "^3.21.0" -"@webassemblyjs/helper-buffer@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz#832a900eb444884cde9a7cad467f81500f5e5ab5" - integrity sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA== +"@typescript-eslint/utils@^5.10.0", "@typescript-eslint/utils@^5.57.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" + integrity sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@types/json-schema" "^7.0.9" + "@types/semver" "^7.3.12" + "@typescript-eslint/scope-manager" "5.62.0" + "@typescript-eslint/types" "5.62.0" + "@typescript-eslint/typescript-estree" "5.62.0" + eslint-scope "^5.1.1" + semver "^7.3.7" -"@webassemblyjs/helper-numbers@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz#64d81da219fbbba1e3bd1bfc74f6e8c4e10a62ae" - integrity sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ== +"@typescript-eslint/visitor-keys@5.62.0": + version "5.62.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz#2174011917ce582875954ffe2f6912d5931e353e" + integrity sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw== dependencies: - "@webassemblyjs/floating-point-hex-parser" "1.11.1" - "@webassemblyjs/helper-api-error" "1.11.1" + "@typescript-eslint/types" "5.62.0" + eslint-visitor-keys "^3.3.0" + +"@ungap/promise-all-settled@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" + integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== + +"@webassemblyjs/ast@1.11.5", "@webassemblyjs/ast@^1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.5.tgz#6e818036b94548c1fb53b754b5cae3c9b208281c" + integrity sha512-LHY/GSAZZRpsNQH+/oHqhRQ5FT7eoULcBqgfyTB5nQHogFnK3/7QoN7dLnwSE/JkUAF0SrRuclT7ODqMFtWxxQ== + dependencies: + "@webassemblyjs/helper-numbers" "1.11.5" + "@webassemblyjs/helper-wasm-bytecode" "1.11.5" + +"@webassemblyjs/floating-point-hex-parser@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.5.tgz#e85dfdb01cad16b812ff166b96806c050555f1b4" + integrity sha512-1j1zTIC5EZOtCplMBG/IEwLtUojtwFVwdyVMbL/hwWqbzlQoJsWCOavrdnLkemwNoC/EOwtUFch3fuo+cbcXYQ== + +"@webassemblyjs/helper-api-error@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.5.tgz#1e82fa7958c681ddcf4eabef756ce09d49d442d1" + integrity sha512-L65bDPmfpY0+yFrsgz8b6LhXmbbs38OnwDCf6NpnMUYqa+ENfE5Dq9E42ny0qz/PdR0LJyq/T5YijPnU8AXEpA== + +"@webassemblyjs/helper-buffer@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.5.tgz#91381652ea95bb38bbfd270702351c0c89d69fba" + integrity sha512-fDKo1gstwFFSfacIeH5KfwzjykIE6ldh1iH9Y/8YkAZrhmu4TctqYjSh7t0K2VyDSXOZJ1MLhht/k9IvYGcIxg== + +"@webassemblyjs/helper-numbers@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.5.tgz#23380c910d56764957292839006fecbe05e135a9" + integrity sha512-DhykHXM0ZABqfIGYNv93A5KKDw/+ywBFnuWybZZWcuzWHfbp21wUfRkbtz7dMGwGgT4iXjWuhRMA2Mzod6W4WA== + dependencies: + "@webassemblyjs/floating-point-hex-parser" "1.11.5" + "@webassemblyjs/helper-api-error" "1.11.5" "@xtuc/long" "4.2.2" -"@webassemblyjs/helper-wasm-bytecode@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz#f328241e41e7b199d0b20c18e88429c4433295e1" - integrity sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q== +"@webassemblyjs/helper-wasm-bytecode@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.5.tgz#e258a25251bc69a52ef817da3001863cc1c24b9f" + integrity sha512-oC4Qa0bNcqnjAowFn7MPCETQgDYytpsfvz4ujZz63Zu/a/v71HeCAAmZsgZ3YVKec3zSPYytG3/PrRCqbtcAvA== -"@webassemblyjs/helper-wasm-section@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz#21ee065a7b635f319e738f0dd73bfbda281c097a" - integrity sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg== +"@webassemblyjs/helper-wasm-section@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.5.tgz#966e855a6fae04d5570ad4ec87fbcf29b42ba78e" + integrity sha512-uEoThA1LN2NA+K3B9wDo3yKlBfVtC6rh0i4/6hvbz071E8gTNZD/pT0MsBf7MeD6KbApMSkaAK0XeKyOZC7CIA== dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-buffer" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/wasm-gen" "1.11.1" + "@webassemblyjs/ast" "1.11.5" + "@webassemblyjs/helper-buffer" "1.11.5" + "@webassemblyjs/helper-wasm-bytecode" "1.11.5" + "@webassemblyjs/wasm-gen" "1.11.5" -"@webassemblyjs/ieee754@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz#963929e9bbd05709e7e12243a099180812992614" - integrity sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ== +"@webassemblyjs/ieee754@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/ieee754/-/ieee754-1.11.5.tgz#b2db1b33ce9c91e34236194c2b5cba9b25ca9d60" + integrity sha512-37aGq6qVL8A8oPbPrSGMBcp38YZFXcHfiROflJn9jxSdSMMM5dS5P/9e2/TpaJuhE+wFrbukN2WI6Hw9MH5acg== dependencies: "@xtuc/ieee754" "^1.2.0" -"@webassemblyjs/leb128@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.1.tgz#ce814b45574e93d76bae1fb2644ab9cdd9527aa5" - integrity sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw== +"@webassemblyjs/leb128@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/leb128/-/leb128-1.11.5.tgz#482e44d26b6b949edf042a8525a66c649e38935a" + integrity sha512-ajqrRSXaTJoPW+xmkfYN6l8VIeNnR4vBOTQO9HzR7IygoCcKWkICbKFbVTNMjMgMREqXEr0+2M6zukzM47ZUfQ== dependencies: "@xtuc/long" "4.2.2" -"@webassemblyjs/utf8@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.1.tgz#d1f8b764369e7c6e6bae350e854dec9a59f0a3ff" - integrity sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ== - -"@webassemblyjs/wasm-edit@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz#ad206ebf4bf95a058ce9880a8c092c5dec8193d6" - integrity sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-buffer" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/helper-wasm-section" "1.11.1" - "@webassemblyjs/wasm-gen" "1.11.1" - "@webassemblyjs/wasm-opt" "1.11.1" - "@webassemblyjs/wasm-parser" "1.11.1" - "@webassemblyjs/wast-printer" "1.11.1" - -"@webassemblyjs/wasm-gen@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz#86c5ea304849759b7d88c47a32f4f039ae3c8f76" - integrity sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/ieee754" "1.11.1" - "@webassemblyjs/leb128" "1.11.1" - "@webassemblyjs/utf8" "1.11.1" - -"@webassemblyjs/wasm-opt@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz#657b4c2202f4cf3b345f8a4c6461c8c2418985f2" - integrity sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-buffer" "1.11.1" - "@webassemblyjs/wasm-gen" "1.11.1" - "@webassemblyjs/wasm-parser" "1.11.1" - -"@webassemblyjs/wasm-parser@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz#86ca734534f417e9bd3c67c7a1c75d8be41fb199" - integrity sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA== - dependencies: - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/helper-api-error" "1.11.1" - "@webassemblyjs/helper-wasm-bytecode" "1.11.1" - "@webassemblyjs/ieee754" "1.11.1" - "@webassemblyjs/leb128" "1.11.1" - "@webassemblyjs/utf8" "1.11.1" - -"@webassemblyjs/wast-printer@1.11.1": - version "1.11.1" - resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz#d0c73beda8eec5426f10ae8ef55cee5e7084c2f0" - integrity sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg== - dependencies: - "@webassemblyjs/ast" "1.11.1" +"@webassemblyjs/utf8@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/utf8/-/utf8-1.11.5.tgz#83bef94856e399f3740e8df9f63bc47a987eae1a" + integrity sha512-WiOhulHKTZU5UPlRl53gHR8OxdGsSOxqfpqWeA2FmcwBMaoEdz6b2x2si3IwC9/fSPLfe8pBMRTHVMk5nlwnFQ== + +"@webassemblyjs/wasm-edit@^1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.5.tgz#93ee10a08037657e21c70de31c47fdad6b522b2d" + integrity sha512-C0p9D2fAu3Twwqvygvf42iGCQ4av8MFBLiTb+08SZ4cEdwzWx9QeAHDo1E2k+9s/0w1DM40oflJOpkZ8jW4HCQ== + dependencies: + "@webassemblyjs/ast" "1.11.5" + "@webassemblyjs/helper-buffer" "1.11.5" + "@webassemblyjs/helper-wasm-bytecode" "1.11.5" + "@webassemblyjs/helper-wasm-section" "1.11.5" + "@webassemblyjs/wasm-gen" "1.11.5" + "@webassemblyjs/wasm-opt" "1.11.5" + "@webassemblyjs/wasm-parser" "1.11.5" + "@webassemblyjs/wast-printer" "1.11.5" + +"@webassemblyjs/wasm-gen@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.5.tgz#ceb1c82b40bf0cf67a492c53381916756ef7f0b1" + integrity sha512-14vteRlRjxLK9eSyYFvw1K8Vv+iPdZU0Aebk3j6oB8TQiQYuO6hj9s4d7qf6f2HJr2khzvNldAFG13CgdkAIfA== + dependencies: + "@webassemblyjs/ast" "1.11.5" + "@webassemblyjs/helper-wasm-bytecode" "1.11.5" + "@webassemblyjs/ieee754" "1.11.5" + "@webassemblyjs/leb128" "1.11.5" + "@webassemblyjs/utf8" "1.11.5" + +"@webassemblyjs/wasm-opt@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.5.tgz#b52bac29681fa62487e16d3bb7f0633d5e62ca0a" + integrity sha512-tcKwlIXstBQgbKy1MlbDMlXaxpucn42eb17H29rawYLxm5+MsEmgPzeCP8B1Cl69hCice8LeKgZpRUAPtqYPgw== + dependencies: + "@webassemblyjs/ast" "1.11.5" + "@webassemblyjs/helper-buffer" "1.11.5" + "@webassemblyjs/wasm-gen" "1.11.5" + "@webassemblyjs/wasm-parser" "1.11.5" + +"@webassemblyjs/wasm-parser@1.11.5", "@webassemblyjs/wasm-parser@^1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.5.tgz#7ba0697ca74c860ea13e3ba226b29617046982e2" + integrity sha512-SVXUIwsLQlc8srSD7jejsfTU83g7pIGr2YYNb9oHdtldSxaOhvA5xwvIiWIfcX8PlSakgqMXsLpLfbbJ4cBYew== + dependencies: + "@webassemblyjs/ast" "1.11.5" + "@webassemblyjs/helper-api-error" "1.11.5" + "@webassemblyjs/helper-wasm-bytecode" "1.11.5" + "@webassemblyjs/ieee754" "1.11.5" + "@webassemblyjs/leb128" "1.11.5" + "@webassemblyjs/utf8" "1.11.5" + +"@webassemblyjs/wast-printer@1.11.5": + version "1.11.5" + resolved "https://registry.yarnpkg.com/@webassemblyjs/wast-printer/-/wast-printer-1.11.5.tgz#7a5e9689043f3eca82d544d7be7a8e6373a6fa98" + integrity sha512-f7Pq3wvg3GSPUPzR0F6bmI89Hdb+u9WXrSKc4v+N0aV0q6r42WoF92Jp2jEorBEBRoRNXgjp53nBniDXcqZYPA== + dependencies: + "@webassemblyjs/ast" "1.11.5" "@xtuc/long" "4.2.2" "@xtuc/ieee754@^1.2.0": @@ -4034,10 +4376,10 @@ resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== -"@yarnpkg/parsers@^3.0.0-rc.18": - version "3.0.0-rc.24" - resolved "https://registry.yarnpkg.com/@yarnpkg/parsers/-/parsers-3.0.0-rc.24.tgz#508f9dd089c7b297d9dcc297aa0e8c89fb56267f" - integrity sha512-A5wXsIUOipZUGDly1SHBht1OjKKW4y+E9EzzJxR2tby0Pj3atgCta9RSYa4+aXLkFfIMX3onnykmJnwJWqJj5g== +"@yarnpkg/parsers@3.0.0-rc.46": + version "3.0.0-rc.46" + resolved "https://registry.yarnpkg.com/@yarnpkg/parsers/-/parsers-3.0.0-rc.46.tgz#03f8363111efc0ea670e53b0282cd3ef62de4e01" + integrity sha512-aiATs7pSutzda/rq8fnuPwTglyVwjM22bNnK2ZgjrpAjQHSSl3lztd2f9evst1W/qnC58DRz7T7QndUDumAR4Q== dependencies: js-yaml "^3.10.0" tslib "^2.4.0" @@ -4049,7 +4391,7 @@ dependencies: argparse "^2.0.1" -JSONStream@^1.0.4: +JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== @@ -4070,10 +4412,10 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-import-assertions@^1.7.6: - version "1.8.0" - resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz#ba2b5939ce62c238db6d93d81c9b111b29b855e9" - integrity sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw== +acorn-import-assertions@^1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz#507276249d684797c84e0734ef84860334cfb1ac" + integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA== acorn-jsx@^5.3.2: version "5.3.2" @@ -4085,10 +4427,10 @@ acorn-walk@^8.0.0, acorn-walk@^8.1.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== -acorn@^8.0.4, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.7.1, acorn@^8.8.0: - version "8.8.2" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" - integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +acorn@^8.0.4, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.2, acorn@^8.9.0: + version "8.10.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" + integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== add-stream@^1.0.0: version "1.0.0" @@ -4143,7 +4485,7 @@ ajv-keywords@^5.0.0: dependencies: fast-deep-equal "^3.1.3" -ajv@^6.10.0, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5, ajv@~6.12.6: +ajv@^6.10.0, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5, ajv@^6.12.6, ajv@~6.12.6: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -4153,10 +4495,10 @@ ajv@^6.10.0, ajv@^6.12.2, ajv@^6.12.4, ajv@^6.12.5, ajv@~6.12.6: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.6.0, ajv@^8.8.0: - version "8.11.0" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.11.0.tgz#977e91dd96ca669f54a11e23e378e33b884a565f" - integrity sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg== +ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.6.0, ajv@^8.8.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" + integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== dependencies: fast-deep-equal "^3.1.1" json-schema-traverse "^1.0.0" @@ -4197,7 +4539,7 @@ ansi-align@^3.0.0, ansi-align@^3.0.1: dependencies: string-width "^4.1.0" -ansi-colors@^4.1.1: +ansi-colors@4.1.1, ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== @@ -4214,6 +4556,11 @@ ansi-html-community@^0.0.8: resolved "https://registry.yarnpkg.com/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41" integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw== +ansi-regex@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1" + integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw== + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -4248,12 +4595,7 @@ ansi-styles@^6.0.0, ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -any-promise@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" - integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== - -anymatch@^3.0.3, anymatch@~3.1.2: +anymatch@^3.0.3, anymatch@~3.1.1, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== @@ -4261,7 +4603,7 @@ anymatch@^3.0.3, anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" -"aproba@^1.0.3 || ^2.0.0", aproba@^2.0.0: +"aproba@^1.0.3 || ^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== @@ -4393,11 +4735,16 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -asap@^2.0.0, asap@~2.0.3: +asap@~2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= +assertion-error@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== + ast-types-flow@^0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" @@ -4440,17 +4787,19 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -axe-core@^4.6.1, axe-core@^4.6.2: - version "4.6.3" - resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.6.3.tgz#fc0db6fdb65cc7a80ccf85286d91d64ababa3ece" - integrity sha512-/BQzOX780JhsxDnPpH4ZiyrJAzcd8AfzFPkv+89veFSr1rcMjuq2JDCwypKaPeB6ljHp9KjXhPpjgCvQlWYuqg== +axe-core@^4.6.2, axe-core@^4.7.0: + version "4.7.2" + resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.7.2.tgz#040a7342b20765cb18bb50b628394c21bccc17a0" + integrity sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g== -axios@^0.21.2: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== +axios@1.1.3, axios@^1.0.0: + version "1.1.3" + resolved "https://registry.yarnpkg.com/axios/-/axios-1.1.3.tgz#8274250dada2edf53814ed7db644b9c2866c1e35" + integrity sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA== dependencies: - follow-redirects "^1.14.0" + follow-redirects "^1.15.0" + form-data "^4.0.0" + proxy-from-env "^1.1.0" axios@^0.25.0: version "0.25.0" @@ -4459,15 +4808,6 @@ axios@^0.25.0: dependencies: follow-redirects "^1.14.7" -axios@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.1.2.tgz#8b6f6c540abf44ab98d9904e8daf55351ca4a331" - integrity sha512-bznQyETwElsXl2RK7HLLwb5GPpOLlycxHCtrpDR/4RqqBzjARaOTo3jz4IgtntWUYee7Ne4S8UHd92VCuzPaWA== - dependencies: - follow-redirects "^1.15.0" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - axobject-query@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-3.1.1.tgz#3b6e5c6d4e43ca7ba51c5babf99d22a9c68485e1" @@ -4475,12 +4815,12 @@ axobject-query@^3.1.1: dependencies: deep-equal "^2.0.5" -babel-jest@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.5.0.tgz#3fe3ddb109198e78b1c88f9ebdecd5e4fc2f50a5" - integrity sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q== +babel-jest@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.6.1.tgz#a7141ad1ed5ec50238f3cd36127636823111233a" + integrity sha512-qu+3bdPEQC6KZSPz+4Fyjbga5OODNcp49j6GKzG1EKbkfyJBxEYGVUmVGpwCSeGouG52R4EgYMLb6p9YeEEQ4A== dependencies: - "@jest/transform" "^29.5.0" + "@jest/transform" "^29.6.1" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" babel-preset-jest "^29.5.0" @@ -4506,6 +4846,15 @@ babel-plugin-apply-mdx-type-prop@1.6.22: "@babel/helper-plugin-utils" "7.10.4" "@mdx-js/util" "1.6.22" +babel-plugin-const-enum@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/babel-plugin-const-enum/-/babel-plugin-const-enum-1.2.0.tgz#3d25524106f68f081e187829ba736b251c289861" + integrity sha512-o1m/6iyyFnp9MRsK1dHF3bneqyf3AlM2q3A/YbgQr2pCat6B6XJVDv2TXqzfY2RYUi4mak6WAksSBPlyYGx9dg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-typescript" "^7.3.3" + "@babel/traverse" "^7.16.0" + babel-plugin-dynamic-import-node@^2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" @@ -4541,7 +4890,16 @@ babel-plugin-jest-hoist@^29.5.0: "@types/babel__core" "^7.1.14" "@types/babel__traverse" "^7.0.6" -babel-plugin-polyfill-corejs2@^0.3.1, babel-plugin-polyfill-corejs2@^0.3.3: +babel-plugin-macros@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/babel-plugin-macros/-/babel-plugin-macros-2.8.0.tgz#0f958a7cc6556b1e65344465d99111a1e5e10138" + integrity sha512-SEP5kJpfGYqYKpBrj5XU3ahw5p5GOHJ0U5ssOSQ/WBVdwkD2Dzlce95exQTs3jOVWPPKLBN2rlEWkCK7dSmLvg== + dependencies: + "@babel/runtime" "^7.7.2" + cosmiconfig "^6.0.0" + resolve "^1.12.0" + +babel-plugin-polyfill-corejs2@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz#5d1bd3836d0a19e1b84bbf2d9640ccb6f951c122" integrity sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q== @@ -4550,14 +4908,6 @@ babel-plugin-polyfill-corejs2@^0.3.1, babel-plugin-polyfill-corejs2@^0.3.3: "@babel/helper-define-polyfill-provider" "^0.3.3" semver "^6.1.1" -babel-plugin-polyfill-corejs3@^0.5.2: - version "0.5.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.3.tgz#d7e09c9a899079d71a8b670c6181af56ec19c5c7" - integrity sha512-zKsXDh0XjnrUEW0mxIHLfjBfnXSMr5Q/goMe/fxpQnLm07mcOZiIZHBNWCMx60HmdvjxfXcalac0tfFg0wqxyw== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.2" - core-js-compat "^3.21.0" - babel-plugin-polyfill-corejs3@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz#56ad88237137eade485a71b52f72dbed57c6230a" @@ -4566,13 +4916,6 @@ babel-plugin-polyfill-corejs3@^0.6.0: "@babel/helper-define-polyfill-provider" "^0.3.3" core-js-compat "^3.25.1" -babel-plugin-polyfill-regenerator@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz#2c0678ea47c75c8cc2fbb1852278d8fb68233990" - integrity sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.1" - babel-plugin-polyfill-regenerator@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz#390f91c38d90473592ed43351e801a9d3e0fd747" @@ -4580,6 +4923,13 @@ babel-plugin-polyfill-regenerator@^0.4.1: dependencies: "@babel/helper-define-polyfill-provider" "^0.3.3" +babel-plugin-transform-typescript-metadata@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-typescript-metadata/-/babel-plugin-transform-typescript-metadata-0.3.2.tgz#7a327842d8c36ffe07ee1b5276434e56c297c9b7" + integrity sha512-mWEvCQTgXQf48yDqgN7CH50waTyYBeP2Lpqx4nNWab9sxEpdXVeKgfj1qYI2/TgUPQtNFZ85i3PemRtnXVYYJg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + babel-preset-current-node-syntax@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" @@ -4616,6 +4966,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +balanced-match@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-2.0.0.tgz#dc70f920d78db8b858535795867bf48f820633d9" + integrity sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA== + base16@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/base16/-/base16-1.0.0.tgz#e297f60d7ec1014a7a971a39ebc8a98c0b681e70" @@ -4641,18 +4996,6 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== -bin-links@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.1.tgz#cc70ffb481988b22c527d3e6e454787876987a49" - integrity sha512-9vx+ypzVhASvHTS6K+YSGf7nwQdANoz7v6MTC0aCtYnOEZ87YvMf81aY737EZnGZdpbRM3sfWjO9oWkKmuIvyQ== - dependencies: - cmd-shim "^5.0.0" - mkdirp-infer-owner "^2.0.0" - npm-normalize-package-bin "^1.0.0" - read-cmd-shim "^3.0.0" - rimraf "^3.0.0" - write-file-atomic "^4.0.0" - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -4750,15 +5093,20 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" -browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.16.6, browserslist@^4.18.1, browserslist@^4.20.3, browserslist@^4.21.3, browserslist@^4.21.4: - version "4.21.5" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.5.tgz#75c5dae60063ee641f977e00edd3cfb2fb7af6a7" - integrity sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w== +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.16.6, browserslist@^4.18.1, browserslist@^4.20.3, browserslist@^4.21.4, browserslist@^4.21.9: + version "4.21.9" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.9.tgz#e11bdd3c313d7e2a9e87e8b4b0c7872b13897635" + integrity sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg== dependencies: - caniuse-lite "^1.0.30001449" - electron-to-chromium "^1.4.284" - node-releases "^2.0.8" - update-browserslist-db "^1.0.10" + caniuse-lite "^1.0.30001503" + electron-to-chromium "^1.4.431" + node-releases "^2.0.12" + update-browserslist-db "^1.0.11" bser@2.1.1: version "2.1.1" @@ -4802,10 +5150,10 @@ builtins@^5.0.0: dependencies: semver "^7.0.0" -byte-size@7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-7.0.0.tgz#36528cd1ca87d39bd9abd51f5715dc93b6ceb032" - integrity sha512-NNiBxKgxybMBtWdmvx7ZITJi4ZG+CYUgwOSZTfqB1qogkRHrhbQE/R2r5Fh94X+InN5MCYz6SvB/ejHMj/HbsQ== +byte-size@8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/byte-size/-/byte-size-8.1.1.tgz#3424608c62d59de5bfda05d31e0313c6174842ae" + integrity sha512-tUkzZWK0M/qdoLEqikxBWe4kumyuwjl3HO6zHTr4yEI23EojPtLYXdG1+AQY7MN0cGyNDvEaJ8wiYQm6P2bPxg== bytes@3.0.0: version "3.0.0" @@ -4817,7 +5165,7 @@ bytes@3.1.2: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== -cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: +cacache@^16.1.0: version "16.1.0" resolved "https://registry.yarnpkg.com/cacache/-/cacache-16.1.0.tgz#87a6bae558a511c9cb2a13768073e240ca76153a" integrity sha512-Pk4aQkwCW82A4jGKFvcGkQFqZcMspfP9YWq9Pr87/ldDvlWf718zeI6KWCdKt/jeihu6BytHRUicJPB1K2k8EQ== @@ -4841,6 +5189,25 @@ cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: tar "^6.1.11" unique-filename "^1.1.1" +cacache@^17.0.0: + version "17.0.5" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-17.0.5.tgz#6dbec26c11f1f6a2b558bc11ed3316577c339ebc" + integrity sha512-Y/PRQevNSsjAPWykl9aeGz8Pr+OI6BYM9fYDNMvOkuUiG9IhG4LEmaYrZZZvioMUEQ+cBCxT0v8wrnCURccyKA== + dependencies: + "@npmcli/fs" "^3.1.0" + fs-minipass "^3.0.0" + glob "^9.3.1" + lru-cache "^7.7.1" + minipass "^4.0.0" + minipass-collect "^1.0.2" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.4" + p-map "^4.0.0" + promise-inflight "^1.0.1" + ssri "^10.0.0" + tar "^6.1.11" + unique-filename "^3.0.0" + cacheable-request@^6.0.0: version "6.1.0" resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-6.1.0.tgz#20ffb8bd162ba4be11e9567d823db651052ca912" @@ -4862,11 +5229,6 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" -call-me-maybe@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" - integrity sha512-wCyFsDQkKPwwF8BDwOiWNx/9K45L/hvggQiDbve+viMNMQnWhrlYIuBk09offfwCRtCO9P6XwUttufzU11WCVw== - callsites@^3.0.0, callsites@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -4894,12 +5256,22 @@ camelcase-keys@^6.2.2: map-obj "^4.0.0" quick-lru "^4.0.1" +camelcase-keys@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-7.0.2.tgz#d048d8c69448745bb0de6fc4c1c52a30dfbe7252" + integrity sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg== + dependencies: + camelcase "^6.3.0" + map-obj "^4.1.0" + quick-lru "^5.1.1" + type-fest "^1.2.1" + camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.2.0: +camelcase@^6.0.0, camelcase@^6.2.0, camelcase@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -4914,16 +5286,29 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001335, caniuse-lite@^1.0.30001449: - version "1.0.30001468" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001468.tgz#0101837c6a4e38e6331104c33dcfb3bdf367a4b7" - integrity sha512-zgAo8D5kbOyUcRAgSmgyuvBkjrGk5CGYG5TYgFdpQv+ywcyEpo1LOWoG8YmoflGnh+V+UsNuKYedsoYs0hzV5A== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001335, caniuse-lite@^1.0.30001503: + version "1.0.30001516" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001516.tgz#621b1be7d85a8843ee7d210fd9d87b52e3daab3a" + integrity sha512-Wmec9pCBY8CWbmI4HsjBeQLqDTqV91nFVR83DnZpYyRnPI1wePDsTg0bGLPC5VU/3OIZV1fmxEea1b+tFKe86g== ccount@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.1.0.tgz#246687debb6014735131be8abab2d93898f8d043" integrity sha512-vlNK021QdI7PNeiUh/lKkC/mNHHfV0m/Ad5JoI0TYtlBnJAslM/JIkm/tGC88bkLIwO6OQ5uV6ztS6kVAtCDlg== +chai@^4.3.7: + version "4.3.7" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" + integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== + dependencies: + assertion-error "^1.1.0" + check-error "^1.0.2" + deep-eql "^4.1.2" + get-func-name "^2.0.0" + loupe "^2.3.1" + pathval "^1.1.1" + type-detect "^4.0.5" + chalk@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" @@ -4932,12 +5317,12 @@ chalk@4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@5.2.0, chalk@^5.0.1: +chalk@5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.2.0.tgz#249623b7d66869c673699fb66d65723e54dfcfb3" integrity sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA== -chalk@^2.0.0, chalk@^2.3.0, chalk@^2.4.2: +chalk@^2.0.0, chalk@^2.3.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -4954,6 +5339,11 @@ chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -4979,6 +5369,11 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +check-error@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" + integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== + cheerio-select@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-2.1.0.tgz#4d8673286b8126ca2a8e42740d5e3c4884ae21b4" @@ -5004,6 +5399,21 @@ cheerio@^1.0.0-rc.12: parse5 "^7.0.0" parse5-htmlparser2-tree-adapter "^7.0.0" +chokidar@3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a" + integrity sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw== + dependencies: + anymatch "~3.1.1" + braces "~3.0.2" + glob-parent "~5.1.0" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.5.0" + optionalDependencies: + fsevents "~2.3.1" + chokidar@^3.4.2, chokidar@^3.5.1, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" @@ -5034,7 +5444,7 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -ci-info@^3.2.0, ci-info@^3.6.1: +ci-info@^3.2.0, ci-info@^3.6.1, ci-info@^3.7.0, ci-info@^3.8.0: version "3.8.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.8.0.tgz#81408265a5380c929f0bc665d62256628ce9ef91" integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== @@ -5081,17 +5491,6 @@ cli-boxes@^3.0.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145" integrity sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g== -cli-color@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/cli-color/-/cli-color-2.0.3.tgz#73769ba969080629670f3f2ef69a4bf4e7cc1879" - integrity sha512-OkoZnxyC4ERN3zLzZaY9Emb7f/MhBOIpePv0Ycok0fJYT+Ouo00UBEIwsVsr0yoow++n5YWlSUgST9GKhNHiRQ== - dependencies: - d "^1.0.1" - es5-ext "^0.10.61" - es6-iterator "^2.0.3" - memoizee "^0.4.15" - timers-ext "^0.1.7" - cli-cursor@3.1.0, cli-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" @@ -5178,17 +5577,15 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clsx@^1.1.1, clsx@^1.2.1: +clsx@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== -cmd-shim@5.0.0, cmd-shim@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-5.0.0.tgz#8d0aaa1a6b0708630694c4dbde070ed94c707724" - integrity sha512-qkCtZ59BidfEwHltnJwkyVZn+XQojdAySM1D1gSeh11Z4pW1Kpolkyo53L5noc0nrxmIvyFwTmJRo4xs7FFLPw== - dependencies: - mkdirp-infer-owner "^2.0.0" +cmd-shim@6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-6.0.1.tgz#a65878080548e1dca760b3aea1e21ed05194da9d" + integrity sha512-S9iI9y0nKR4hwEQsVWpyxld/6kRfGepGfzff83FcaiEBpmvlbA2nnGe7Cylgrx2f/p1P5S5wpRm9oL8z1PbS3Q== co@^4.6.0: version "4.6.0" @@ -5234,15 +5631,15 @@ color-support@^1.1.3: resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== -colord@^2.9.1: - version "2.9.1" - resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.1.tgz#c961ea0efeb57c9f0f4834458f26cb9cc4a3f90e" - integrity sha512-4LBMSt09vR0uLnPVkOUBnmxgoaeN4ewRbx801wY/bXcltXfpR/G46OdWn96XpYmCWuYvO46aBZP4NgX8HpNAcw== +colord@^2.9.1, colord@^2.9.3: + version "2.9.3" + resolved "https://registry.yarnpkg.com/colord/-/colord-2.9.3.tgz#4f8ce919de456f1d5c1c368c307fe20f3e59fb43" + integrity sha512-jeC1axXpnb0/2nn/Y1LPuLdgXBLH7aDcHu4KEKfqw3CUhX7ZpfBSlPKyqXE6btIgEzfWtrX3/tyBCaCvXvMkOw== colorette@^2.0.10, colorette@^2.0.19: - version "2.0.19" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798" - integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ== + version "2.0.20" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" + integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== colors@~1.2.1: version "1.2.5" @@ -5275,9 +5672,9 @@ comma-separated-tokens@^1.0.0: integrity sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw== commander@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.0.tgz#71797971162cd3cf65f0b9d24eb28f8d303acdf1" - integrity sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA== + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== commander@^2.12.1, commander@^2.20.0, commander@^2.7.1: version "2.20.3" @@ -5299,10 +5696,10 @@ commander@^8.3.0: resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== -commander@~9.4.1: - version "9.4.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" - integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw== +commander@~11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-11.0.0.tgz#43e19c25dbedc8256203538e8d7e9346877a6f67" + integrity sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ== comment-json@^4.2.3: version "4.2.3" @@ -5315,11 +5712,6 @@ comment-json@^4.2.3: has-own-prop "^2.0.0" repeat-string "^1.6.1" -common-ancestor-path@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/common-ancestor-path/-/common-ancestor-path-1.0.1.tgz#4f7d2d1394d91b7abdf51871c62f71eadb0182a7" - integrity sha512-L3sHRo1pXXEqX8VU28kfgUY+YGsk09hPqZiZmLacNib6XNTCM8ubYeT7ryXQw8asB1sKgcU5lkB7ONug08aB8w== - common-tags@^1.8.0: version "1.8.2" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" @@ -5373,14 +5765,6 @@ concat-stream@^2.0.0: readable-stream "^3.0.2" typedarray "^0.0.6" -config-chain@1.1.12: - version "1.1.12" - resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" - integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== - dependencies: - ini "^1.3.4" - proto-list "~1.2.1" - configstore@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/configstore/-/configstore-5.0.1.tgz#d365021b5df4b98cdd187d6a3b0e3f6a7cc5ed96" @@ -5408,10 +5792,10 @@ console-control-strings@^1.1.0: resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4= -console-fail-test@^0.1.7: - version "0.1.8" - resolved "https://registry.yarnpkg.com/console-fail-test/-/console-fail-test-0.1.8.tgz#55d317b050b9bcd7536f012bfe1acc7e2b4f193e" - integrity sha512-iB2ym9CglQy36RHMY8GWydzufleVJjFcgDwihHGpHUOhesn5UBvmOSy56NgG2N1LBiHtZF9wNQTpymPyPCOv2g== +console-fail-test@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/console-fail-test/-/console-fail-test-0.2.3.tgz#e6b0dbe2d3d3ab1c971503f4ff114bca77e4976c" + integrity sha512-p1xfi9ubVM2X3NpjPH1Gm8Gxc7vXyTwcOIquU8rpUDA+ISSitAOiBDnT/Bti1We5YzZKRxgI0JU+fFvOmOXtvA== content-disposition@0.5.2: version "0.5.2" @@ -5430,87 +5814,78 @@ content-type@~1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== -conventional-changelog-angular@5.0.12: - version "5.0.12" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.12.tgz#c979b8b921cbfe26402eb3da5bbfda02d865a2b9" - integrity sha512-5GLsbnkR/7A89RyHLvvoExbiGbd9xKdKqDTrArnPbOqBqG/2wIosu0fHwpeIRI8Tl94MhVNBXcLJZl92ZQ5USw== +conventional-changelog-angular@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz#a9a9494c28b7165889144fd5b91573c4aa9ca541" + integrity sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg== dependencies: compare-func "^2.0.0" - q "^1.5.1" -conventional-changelog-core@4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-4.2.4.tgz#e50d047e8ebacf63fac3dc67bf918177001e1e9f" - integrity sha512-gDVS+zVJHE2v4SLc6B0sLsPiloR0ygU7HaDW14aNJE1v4SlqJPILPl/aJC7YdtRE4CybBf8gDwObBvKha8Xlyg== +conventional-changelog-core@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-5.0.1.tgz#3c331b155d5b9850f47b4760aeddfc983a92ad49" + integrity sha512-Rvi5pH+LvgsqGwZPZ3Cq/tz4ty7mjijhr3qR4m9IBXNbxGGYgTVVO+duXzz9aArmHxFtwZ+LRkrNIMDQzgoY4A== dependencies: add-stream "^1.0.0" - conventional-changelog-writer "^5.0.0" - conventional-commits-parser "^3.2.0" - dateformat "^3.0.0" - get-pkg-repo "^4.0.0" - git-raw-commits "^2.0.8" + conventional-changelog-writer "^6.0.0" + conventional-commits-parser "^4.0.0" + dateformat "^3.0.3" + get-pkg-repo "^4.2.1" + git-raw-commits "^3.0.0" git-remote-origin-url "^2.0.0" - git-semver-tags "^4.1.1" - lodash "^4.17.15" - normalize-package-data "^3.0.0" - q "^1.5.1" + git-semver-tags "^5.0.0" + normalize-package-data "^3.0.3" read-pkg "^3.0.0" read-pkg-up "^3.0.0" - through2 "^4.0.0" -conventional-changelog-preset-loader@^2.3.4: - version "2.3.4" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz#14a855abbffd59027fd602581f1f34d9862ea44c" - integrity sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g== +conventional-changelog-preset-loader@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-3.0.0.tgz#14975ef759d22515d6eabae6396c2ae721d4c105" + integrity sha512-qy9XbdSLmVnwnvzEisjxdDiLA4OmV3o8db+Zdg4WiFw14fP3B6XNz98X0swPPpkTd/pc1K7+adKgEDM1JCUMiA== -conventional-changelog-writer@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-5.0.0.tgz#c4042f3f1542f2f41d7d2e0d6cad23aba8df8eec" - integrity sha512-HnDh9QHLNWfL6E1uHz6krZEQOgm8hN7z/m7tT16xwd802fwgMN0Wqd7AQYVkhpsjDUx/99oo+nGgvKF657XP5g== +conventional-changelog-writer@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-6.0.0.tgz#8c8dea0441c6e648c9b25bb784e750d02f8002d5" + integrity sha512-8PyWTnn7zBIt9l4hj4UusFs1TyG+9Ulu1zlOAc72L7Sdv9Hsc8E86ot7htY3HXCVhXHB/NO0pVGvZpwsyJvFfw== dependencies: - conventional-commits-filter "^2.0.7" - dateformat "^3.0.0" - handlebars "^4.7.6" + conventional-commits-filter "^3.0.0" + dateformat "^3.0.3" + handlebars "^4.7.7" json-stringify-safe "^5.0.1" - lodash "^4.17.15" - meow "^8.0.0" - semver "^6.0.0" - split "^1.0.0" - through2 "^4.0.0" + meow "^8.1.2" + semver "^6.3.0" + split "^1.0.1" -conventional-commits-filter@^2.0.7: - version "2.0.7" - resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-2.0.7.tgz#f8d9b4f182fce00c9af7139da49365b136c8a0b3" - integrity sha512-ASS9SamOP4TbCClsRHxIHXRfcGCnIoQqkvAzCSbZzTFLfcTqJVugB0agRgsEELsqaeWgsXv513eS116wnlSSPA== +conventional-commits-filter@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz#bf1113266151dd64c49cd269e3eb7d71d7015ee2" + integrity sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q== dependencies: lodash.ismatch "^4.4.0" - modify-values "^1.0.0" + modify-values "^1.0.1" -conventional-commits-parser@^3.2.0: - version "3.2.3" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.3.tgz#fc43704698239451e3ef35fd1d8ed644f46bd86e" - integrity sha512-YyRDR7On9H07ICFpRm/igcdjIqebXbvf4Cff+Pf0BrBys1i1EOzx9iFXNlAbdrLAR8jf7bkUYkDAr8pEy0q4Pw== +conventional-commits-parser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz#02ae1178a381304839bce7cea9da5f1b549ae505" + integrity sha512-WRv5j1FsVM5FISJkoYMR6tPk07fkKT0UodruX4je86V4owk451yjXAKzKAPOs9l7y59E2viHUS9eQ+dfUA9NSg== dependencies: - JSONStream "^1.0.4" + JSONStream "^1.3.5" is-text-path "^1.0.1" - lodash "^4.17.15" - meow "^8.0.0" - split2 "^3.0.0" - through2 "^4.0.0" + meow "^8.1.2" + split2 "^3.2.2" -conventional-recommended-bump@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-6.1.0.tgz#cfa623285d1de554012f2ffde70d9c8a22231f55" - integrity sha512-uiApbSiNGM/kkdL9GTOLAqC4hbptObFo4wW2QRyHsKciGAfQuLU1ShZ1BIVI/+K2BE/W1AWYQMCXAsv4dyKPaw== +conventional-recommended-bump@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-7.0.1.tgz#ec01f6c7f5d0e2491c2d89488b0d757393392424" + integrity sha512-Ft79FF4SlOFvX4PkwFDRnaNiIVX7YbmqGU0RwccUaiGvgp3S0a8ipR2/Qxk31vclDNM+GSdJOVs2KrsUCjblVA== dependencies: concat-stream "^2.0.0" - conventional-changelog-preset-loader "^2.3.4" - conventional-commits-filter "^2.0.7" - conventional-commits-parser "^3.2.0" - git-raw-commits "^2.0.8" - git-semver-tags "^4.1.1" - meow "^8.0.0" - q "^1.5.1" + conventional-changelog-preset-loader "^3.0.0" + conventional-commits-filter "^3.0.0" + conventional-commits-parser "^4.0.0" + git-raw-commits "^3.0.0" + git-semver-tags "^5.0.0" + meow "^8.1.2" convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.9.0" @@ -5549,7 +5924,7 @@ copy-webpack-plugin@^11.0.0: schema-utils "^4.0.0" serialize-javascript "^6.0.0" -core-js-compat@^3.21.0, core-js-compat@^3.25.1: +core-js-compat@^3.25.1: version "3.25.4" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.25.4.tgz#730a255d4a47a937513abf1672bf278dc24dcebf" integrity sha512-gCEcIEEqCR6230WroNunK/653CWKhqyCKJ9b+uESqOt/WFJA8B4lTnnQFdpYY5vmBcwJAA90Bo5vXs+CVsf6iA== @@ -5571,17 +5946,6 @@ core-util-is@^1.0.3, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -cosmiconfig@7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3" - integrity sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA== - dependencies: - "@types/parse-json" "^4.0.0" - import-fresh "^3.2.1" - parse-json "^5.0.0" - path-type "^4.0.0" - yaml "^1.10.0" - cosmiconfig@8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.0.0.tgz#e9feae014eab580f858f8a0288f38997a7bebe97" @@ -5614,37 +5978,36 @@ cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: path-type "^4.0.0" yaml "^1.10.0" +cosmiconfig@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.2.0.tgz#f7d17c56a590856cd1e7cee98734dca272b0d8fd" + integrity sha512-3rTMnFJA1tCOPwRxtgF4wd7Ab2qvDbL8jX+3smjIbS4HlZBagTlpERbdN7iAbWlrfxE3M8c27kTwTawQ7st+OQ== + dependencies: + import-fresh "^3.2.1" + js-yaml "^4.1.0" + parse-json "^5.0.0" + path-type "^4.0.0" + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-env@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" - integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== +cross-fetch@*, cross-fetch@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-4.0.0.tgz#f037aef1580bb3a1a35164ea2a848ba81b445983" + integrity sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g== dependencies: - cross-spawn "^7.0.1" + node-fetch "^2.6.12" -cross-fetch@^3.0.4, cross-fetch@^3.1.5: +cross-fetch@^3.0.4: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== dependencies: node-fetch "2.6.7" -cross-spawn@^6.0.5: - version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" - integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== - dependencies: - nice-try "^1.0.4" - path-key "^2.0.1" - semver "^5.5.0" - shebang-command "^1.2.0" - which "^1.2.9" - -cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -5658,66 +6021,66 @@ crypto-random-string@^2.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== -cspell-dictionary@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-dictionary/-/cspell-dictionary-6.30.2.tgz#11282342b5749cc33cc0c8c35114494e17360a98" - integrity sha512-ZRdN42T+9EknDzfWKg2CBKV1wH6/DIic6Y/DhKkHGcJ/02ys+5N587nR8zS5vB/d8Be4qOXVLFZ39nfdZ0vT1A== +cspell-dictionary@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-dictionary/-/cspell-dictionary-6.31.1.tgz#a5c52da365aa03d7b6454f017d97b0d4b3da8859" + integrity sha512-7+K7aQGarqbpucky26wled7QSCJeg6VkLUWS+hLjyf0Cqc9Zew5xsLa4QjReExWUJx+a97jbiflITZNuWxgMrg== dependencies: - "@cspell/cspell-pipe" "6.30.2" - "@cspell/cspell-types" "6.30.2" - cspell-trie-lib "6.30.2" + "@cspell/cspell-pipe" "6.31.1" + "@cspell/cspell-types" "6.31.1" + cspell-trie-lib "6.31.1" fast-equals "^4.0.3" gensequence "^5.0.2" -cspell-gitignore@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-gitignore/-/cspell-gitignore-6.30.2.tgz#896c8c9741b02d1bee1d022282befc376376e0d8" - integrity sha512-I/14FKE0CZTmx5HgAx3ieFk7k97hJkqin6w8VT/YiPf20lm2ca2VgXOMT+sndLw+cFIX1EdRU/KECRIYwipKXg== +cspell-gitignore@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-gitignore/-/cspell-gitignore-6.31.1.tgz#3000c4c6c740c04d6178c62a9b83111d5fc96779" + integrity sha512-PAcmjN6X89Z8qgjem6HYb+VmvVtKuc+fWs4sk21+jv2MiLk23Bkp+8slSaIDVR//58fxJkMx17PHyo2cDO/69A== dependencies: - cspell-glob "6.30.2" + cspell-glob "6.31.1" find-up "^5.0.0" -cspell-glob@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-6.30.2.tgz#16daa823a6ee59c6220efb36631f2689cd62fa2b" - integrity sha512-lINrcHJaUFkK0X3Je1uBTXozv41HvPsZBwQnHiXzKiuSin4oE7dQ+D/MQIa9UryvMfnJV/BeCiIDkuHO4oA17A== +cspell-glob@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-glob/-/cspell-glob-6.31.1.tgz#525db68469790f3d0c856fcdef7616dfbecfe1d2" + integrity sha512-ygEmr5hgE4QtO5+L3/ihfMKBhPipbapfS22ilksFSChKMc15Regds0z+z/1ZBoe+OFAPneQfIuBxMwQ/fB00GQ== dependencies: micromatch "^4.0.5" -cspell-grammar@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-grammar/-/cspell-grammar-6.30.2.tgz#a117ce65f30ab9c66d94c363fed50087768f0bfb" - integrity sha512-x9x80/uPwpXGLu2Vg/vb9Ncn1Mw8Y0Xzz2WXqzLufKyWk2S0tGHVvkDS6YkQRuK6gOabk5nDwhtnpwt93sgn1Q== +cspell-grammar@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-grammar/-/cspell-grammar-6.31.1.tgz#f766df3d5f1ec95a1e472fc339716757d2acfa56" + integrity sha512-AsRVP0idcNFVSb9+p9XjMumFj3BUV67WIPWApaAzJl/dYyiIygQObRE+si0/QtFWGNw873b7hNhWZiKjqIdoaQ== dependencies: - "@cspell/cspell-pipe" "6.30.2" - "@cspell/cspell-types" "6.30.2" + "@cspell/cspell-pipe" "6.31.1" + "@cspell/cspell-types" "6.31.1" -cspell-io@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-6.30.2.tgz#6653f3fd8e04ba7d29e5d157a6e4afd7dbeab44c" - integrity sha512-moklQX2sYf2QC60i6RQCzIXyNONrOqNCa99UH4bFwxaHltMMef3bBOuVoDDfs/9vjeEPVgBwWQi+PEuhbyKq4w== +cspell-io@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-io/-/cspell-io-6.31.1.tgz#5f26437e6e5d525a73c708bf524da50a180f3c2c" + integrity sha512-deZcpvTYY/NmLfOdOtzcm+nDvJZozKmj4TY3pPpX0HquPX0A/w42bFRT/zZNmRslFl8vvrCZZUog7SOc6ha3uA== dependencies: - "@cspell/cspell-service-bus" "6.30.2" + "@cspell/cspell-service-bus" "6.31.1" node-fetch "^2.6.9" -cspell-lib@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-6.30.2.tgz#5a93306bc0cc230dadd3c015afe4e168dcc080b2" - integrity sha512-5qkiRLGrjVV7unnobrma2V2istiDg9TEdY0UsBVGmjty57KXaoiSuTeEOmSS5QLp4IBF5Uo1P9F+Q3Svp8yCQw== +cspell-lib@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-lib/-/cspell-lib-6.31.1.tgz#716fe73302086d384e756ece917d50dafa6cfda4" + integrity sha512-KgSiulbLExY+z2jGwkO77+aAkyugsPAw7y07j3hTQLpd+0esPCZqrmbo2ItnkvkDNd/c34PqQCr7/044/rz8gw== dependencies: - "@cspell/cspell-bundled-dicts" "6.30.2" - "@cspell/cspell-pipe" "6.30.2" - "@cspell/cspell-types" "6.30.2" - "@cspell/strong-weak-map" "6.30.2" + "@cspell/cspell-bundled-dicts" "6.31.1" + "@cspell/cspell-pipe" "6.31.1" + "@cspell/cspell-types" "6.31.1" + "@cspell/strong-weak-map" "6.31.1" clear-module "^4.1.2" comment-json "^4.2.3" configstore "^5.0.1" cosmiconfig "8.0.0" - cspell-dictionary "6.30.2" - cspell-glob "6.30.2" - cspell-grammar "6.30.2" - cspell-io "6.30.2" - cspell-trie-lib "6.30.2" + cspell-dictionary "6.31.1" + cspell-glob "6.31.1" + cspell-grammar "6.31.1" + cspell-io "6.31.1" + cspell-trie-lib "6.31.1" fast-equals "^4.0.3" find-up "^5.0.0" gensequence "^5.0.2" @@ -5727,28 +6090,28 @@ cspell-lib@6.30.2: vscode-languageserver-textdocument "^1.0.8" vscode-uri "^3.0.7" -cspell-trie-lib@6.30.2: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-6.30.2.tgz#bd49e4cc0100b6579dead688d1cd83865725ac4e" - integrity sha512-xj8gmMKT4oz8740Rvy/d4hw9bRcyrCJ4q2O2nArJtpukURuW+UgYfwjyVqz2Zh+Lx86nNd7fEjPZM5+oIY5Vxw== +cspell-trie-lib@6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell-trie-lib/-/cspell-trie-lib-6.31.1.tgz#72b272e16d53c15de5a1ef3178dd2519670daca7" + integrity sha512-MtYh7s4Sbr1rKT31P2BK6KY+YfOy3dWsuusq9HnqCXmq6aZ1HyFgjH/9p9uvqGi/TboMqn1KOV8nifhXK3l3jg== dependencies: - "@cspell/cspell-pipe" "6.30.2" - "@cspell/cspell-types" "6.30.2" + "@cspell/cspell-pipe" "6.31.1" + "@cspell/cspell-types" "6.31.1" gensequence "^5.0.2" -cspell@^6.0.0: - version "6.30.2" - resolved "https://registry.yarnpkg.com/cspell/-/cspell-6.30.2.tgz#2df9710faca930c1746dd45bc977c1983e2f2e81" - integrity sha512-2++f3cA4bCDON0Evd0D5GvhUU25yQx6Mhrm+DDBapBXKo6oXHn88mLNWU9csc6oVXrUcCAx3uH5U6FNKEiKGQQ== +cspell@^6.31.1: + version "6.31.1" + resolved "https://registry.yarnpkg.com/cspell/-/cspell-6.31.1.tgz#78a1b3d32c8f6f232fb1a00b2df8a8e8d72cf6fe" + integrity sha512-gyCtpkOpwI/TGibbtIgMBFnAUUp2hnYdvW/9Ky4RcneHtLH0+V/jUEbZD8HbRKz0GVZ6mhKWbNRSEyP9p3Cejw== dependencies: - "@cspell/cspell-pipe" "6.30.2" - "@cspell/dynamic-import" "6.30.2" + "@cspell/cspell-pipe" "6.31.1" + "@cspell/dynamic-import" "6.31.1" chalk "^4.1.2" commander "^10.0.0" - cspell-gitignore "6.30.2" - cspell-glob "6.30.2" - cspell-io "6.30.2" - cspell-lib "6.30.2" + cspell-gitignore "6.31.1" + cspell-glob "6.31.1" + cspell-io "6.31.1" + cspell-lib "6.31.1" fast-glob "^3.2.12" fast-json-stable-stringify "^2.1.0" file-entry-cache "^6.0.1" @@ -5763,6 +6126,11 @@ css-declaration-sorter@^6.3.0: resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-6.3.0.tgz#72ebd995c8f4532ff0036631f7365cce9759df14" integrity sha512-OGT677UGHJTAVMRhPO+HJ4oKln3wkBTwtDFH0ojbqm+MJm6xuDMHp2nkhh/ThaBqq20IbraBQSWKfSLNHQO9Og== +css-functions-list@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/css-functions-list/-/css-functions-list-3.1.0.tgz#cf5b09f835ad91a00e5959bcfc627cd498e1321b" + integrity sha512-/9lCvYZaUbBGvYUgYGFJ4dcYiyqdhSjG7IPVluoV8A1ILjkF7ilmhp1OGUz8n+nmBcu0RNrQAzgD8B6FJbrt2w== + css-loader@^6.7.1: version "6.7.1" resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-6.7.1.tgz#e98106f154f6e1baf3fc3bc455cb9981c1d5fd2e" @@ -5819,6 +6187,14 @@ css-tree@^1.1.2, css-tree@^1.1.3: mdn-data "2.0.14" source-map "^0.6.1" +css-tree@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-2.3.1.tgz#10264ce1e5442e8572fc82fbe490644ff54b5c20" + integrity sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw== + dependencies: + mdn-data "2.0.30" + source-map-js "^1.0.1" + css-what@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.1.0.tgz#3f7b707aadf633baf62c2ceb8579b545bb40f7fe" @@ -5903,17 +6279,9 @@ csso@^4.2.0: css-tree "^1.1.2" csstype@^3.0.2: - version "3.0.9" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.9.tgz#6410af31b26bd0520933d02cbc64fce9ce3fbf0b" - integrity sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw== - -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" + version "3.1.2" + resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.2.tgz#1d4bf9d572f11c14031f0436e1c10bc1f571f50b" + integrity sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ== damerau-levenshtein@^1.0.8: version "1.0.8" @@ -5925,7 +6293,12 @@ dargs@^7.0.0: resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== -dateformat@^3.0.0: +data-uri-to-buffer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" + integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== + +dateformat@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae" integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q== @@ -5944,6 +6317,13 @@ debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: dependencies: ms "2.1.2" +debug@4.3.1: + version "4.3.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" + integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + dependencies: + ms "2.1.2" + debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -5951,11 +6331,6 @@ debug@^3.2.7: dependencies: ms "^2.1.1" -debuglog@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" - integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= - decamelize-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9" @@ -5969,6 +6344,16 @@ decamelize@^1.1.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + +decamelize@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-5.0.1.tgz#db11a92e58c741ef339fb0a2868d8a06a9a7b1e9" + integrity sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA== + decompress-response@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" @@ -5981,6 +6366,13 @@ dedent@0.7.0, dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== +deep-eql@^4.1.2: + version "4.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" + integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== + dependencies: + type-detect "^4.0.0" + deep-equal@^2.0.5: version "2.2.0" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.2.0.tgz#5caeace9c781028b9ff459f33b779346637c43e6" @@ -6125,32 +6517,34 @@ detect-port-alt@^1.1.6: address "^1.0.1" debug "^2.6.0" -detect-port@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/detect-port/-/detect-port-1.3.0.tgz#d9c40e9accadd4df5cac6a782aefd014d573d1f1" - integrity sha512-E+B1gzkl2gqxt1IhUzwjrxBKRqx1UzC3WLONHinn8S3T6lwV/agVCyitiFOsGJ/eYuEUBvD71MZHy3Pv1G9doQ== +detect-port@^1.3.0, detect-port@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/detect-port/-/detect-port-1.5.1.tgz#451ca9b6eaf20451acb0799b8ab40dff7718727b" + integrity sha512-aBzdj76lueB6uUst5iAs7+0H/oOjqI5D16XUWxlWMIMROhcM0rfsNVk93zTngq1dDNpoXRr++Sus7ETAExppAQ== dependencies: address "^1.0.1" - debug "^2.6.0" - -dezalgo@^1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/dezalgo/-/dezalgo-1.0.3.tgz#7f742de066fc748bc8db820569dddce49bf0d456" - integrity sha1-f3Qt4Gb8dIvI24IFad3c5Jvw1FY= - dependencies: - asap "^2.0.0" - wrappy "1" + debug "4" diff-sequences@^29.4.3: version "29.4.3" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== +diff@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== + diff@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +diff@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.1.0.tgz#bc52d298c5ea8df9194800224445ed43ffc87e40" + integrity sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw== + dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -6254,13 +6648,6 @@ dot-case@^3.0.4: no-case "^3.0.4" tslib "^2.0.3" -dot-prop@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083" - integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA== - dependencies: - is-obj "^2.0.0" - dot-prop@^5.1.0, dot-prop@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-5.3.0.tgz#90ccce708cd9cd82cc4dc8c3ddd9abdd55b20e88" @@ -6309,10 +6696,10 @@ ejs@^3.1.6, ejs@^3.1.7: dependencies: jake "^10.8.5" -electron-to-chromium@^1.4.284: - version "1.4.334" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.334.tgz#eacdcb1145534202d569610c5915b63a3fec0eb9" - integrity sha512-laZ1odk+TRen6q0GeyQx/JEkpD3iSZT7ewopCpKqg9bTjP1l8XRfU3Bg20CFjNPZkp5+NDBl3iqd4o/kPO+Vew== +electron-to-chromium@^1.4.431: + version "1.4.461" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.461.tgz#6b14af66042732bf883ab63a4d82cac8f35eb252" + integrity sha512-1JkvV2sgEGTDXjdsaQCeSwYYuhLRphRpc+g6EHTFELJXEiznLt3/0pZ9JuAOQ5p2rI3YxKTbivtvajirIfhrEQ== emittery@^0.13.1: version "0.13.1" @@ -6363,10 +6750,10 @@ end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" -enhanced-resolve@^5.10.0: - version "5.10.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz#0dc579c3bb2a1032e357ac45b8f3a6f3ad4fb1e6" - integrity sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ== +enhanced-resolve@^5.15.0: + version "5.15.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" + integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -6398,7 +6785,7 @@ env-paths@^2.2.0: resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== -envinfo@^7.7.4: +envinfo@7.8.1: version "7.8.1" resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.8.1.tgz#06377e3e5f4d379fea7ac592d5ad8927e0c4d475" integrity sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw== @@ -6470,10 +6857,10 @@ es-get-iterator@^1.1.2: isarray "^2.0.5" stop-iteration-iterator "^1.0.0" -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-module-lexer@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-1.2.1.tgz#ba303831f63e6a394983fde2f97ad77b22324527" + integrity sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg== es-set-tostringtag@^2.0.1: version "2.0.1" @@ -6500,69 +6887,33 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@^0.10.53, es5-ext@^0.10.61, es5-ext@~0.10.14, es5-ext@~0.10.2, es5-ext@~0.10.46: - version "0.10.61" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.61.tgz#311de37949ef86b6b0dcea894d1ffedb909d3269" - integrity sha512-yFhIqQAzu2Ca2I4SE2Au3rxVfmohU9Y7wqGR+s7+H7krk26NXhIRAZDgqd6xqjCEFUomDEA3/Bo/7fKmIkW1kA== - dependencies: - es6-iterator "^2.0.3" - es6-symbol "^3.1.3" - next-tick "^1.1.0" - -es6-iterator@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g== - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-symbol@^3.1.1, es6-symbol@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - -es6-weak-map@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" - integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== - dependencies: - d "1" - es5-ext "^0.10.46" - es6-iterator "^2.0.3" - es6-symbol "^3.1.1" - -esbuild@~0.17.6: - version "0.17.12" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.12.tgz#2ad7523bf1bc01881e9d904bc04e693bd3bdcf2f" - integrity sha512-bX/zHl7Gn2CpQwcMtRogTTBf9l1nl+H6R8nUbjk+RuKqAE3+8FDulLA+pHvX7aA7Xe07Iwa+CWvy9I8Y2qqPKQ== +esbuild@~0.17.19, esbuild@~0.17.6: + version "0.17.19" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" + integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== optionalDependencies: - "@esbuild/android-arm" "0.17.12" - "@esbuild/android-arm64" "0.17.12" - "@esbuild/android-x64" "0.17.12" - "@esbuild/darwin-arm64" "0.17.12" - "@esbuild/darwin-x64" "0.17.12" - "@esbuild/freebsd-arm64" "0.17.12" - "@esbuild/freebsd-x64" "0.17.12" - "@esbuild/linux-arm" "0.17.12" - "@esbuild/linux-arm64" "0.17.12" - "@esbuild/linux-ia32" "0.17.12" - "@esbuild/linux-loong64" "0.17.12" - "@esbuild/linux-mips64el" "0.17.12" - "@esbuild/linux-ppc64" "0.17.12" - "@esbuild/linux-riscv64" "0.17.12" - "@esbuild/linux-s390x" "0.17.12" - "@esbuild/linux-x64" "0.17.12" - "@esbuild/netbsd-x64" "0.17.12" - "@esbuild/openbsd-x64" "0.17.12" - "@esbuild/sunos-x64" "0.17.12" - "@esbuild/win32-arm64" "0.17.12" - "@esbuild/win32-ia32" "0.17.12" - "@esbuild/win32-x64" "0.17.12" + "@esbuild/android-arm" "0.17.19" + "@esbuild/android-arm64" "0.17.19" + "@esbuild/android-x64" "0.17.19" + "@esbuild/darwin-arm64" "0.17.19" + "@esbuild/darwin-x64" "0.17.19" + "@esbuild/freebsd-arm64" "0.17.19" + "@esbuild/freebsd-x64" "0.17.19" + "@esbuild/linux-arm" "0.17.19" + "@esbuild/linux-arm64" "0.17.19" + "@esbuild/linux-ia32" "0.17.19" + "@esbuild/linux-loong64" "0.17.19" + "@esbuild/linux-mips64el" "0.17.19" + "@esbuild/linux-ppc64" "0.17.19" + "@esbuild/linux-riscv64" "0.17.19" + "@esbuild/linux-s390x" "0.17.19" + "@esbuild/linux-x64" "0.17.19" + "@esbuild/netbsd-x64" "0.17.19" + "@esbuild/openbsd-x64" "0.17.19" + "@esbuild/sunos-x64" "0.17.19" + "@esbuild/win32-arm64" "0.17.19" + "@esbuild/win32-ia32" "0.17.19" + "@esbuild/win32-x64" "0.17.19" escalade@^3.1.1: version "3.1.1" @@ -6579,6 +6930,11 @@ escape-html@^1.0.3, escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg= +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -6589,11 +6945,6 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - eslint-import-resolver-node@^0.3.7: version "0.3.7" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz#83b375187d412324a1963d84fa664377a23eb4d7" @@ -6610,12 +6961,12 @@ eslint-module-utils@^2.7.4: dependencies: debug "^3.2.7" -eslint-plugin-deprecation@^1.3.2: - version "1.3.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-deprecation/-/eslint-plugin-deprecation-1.3.3.tgz#065b5d36ff220afe139f2b19af57454a13464731" - integrity sha512-Bbkv6ZN2cCthVXz/oZKPwsSY5S/CbgTLRG4Q2s2gpPpgNsT0uJ0dB5oLNiWzFYY8AgKX4ULxXFG1l/rDav9QFA== +eslint-plugin-deprecation@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-deprecation/-/eslint-plugin-deprecation-1.4.1.tgz#09a2889210955fd1a5c37703922c01724aba80eb" + integrity sha512-4vxTghWzxsBukPJVQupi6xlTuDc8Pyi1QlRCrFiLgwLPMJQW3cJCNaehJUKQqQFvuue5m4W27e179Y3Qjzeghg== dependencies: - "@typescript-eslint/experimental-utils" "^5.0.0" + "@typescript-eslint/utils" "^5.57.0" tslib "^2.3.1" tsutils "^3.21.0" @@ -6627,15 +6978,15 @@ eslint-plugin-eslint-comments@^3.2.0: escape-string-regexp "^1.0.5" ignore "^5.0.5" -eslint-plugin-eslint-plugin@^5.0.1: - version "5.0.8" - resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-5.0.8.tgz#b0a04e874a52176f129270b8773a4635ce5be14f" - integrity sha512-bxPMZ3L/+5YypErWQMKUI9XdkLpgqOOO0CgbtHjk5Zxzcg4EVsWYPy8duvGSLxSyR60LBIoXNzVMueEZ3/j0AQ== +eslint-plugin-eslint-plugin@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-plugin/-/eslint-plugin-eslint-plugin-5.1.0.tgz#040e08aa057d187418acae9d7c336b156ba1db07" + integrity sha512-HOzgLRSZJdEZpLaXbA3qd/4Sfa09W6NTzDBqWd5zeQNc1wnsGfGYGE2Rr8nVDeckyFT5u7GlU+lYrXF89UyECg== dependencies: eslint-utils "^3.0.0" estraverse "^5.3.0" -eslint-plugin-import@^2.26.0: +eslint-plugin-import@^2.27.5: version "2.27.5" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz#876a6d03f52608a3e5bb439c2550588e51dd6c65" integrity sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow== @@ -6656,14 +7007,14 @@ eslint-plugin-import@^2.26.0: semver "^6.3.0" tsconfig-paths "^3.14.1" -eslint-plugin-jest@^27.0.0: - version "27.2.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.1.tgz#b85b4adf41c682ea29f1f01c8b11ccc39b5c672c" - integrity sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg== +eslint-plugin-jest@^27.2.2: + version "27.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.3.tgz#6f8a4bb2ca82c0c5d481d1b3be256ab001f5a3ec" + integrity sha512-sRLlSCpICzWuje66Gl9zvdF6mwD5X86I4u55hJyFBsxYOsBCmT5+kSUjf+fkFWVMMgpzNEupjW8WzUqi83hJAQ== dependencies: "@typescript-eslint/utils" "^5.10.0" -eslint-plugin-jsx-a11y@^6.5.1: +eslint-plugin-jsx-a11y@^6.7.1: version "6.7.1" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz#fca5e02d115f48c9a597a6894d5bcec2f7a76976" integrity sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA== @@ -6685,12 +7036,12 @@ eslint-plugin-jsx-a11y@^6.5.1: object.fromentries "^2.0.6" semver "^6.3.0" -eslint-plugin-react-hooks@^4.5.0: +eslint-plugin-react-hooks@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== -eslint-plugin-react@^7.29.4: +eslint-plugin-react@^7.32.2: version "7.32.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.32.2.tgz#e71f21c7c265ebce01bcbc9d0955170c55571f10" integrity sha512-t2fBMa+XzonrrNkyVirzKlvn5RXzzPwRHtMvLAtVZrt8oxgnTQaYbU6SXTOO1mwQgp1y5+toMSKInnzGr0Knqg== @@ -6716,24 +7067,24 @@ eslint-plugin-simple-import-sort@^10.0.0: resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz#cc4ceaa81ba73252427062705b64321946f61351" integrity sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw== -eslint-plugin-unicorn@^46.0.0: - version "46.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-46.0.0.tgz#b5cdcc9465fd6e46ab7968b87dd4a43adc8d6031" - integrity sha512-j07WkC+PFZwk8J33LYp6JMoHa1lXc1u6R45pbSAipjpfpb7KIGr17VE2D685zCxR5VL4cjrl65kTJflziQWMDA== +eslint-plugin-unicorn@^47.0.0: + version "47.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-47.0.0.tgz#960e9d3789f656ba3e21982420793b069a911011" + integrity sha512-ivB3bKk7fDIeWOUmmMm9o3Ax9zbMz1Bsza/R2qm46ufw4T6VBFBaJIR1uN3pCKSmSXm8/9Nri8V+iUut1NhQGA== dependencies: "@babel/helper-validator-identifier" "^7.19.1" - "@eslint-community/eslint-utils" "^4.1.2" - ci-info "^3.6.1" + "@eslint-community/eslint-utils" "^4.4.0" + ci-info "^3.8.0" clean-regexp "^1.0.0" - esquery "^1.4.0" + esquery "^1.5.0" indent-string "^4.0.0" - is-builtin-module "^3.2.0" + is-builtin-module "^3.2.1" jsesc "^3.0.2" lodash "^4.17.21" pluralize "^8.0.0" read-pkg-up "^7.0.1" regexp-tree "^0.1.24" - regjsparser "^0.9.1" + regjsparser "^0.10.0" safe-regex "^2.1.1" semver "^7.3.8" strip-indent "^3.0.0" @@ -6746,10 +7097,10 @@ eslint-scope@5.1.1, eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.0: + version "7.2.1" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.1.tgz#936821d3462675f25a18ac5fd88a67cc15b393bd" + integrity sha512-CvefSOsDdaYYvxChovdrPo/ZGt8d5lrJWleAc1diXRKhHGiTYEI26cvo8Kle/wGnsizoCJjK73FMg1/IkIwiNA== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -6761,26 +7112,21 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" - integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== - -eslint-visitor-keys@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826" - integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== +eslint-visitor-keys@*, eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994" + integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA== -eslint@*, eslint@^8.15.0: - version "8.36.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.36.0.tgz#1bd72202200a5492f91803b113fb8a83b11285cf" - integrity sha512-Y956lmS7vDqomxlaaQAHVmeb4tNMp2FWIvU/RnU5BD3IKMD/MJPr76xdyr68P8tV1iNMvN2mRK0yy3c+UjL+bw== +eslint@*, eslint@^8.44.0: + version "8.45.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.45.0.tgz#bab660f90d18e1364352c0a6b7c6db8edb458b78" + integrity sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.4.0" - "@eslint/eslintrc" "^2.0.1" - "@eslint/js" "8.36.0" - "@humanwhocodes/config-array" "^0.11.8" + "@eslint/eslintrc" "^2.1.0" + "@eslint/js" "8.44.0" + "@humanwhocodes/config-array" "^0.11.10" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" ajv "^6.10.0" @@ -6789,9 +7135,9 @@ eslint@*, eslint@^8.15.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" - eslint-visitor-keys "^3.3.0" - espree "^9.5.0" + eslint-scope "^7.2.0" + eslint-visitor-keys "^3.4.1" + espree "^9.6.0" esquery "^1.4.2" esutils "^2.0.2" fast-deep-equal "^3.1.3" @@ -6799,39 +7145,36 @@ eslint@*, eslint@^8.15.0: find-up "^5.0.0" glob-parent "^6.0.2" globals "^13.19.0" - grapheme-splitter "^1.0.4" + graphemer "^1.4.0" ignore "^5.2.0" - import-fresh "^3.0.0" imurmurhash "^0.1.4" is-glob "^4.0.0" is-path-inside "^3.0.3" - js-sdsl "^4.1.4" js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.1.2" natural-compare "^1.4.0" - optionator "^0.9.1" + optionator "^0.9.3" strip-ansi "^6.0.1" - strip-json-comments "^3.1.0" text-table "^0.2.0" -espree@^9.5.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.0.tgz#3646d4e3f58907464edba852fa047e6a27bdf113" - integrity sha512-JPbJGhKc47++oo4JkEoTe2wjy4fmMwvFpgJT9cQzmfXKp22Dr6Hf1tdCteLz1h0P3t+mGvWZ+4Uankvh8+c6zw== +espree@^9.6.0: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: - acorn "^8.8.0" + acorn "^8.9.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.3.0" + eslint-visitor-keys "^3.4.1" esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@*, esquery@^1.0.1, esquery@^1.4.0, esquery@^1.4.2: +esquery@*, esquery@^1.4.0, esquery@^1.4.2, esquery@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== @@ -6860,20 +7203,15 @@ estree-walker@^1.0.1: resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== -estree-walker@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" - integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== - esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -eta@^1.12.3: - version "1.12.3" - resolved "https://registry.yarnpkg.com/eta/-/eta-1.12.3.tgz#2982d08adfbef39f9fa50e2fbd42d7337e7338b1" - integrity sha512-qHixwbDLtekO/d51Yr4glcaUJCIjGVJyTzuqV4GPlgZo1YpgOKG+avQynErZIYrfM6JIJdtiG2Kox8tbb+DoGg== +eta@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/eta/-/eta-2.0.1.tgz#199e675359cb6e19d38f29e1f405e1ba0e79a6df" + integrity sha512-46E2qDPDm7QA+usjffUWz9KfXsxVZclPOuKsXs4ZWZdI/X1wpDF7AO424pt7fdYohCzWsIkXAhNGXSlwo5naAg== etag@~1.8.1: version "1.8.1" @@ -6888,14 +7226,6 @@ eval@^0.1.8: "@types/node" "*" require-like ">= 0.1.1" -event-emitter@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - integrity sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA== - dependencies: - d "1" - es5-ext "~0.10.14" - eventemitter3@^4.0.0, eventemitter3@^4.0.4: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" @@ -6906,6 +7236,21 @@ events@^3.2.0: resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== +execa@*, execa@7.1.1, execa@^7.0.0: + version "7.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.1.1.tgz#3eb3c83d239488e7b409d48e8813b76bb55c9c43" + integrity sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.1" + human-signals "^4.3.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^3.0.7" + strip-final-newline "^3.0.0" + execa@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-5.0.0.tgz#4029b0007998a841fbd1032e5f4de86a3c1e3376" @@ -6921,7 +7266,7 @@ execa@5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -execa@5.1.1, execa@^5.0.0: +execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== @@ -6936,36 +7281,22 @@ execa@5.1.1, execa@^5.0.0: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -execa@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-7.1.1.tgz#3eb3c83d239488e7b409d48e8813b76bb55c9c43" - integrity sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.1" - human-signals "^4.3.0" - is-stream "^3.0.0" - merge-stream "^2.0.0" - npm-run-path "^5.1.0" - onetime "^6.0.0" - signal-exit "^3.0.7" - strip-final-newline "^3.0.0" - exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect@^29.0.0, expect@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.5.0.tgz#68c0509156cb2a0adb8865d413b137eeaae682f7" - integrity sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg== +expect@^29.0.0, expect@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.6.1.tgz#64dd1c8f75e2c0b209418f2b8d36a07921adfdf1" + integrity sha512-XEdDLonERCU1n9uR56/Stx9OqojaLAQtZf9PrCHH9Hl8YXiEIka3H4NXJ3NOIBmQJTg7+j7buh34PMHfJujc8g== dependencies: - "@jest/expect-utils" "^29.5.0" + "@jest/expect-utils" "^29.6.1" + "@types/node" "*" jest-get-type "^29.4.3" - jest-matcher-utils "^29.5.0" - jest-message-util "^29.5.0" - jest-util "^29.5.0" + jest-matcher-utils "^29.6.1" + jest-message-util "^29.6.1" + jest-util "^29.6.1" express@^4.17.3: version "4.18.1" @@ -7004,13 +7335,6 @@ express@^4.17.3: utils-merge "1.0.1" vary "~1.1.2" -ext@^1.1.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" - integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== - dependencies: - type "^2.5.0" - extend-shallow@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" @@ -7053,10 +7377,10 @@ fast-glob@3.2.7: merge2 "^1.3.0" micromatch "^4.0.4" -fast-glob@^3.2.11, fast-glob@^3.2.12, fast-glob@^3.2.9: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== +fast-glob@^3.2.11, fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.0.tgz#7c40cb491e1e2ed5664749e87bfb516dbe8727c0" + integrity sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -7081,6 +7405,11 @@ fast-url-parser@1.1.3: dependencies: punycode "^1.3.2" +fastest-levenshtein@^1.0.16: + version "1.0.16" + resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" + integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg== + fastq@^1.6.0: version "1.15.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" @@ -7134,6 +7463,14 @@ feed@^4.2.2: dependencies: xml-js "^1.6.11" +fetch-blob@^3.1.2, fetch-blob@^3.1.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" + integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== + dependencies: + node-domexception "^1.0.0" + web-streams-polyfill "^3.0.3" + figures@3.2.0, figures@^3.0.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" @@ -7197,6 +7534,14 @@ find-cache-dir@^3.3.1: make-dir "^3.0.2" pkg-dir "^4.1.0" +find-up@5.0.0, find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + find-up@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -7219,14 +7564,6 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -find-up@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - find-yarn-workspace-root@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" @@ -7260,7 +7597,7 @@ flux@^4.0.1: fbemitter "^3.0.0" fbjs "^3.0.0" -follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.7, follow-redirects@^1.15.0: +follow-redirects@^1.0.0, follow-redirects@^1.14.7, follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== @@ -7272,6 +7609,14 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +foreground-child@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.1.1.tgz#1d173e776d75d2772fed08efe4a0de1ea1b12d0d" + integrity sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + fork-ts-checker-webpack-plugin@^6.5.0: version "6.5.0" resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-6.5.0.tgz#0282b335fa495a97e167f69018f566ea7d2a2b5e" @@ -7300,6 +7645,13 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +formdata-polyfill@^4.0.10: + version "4.0.10" + resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" + integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== + dependencies: + fetch-blob "^3.1.2" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -7320,35 +7672,35 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@9.1.0, fs-extra@^9.0.0, fs-extra@^9.0.1, fs-extra@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== +fs-extra@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" + integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== dependencies: - at-least-node "^1.0.0" graceful-fs "^4.2.0" jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" - integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== +fs-extra@^11.1.0, fs-extra@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d" + integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ== dependencies: graceful-fs "^4.2.0" jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.0.tgz#5784b102104433bb0e090f48bfc4a30742c357ed" - integrity sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw== +fs-extra@^9.0.0, fs-extra@^9.0.1: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== dependencies: + at-least-node "^1.0.0" graceful-fs "^4.2.0" jsonfile "^6.0.1" universalify "^2.0.0" -fs-extra@^7.0.1, fs-extra@~7.0.1: +fs-extra@~7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== @@ -7364,6 +7716,13 @@ fs-minipass@^2.0.0, fs-minipass@^2.1.0: dependencies: minipass "^3.0.0" +fs-minipass@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-3.0.1.tgz#853809af15b6d03e27638d1ab6432e6b378b085d" + integrity sha512-MhaJDcFRTuLidHrIttu0RDGyyXs/IYHVmlcxfLAEFIWjc1vdLAkdwT7Ace2u7DbitWC0toKMl5eJZRYNVreIMw== + dependencies: + minipass "^4.0.0" + fs-monkey@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.3.tgz#ae3ac92d53bb328efe0e9a1d9541f6ad8d48e2d3" @@ -7374,7 +7733,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@2.3.2, fsevents@^2.3.2, fsevents@~2.3.2: +fsevents@2.3.2, fsevents@^2.3.2, fsevents@~2.3.1, fsevents@~2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== @@ -7428,13 +7787,19 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-func-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" + integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== + get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.0.tgz#7ad1dc0535f3a2904bba075772763e5051f6d05f" - integrity sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q== + version "1.2.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.1.tgz#d295644fed4505fc9cde952c37ee12b477a83d82" + integrity sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw== dependencies: function-bind "^1.1.1" has "^1.0.3" + has-proto "^1.0.1" has-symbols "^1.0.3" get-own-enumerable-property-symbols@^3.0.0: @@ -7447,7 +7812,7 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-pkg-repo@^4.0.0: +get-pkg-repo@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/get-pkg-repo/-/get-pkg-repo-4.2.1.tgz#75973e1c8050c73f48190c52047c4cee3acbf385" integrity sha512-2+QbHjFRfGB74v/pYWjd5OhU3TDIC2Gv/YKUTk/tCvAz0pkn/Mz6P3uByuBimLOcPvN2jYdScl3xGFSrx0jEcA== @@ -7505,20 +7870,18 @@ get-symbol-description@^1.0.0: get-intrinsic "^1.1.1" get-tsconfig@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.4.0.tgz#64eee64596668a81b8fce18403f94f245ee0d4e5" - integrity sha512-0Gdjo/9+FzsYhXCEFueo2aY1z1tpXrxWZzP7k8ul9qt1U5o8rYJwTJYmaeHdrVosYIVYkOy2iwCJ9FdpocJhPQ== + version "4.5.0" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.5.0.tgz#6d52d1c7b299bd3ee9cd7638561653399ac77b0f" + integrity sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ== -git-raw-commits@^2.0.8: - version "2.0.10" - resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.10.tgz#e2255ed9563b1c9c3ea6bd05806410290297bbc1" - integrity sha512-sHhX5lsbG9SOO6yXdlwgEMQ/ljIn7qMpAbJZCGfXX2fq5T8M5SrDnpYk9/4HswTildcIqatsWa91vty6VhWSaQ== +git-raw-commits@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" + integrity sha512-b5OHmZ3vAgGrDn/X0kS+9qCfNKWe4K/jFnhwzVWWg0/k5eLa3060tZShrRg8Dja5kPc+YjS0Gc6y7cRr44Lpjw== dependencies: dargs "^7.0.0" - lodash "^4.17.15" - meow "^8.0.0" - split2 "^3.0.0" - through2 "^4.0.0" + meow "^8.1.2" + split2 "^3.2.2" git-remote-origin-url@^2.0.0: version "2.0.0" @@ -7528,13 +7891,13 @@ git-remote-origin-url@^2.0.0: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-4.1.1.tgz#63191bcd809b0ec3e151ba4751c16c444e5b5780" - integrity sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA== +git-semver-tags@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-5.0.0.tgz#775ff55effae0b50b755448408de6cd56ce293e2" + integrity sha512-fZ+tmZ1O5aXW/T5nLzZLbxWAHdQTLLXalOECMNAmhoEQSfqZjtaeMjpsXH4C5qVhrICTkVQeQFujB1lKzIHljA== dependencies: - meow "^8.0.0" - semver "^6.0.0" + meow "^8.1.2" + semver "^6.3.0" git-up@^7.0.0: version "7.0.0" @@ -7563,7 +7926,7 @@ github-slugger@^1.4.0: resolved "https://registry.yarnpkg.com/github-slugger/-/github-slugger-1.4.0.tgz#206eb96cdb22ee56fdc53a28d5a302338463444e" integrity sha512-w0dzqw/nt51xMVmlaV1+JRzN+oCa1KfcgGEWhxUG16wbdA+Xnt/yoFO8Z8x/V82ZcZ0wy6ln9QDup5avbhiDhQ== -glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@5.1.2, glob-parent@^5.1.2, glob-parent@~5.1.0, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -7577,28 +7940,21 @@ glob-parent@^6.0.1, glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob-promise@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/glob-promise/-/glob-promise-4.2.2.tgz#15f44bcba0e14219cd93af36da6bb905ff007877" - integrity sha512-xcUzJ8NWN5bktoTIX7eOclO1Npxd/dyVqUJxlLIDasT4C7KZyqlPIwkdJ0Ypiy3p2ZKahTjK4M9uC3sNSfNMzw== - dependencies: - "@types/glob" "^7.1.3" - glob-to-regexp@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@*, glob@^8.0.1, glob@^8.0.3: - version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== +glob@*, glob@^10.2.2, glob@^10.2.5, glob@^10.3.3: + version "10.3.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.3.tgz#8360a4ffdd6ed90df84aa8d52f21f452e86a123b" + integrity sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw== dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" + foreground-child "^3.1.0" + jackspeak "^2.0.3" + minimatch "^9.0.1" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-scurry "^1.10.1" glob@7.1.4: version "7.1.4" @@ -7612,6 +7968,18 @@ glob@7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" +glob@7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^7.0.0, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -7624,10 +7992,10 @@ glob@^7.0.0, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@~8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" - integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== +glob@^8.0.1: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" @@ -7635,6 +8003,27 @@ glob@~8.0.3: minimatch "^5.0.1" once "^1.3.0" +glob@^9.2.0, glob@^9.3.1: + version "9.3.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-9.3.5.tgz#ca2ed8ca452781a3009685607fdf025a899dfe21" + integrity sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q== + dependencies: + fs.realpath "^1.0.0" + minimatch "^8.0.2" + minipass "^4.2.4" + path-scurry "^1.6.1" + +glob@~10.2.7: + version "10.2.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.2.7.tgz#9dd2828cd5bc7bd861e7738d91e7113dda41d7d8" + integrity sha512-jTKehsravOJo8IJxUGfZILnkvVJM/MOfHRs8QcXolVef2zNI9Tqyy5+SeuOAZd3upViEZQLyFpQhYiHLrMUNmA== + dependencies: + foreground-child "^3.1.0" + jackspeak "^2.0.3" + minimatch "^9.0.1" + minipass "^5.0.0 || ^6.0.2" + path-scurry "^1.7.0" + global-dirs@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-0.1.1.tgz#b319c0dd4607f353f3be9cca4c72fc148c49f445" @@ -7707,6 +8096,11 @@ globby@^13.1.1: merge2 "^1.4.1" slash "^4.0.0" +globjoin@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/globjoin/-/globjoin-0.1.4.tgz#2f4494ac8919e3767c5cbb691e9f463324285d43" + integrity sha512-xYfnw62CKG8nLkZBfWbhWwDw02CHty86jfPcc2cr3ZfeuK9ysoVPPEUxf21bAD/rWAgk52SuBrLJlefNy8mvFg== + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -7731,20 +8125,15 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@4.2.10: - version "4.2.10" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" - integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== - -graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@4.2.11, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== -grapheme-splitter@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz#9cf3a665c6247479896834af35cf1dbb4400767e" - integrity sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== gray-matter@^4.0.3: version "4.0.3" @@ -7756,6 +8145,11 @@ gray-matter@^4.0.3: section-matter "^1.0.0" strip-bom-string "^1.0.0" +growl@1.10.5: + version "1.10.5" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" + integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== + gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462" @@ -7768,7 +8162,7 @@ handle-thing@^2.0.0: resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" integrity sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg== -handlebars@^4.7.6: +handlebars@^4.7.7: version "4.7.7" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== @@ -7919,7 +8313,7 @@ hastscript@^6.0.0: property-information "^5.0.0" space-separated-tokens "^1.0.0" -he@^1.2.0: +he@1.2.0, he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -7962,10 +8356,10 @@ hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: dependencies: lru-cache "^6.0.0" -hosted-git-info@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-5.0.0.tgz#df7a06678b4ebd722139786303db80fdf302ea56" - integrity sha512-rRnjWu0Bxj+nIfUOkz0695C0H6tRrN5iYIzYejb0tDEefe2AekHu/U5Kn9pEie5vsJqpNQU02az7TGSH3qpz4Q== +hosted-git-info@^6.0.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-6.1.1.tgz#629442c7889a69c05de604d52996b74fe6f26d58" + integrity sha512-r0EI+HBMcXadMrugk0GCQ+6BQV39PiWAZVfq7oIckeGiN7sjRGyQxPdft3nQekFTCQbYxLBH+/axZMeH8UX6+w== dependencies: lru-cache "^7.5.1" @@ -8002,10 +8396,10 @@ html-minifier-terser@^6.0.2, html-minifier-terser@^6.1.0: relateurl "^0.2.7" terser "^5.10.0" -html-tags@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.2.0.tgz#dbb3518d20b726524e4dd43de397eb0a95726961" - integrity sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg== +html-tags@^3.2.0, html-tags@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.3.1.tgz#a04026a18c882e4bba8a01a3d39cfe465d40b5ce" + integrity sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ== html-void-elements@^1.0.0: version "1.0.5" @@ -8043,10 +8437,10 @@ htmlparser2@^8.0.1: domutils "^3.0.1" entities "^4.3.0" -http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz#49e91c5cbf36c9b94bcfcd71c23d5249ec74e390" - integrity sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ== +http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" + integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== http-deceiver@^1.2.7: version "1.2.7" @@ -8133,7 +8527,7 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -husky@^8.0.1: +husky@^8.0.3: version "8.0.3" resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184" integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg== @@ -8181,7 +8575,14 @@ ignore-walk@^5.0.1: dependencies: minimatch "^5.0.1" -ignore@^5.0.4, ignore@^5.0.5, ignore@^5.2.0, ignore@~5.2.4: +ignore-walk@^6.0.0: + version "6.0.2" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-6.0.2.tgz#c48f48397cf8ef6174fcc28aa5f8c1de6203d389" + integrity sha512-ezmQ1Dg2b3jVZh2Dh+ar6Eu2MqNSTkyb32HU2MAQQQX9tKM3q/UQ/9lf03lQ5hW+fOeoMnwxwkleZ0xcNp0/qg== + dependencies: + minimatch "^7.4.2" + +ignore@^5.0.4, ignore@^5.0.5, ignore@^5.2.0, ignore@^5.2.4, ignore@~5.2.4: version "5.2.4" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== @@ -8198,7 +8599,7 @@ immer@^9.0.7: resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.12.tgz#2d33ddf3ee1d247deab9d707ca472c8c942a0f20" integrity sha512-lk7UNmSbAukB5B6dh9fnh5D0bJTOFKxVg2cyJWTYrWRfhLrLMBquONcUs3aFq507hNoIZEDDh8lb8UtOizSMhA== -import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1, import-fresh@^3.3.0: +import-fresh@^3.1.0, import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== @@ -8211,15 +8612,15 @@ import-lazy@^2.1.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-2.1.0.tgz#05698e3d45c88e8d7e9d92cb0584e77f096f3e43" integrity sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM= -import-lazy@~4.0.0: +import-lazy@^4.0.0, import-lazy@~4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== -import-local@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.3.tgz#4d51c2c495ca9393da259ec66b62e022920211e0" - integrity sha512-bE9iaUY3CXH8Cwfan/abDKAxe1KGT9kyGsBPqf6DMK/z0a2OzAsrukeYNgIH6cH5Xr452jb1TUL8rSfCLjZ9uA== +import-local@3.1.0, import-local@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== dependencies: pkg-dir "^4.2.0" resolve-cwd "^3.0.0" @@ -8239,15 +8640,20 @@ indent-string@^4.0.0: resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== +indent-string@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-5.0.0.tgz#4fd2980fccaf8622d14c64d694f4cf33c81951a5" + integrity sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg== + infer-owner@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/infer-owner/-/infer-owner-1.0.4.tgz#c4cefcaa8e51051c2a40ba2ce8a3d27295af9467" integrity sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A== -infima@0.2.0-alpha.42: - version "0.2.0-alpha.42" - resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.42.tgz#f6e86a655ad40877c6b4d11b2ede681eb5470aa5" - integrity sha512-ift8OXNbQQwtbIt6z16KnSWP7uJ/SysSMFI4F87MNRTicypfl4Pv3E2OGVv6N3nSZFJvA8imYulCBS64iyHYww== +infima@0.2.0-alpha.43: + version "0.2.0-alpha.43" + resolved "https://registry.yarnpkg.com/infima/-/infima-0.2.0-alpha.43.tgz#f7aa1d7b30b6c08afef441c726bac6150228cbe0" + integrity sha512-2uw57LvUqW0rK/SWYnd/2rRfxNA5DDNOh33jxF7fy46VWoNhGxiUQyVZHbBMjQ33mQem0cjdDVwgWVAmlRfgyQ== inflight@^1.0.4: version "1.0.6" @@ -8272,7 +8678,7 @@ ini@2.0.0: resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== -ini@^1.3.2, ini@^1.3.4, ini@^1.3.5, ini@~1.3.0: +ini@^1.3.2, ini@^1.3.4, ini@^1.3.5, ini@^1.3.8, ini@~1.3.0: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== @@ -8282,18 +8688,18 @@ ini@~3.0.0: resolved "https://registry.yarnpkg.com/ini/-/ini-3.0.1.tgz#c76ec81007875bc44d544ff7a11a55d12294102d" integrity sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ== -init-package-json@3.0.2, init-package-json@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-3.0.2.tgz#f5bc9bac93f2bdc005778bc2271be642fecfcd69" - integrity sha512-YhlQPEjNFqlGdzrBfDNRLhvoSgX7iQRgSxgsNknRQ9ITXFT7UMfVMWhBTOh2Y+25lRnGrv5Xz8yZwQ3ACR6T3A== +init-package-json@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-5.0.0.tgz#030cf0ea9c84cfc1b0dc2e898b45d171393e4b40" + integrity sha512-kBhlSheBfYmq3e0L1ii+VKe3zBTLL5lDCDWR+f9dLmEGSB3MqLlMlsolubSsyI88Bg6EA+BIMlomAnQ1SwgQBw== dependencies: - npm-package-arg "^9.0.1" - promzard "^0.3.0" - read "^1.0.7" - read-package-json "^5.0.0" + npm-package-arg "^10.0.0" + promzard "^1.0.0" + read "^2.0.0" + read-package-json "^6.0.0" semver "^7.3.5" validate-npm-package-license "^3.0.4" - validate-npm-package-name "^4.0.0" + validate-npm-package-name "^5.0.0" inline-style-parser@0.1.1: version "0.1.1" @@ -8419,10 +8825,10 @@ is-buffer@^2.0.0: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== -is-builtin-module@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.0.tgz#bb0310dfe881f144ca83f30100ceb10cf58835e0" - integrity sha512-phDA4oSGt7vl1n5tJvTWooWWAsXLY+2xCnxNqvKhGEzujg+A43wPlPOyDg3C8XQHN+6k/JTQWJ/j0dQh/qr+Hw== +is-builtin-module@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.2.1.tgz#f03271717d8654cfcaf07ab0463faa3571581169" + integrity sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A== dependencies: builtin-modules "^3.3.0" @@ -8431,7 +8837,14 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== -is-ci@2.0.0, is-ci@^2.0.0: +is-ci@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.1.tgz#db6ecbed1bd659c43dac0f45661e7674103d1867" + integrity sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ== + dependencies: + ci-info "^3.2.0" + +is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" integrity sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w== @@ -8439,9 +8852,9 @@ is-ci@2.0.0, is-ci@^2.0.0: ci-info "^2.0.0" is-core-module@^2.1.0, is-core-module@^2.11.0, is-core-module@^2.5.0, is-core-module@^2.8.1, is-core-module@^2.9.0: - version "2.11.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" - integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== + version "2.12.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.12.1.tgz#0c0b6885b6f80011c71541ce15c8d66cf5a4f9fd" + integrity sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg== dependencies: has "^1.0.3" @@ -8472,6 +8885,11 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -8574,7 +8992,7 @@ is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4= -is-plain-obj@^2.0.0: +is-plain-obj@^2.0.0, is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== @@ -8596,18 +9014,6 @@ is-plain-object@^5.0.0: resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344" integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== -is-promise@^2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.2.2.tgz#39ab959ccbf9a774cf079f7b40c7a26f763135f1" - integrity sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ== - -is-reference@1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" - integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== - dependencies: - "@types/estree" "*" - is-regex@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -8811,6 +9217,15 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" +jackspeak@^2.0.3: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.2.1.tgz#655e8cf025d872c9c03d3eb63e8f0c024fef16a6" + integrity sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + jake@^10.8.5: version "10.8.5" resolved "https://registry.yarnpkg.com/jake/-/jake-10.8.5.tgz#f2183d2c59382cb274226034543b9c03b8164c46" @@ -8821,95 +9236,95 @@ jake@^10.8.5: filelist "^1.0.1" minimatch "^3.0.4" -jest-changed-files@^29.0.0: - version "29.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.0.0.tgz#aa238eae42d9372a413dd9a8dadc91ca1806dce0" - integrity sha512-28/iDMDrUpGoCitTURuDqUzWQoWmOmOKOFST1mi2lwh62X4BFf6khgH3uSuo1e49X/UDjuApAj3w0wLOex4VPQ== +jest-changed-files@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.5.0.tgz#e88786dca8bf2aa899ec4af7644e16d9dcf9b23e" + integrity sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag== dependencies: execa "^5.0.0" p-limit "^3.1.0" -jest-circus@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.5.0.tgz#b5926989449e75bff0d59944bae083c9d7fb7317" - integrity sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA== +jest-circus@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.6.1.tgz#861dab37e71a89907d1c0fabc54a0019738ed824" + integrity sha512-tPbYLEiBU4MYAL2XoZme/bgfUeotpDBd81lgHLCbDZZFaGmECk0b+/xejPFtmiBP87GgP/y4jplcRpbH+fgCzQ== dependencies: - "@jest/environment" "^29.5.0" - "@jest/expect" "^29.5.0" - "@jest/test-result" "^29.5.0" - "@jest/types" "^29.5.0" + "@jest/environment" "^29.6.1" + "@jest/expect" "^29.6.1" + "@jest/test-result" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" dedent "^0.7.0" is-generator-fn "^2.0.0" - jest-each "^29.5.0" - jest-matcher-utils "^29.5.0" - jest-message-util "^29.5.0" - jest-runtime "^29.5.0" - jest-snapshot "^29.5.0" - jest-util "^29.5.0" + jest-each "^29.6.1" + jest-matcher-utils "^29.6.1" + jest-message-util "^29.6.1" + jest-runtime "^29.6.1" + jest-snapshot "^29.6.1" + jest-util "^29.6.1" p-limit "^3.1.0" - pretty-format "^29.5.0" + pretty-format "^29.6.1" pure-rand "^6.0.0" slash "^3.0.0" stack-utils "^2.0.3" -jest-cli@^29.1.2: - version "29.1.2" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.1.2.tgz#423b9c5d3ea20a50b1354b8bf3f2a20e72110e89" - integrity sha512-vsvBfQ7oS2o4MJdAH+4u9z76Vw5Q8WBQF5MchDbkylNknZdrPTX1Ix7YRJyTlOWqRaS7ue/cEAn+E4V1MWyMzw== +jest-cli@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.6.1.tgz#99d9afa7449538221c71f358f0fdd3e9c6e89f72" + integrity sha512-607dSgTA4ODIN6go9w6xY3EYkyPFGicx51a69H7yfvt7lN53xNswEVLovq+E77VsTRi5fWprLH0yl4DJgE8Ing== dependencies: - "@jest/core" "^29.1.2" - "@jest/test-result" "^29.1.2" - "@jest/types" "^29.1.2" + "@jest/core" "^29.6.1" + "@jest/test-result" "^29.6.1" + "@jest/types" "^29.6.1" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^29.1.2" - jest-util "^29.1.2" - jest-validate "^29.1.2" + jest-config "^29.6.1" + jest-util "^29.6.1" + jest-validate "^29.6.1" prompts "^2.0.1" yargs "^17.3.1" -jest-config@28.1.1, jest-config@^29, jest-config@^29.1.2: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.5.0.tgz#3cc972faec8c8aaea9ae158c694541b79f3748da" - integrity sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA== +jest-config@^29, jest-config@^29.4.1, jest-config@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.6.1.tgz#d785344509065d53a238224c6cdc0ed8e2f2f0dd" + integrity sha512-XdjYV2fy2xYixUiV2Wc54t3Z4oxYPAELUzWnV6+mcbq0rh742X2p52pii5A3oeRzYjLnQxCsZmp0qpI6klE2cQ== dependencies: "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^29.5.0" - "@jest/types" "^29.5.0" - babel-jest "^29.5.0" + "@jest/test-sequencer" "^29.6.1" + "@jest/types" "^29.6.1" + babel-jest "^29.6.1" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" glob "^7.1.3" graceful-fs "^4.2.9" - jest-circus "^29.5.0" - jest-environment-node "^29.5.0" + jest-circus "^29.6.1" + jest-environment-node "^29.6.1" jest-get-type "^29.4.3" jest-regex-util "^29.4.3" - jest-resolve "^29.5.0" - jest-runner "^29.5.0" - jest-util "^29.5.0" - jest-validate "^29.5.0" + jest-resolve "^29.6.1" + jest-runner "^29.6.1" + jest-util "^29.6.1" + jest-validate "^29.6.1" micromatch "^4.0.4" parse-json "^5.2.0" - pretty-format "^29.5.0" + pretty-format "^29.6.1" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@*, jest-diff@^29, jest-diff@^29.0.3, jest-diff@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.5.0.tgz#e0d83a58eb5451dcc1fa61b1c3ee4e8f5a290d63" - integrity sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw== +jest-diff@*, "jest-diff@>=29.4.3 < 30", jest-diff@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.6.1.tgz#13df6db0a89ee6ad93c747c75c85c70ba941e545" + integrity sha512-FsNCvinvl8oVxpNLttNQX7FAq7vR+gMDGj90tiP7siWw1UdakWUGqrylpsYrpvj908IYckm5Y0Q7azNAozU1Kg== dependencies: chalk "^4.0.0" diff-sequences "^29.4.3" jest-get-type "^29.4.3" - pretty-format "^29.5.0" + pretty-format "^29.6.1" jest-docblock@^29.4.3: version "29.4.3" @@ -8918,211 +9333,209 @@ jest-docblock@^29.4.3: dependencies: detect-newline "^3.0.0" -jest-each@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.5.0.tgz#fc6e7014f83eac68e22b7195598de8554c2e5c06" - integrity sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA== +jest-each@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.6.1.tgz#975058e5b8f55c6780beab8b6ab214921815c89c" + integrity sha512-n5eoj5eiTHpKQCAVcNTT7DRqeUmJ01hsAL0Q1SMiBHcBcvTKDELixQOGMCpqhbIuTcfC4kMfSnpmDqRgRJcLNQ== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" chalk "^4.0.0" jest-get-type "^29.4.3" - jest-util "^29.5.0" - pretty-format "^29.5.0" + jest-util "^29.6.1" + pretty-format "^29.6.1" -jest-environment-node@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.5.0.tgz#f17219d0f0cc0e68e0727c58b792c040e332c967" - integrity sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw== +jest-environment-node@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.6.1.tgz#08a122dece39e58bc388da815a2166c58b4abec6" + integrity sha512-ZNIfAiE+foBog24W+2caIldl4Irh8Lx1PUhg/GZ0odM1d/h2qORAsejiFc7zb+SEmYPn1yDZzEDSU5PmDkmVLQ== dependencies: - "@jest/environment" "^29.5.0" - "@jest/fake-timers" "^29.5.0" - "@jest/types" "^29.5.0" + "@jest/environment" "^29.6.1" + "@jest/fake-timers" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" - jest-mock "^29.5.0" - jest-util "^29.5.0" + jest-mock "^29.6.1" + jest-util "^29.6.1" -jest-get-type@^29, jest-get-type@^29.4.3: +jest-get-type@^29.4.3: version "29.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== -jest-haste-map@^29.1.2, jest-haste-map@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.5.0.tgz#69bd67dc9012d6e2723f20a945099e972b2e94de" - integrity sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA== +jest-haste-map@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.6.1.tgz#62655c7a1c1b349a3206441330fb2dbdb4b63803" + integrity sha512-0m7f9PZXxOCk1gRACiVgX85knUKPKLPg4oRCjLoqIm9brTHXaorMA0JpmtmVkQiT8nmXyIVoZd/nnH1cfC33ig== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" "@types/graceful-fs" "^4.1.3" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.9" jest-regex-util "^29.4.3" - jest-util "^29.5.0" - jest-worker "^29.5.0" + jest-util "^29.6.1" + jest-worker "^29.6.1" micromatch "^4.0.4" walker "^1.0.8" optionalDependencies: fsevents "^2.3.2" -jest-leak-detector@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz#cf4bdea9615c72bac4a3a7ba7e7930f9c0610c8c" - integrity sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow== +jest-leak-detector@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.6.1.tgz#66a902c81318e66e694df7d096a95466cb962f8e" + integrity sha512-OrxMNyZirpOEwkF3UHnIkAiZbtkBWiye+hhBweCHkVbCgyEy71Mwbb5zgeTNYWJBi1qgDVfPC1IwO9dVEeTLwQ== dependencies: jest-get-type "^29.4.3" - pretty-format "^29.5.0" + pretty-format "^29.6.1" -jest-matcher-utils@^29, jest-matcher-utils@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz#d957af7f8c0692c5453666705621ad4abc2c59c5" - integrity sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw== +jest-matcher-utils@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.6.1.tgz#6c60075d84655d6300c5d5128f46531848160b53" + integrity sha512-SLaztw9d2mfQQKHmJXKM0HCbl2PPVld/t9Xa6P9sgiExijviSp7TnZZpw2Fpt+OI3nwUO/slJbOfzfUMKKC5QA== dependencies: chalk "^4.0.0" - jest-diff "^29.5.0" + jest-diff "^29.6.1" jest-get-type "^29.4.3" - pretty-format "^29.5.0" + pretty-format "^29.6.1" -jest-message-util@^29.1.2, jest-message-util@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.5.0.tgz#1f776cac3aca332ab8dd2e3b41625435085c900e" - integrity sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA== +jest-message-util@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.6.1.tgz#d0b21d87f117e1b9e165e24f245befd2ff34ff8d" + integrity sha512-KoAW2zAmNSd3Gk88uJ56qXUWbFk787QKmjjJVOjtGFmmGSZgDBrlIL4AfQw1xyMYPNVD7dNInfIbur9B2rd/wQ== dependencies: "@babel/code-frame" "^7.12.13" - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" "@types/stack-utils" "^2.0.0" chalk "^4.0.0" graceful-fs "^4.2.9" micromatch "^4.0.4" - pretty-format "^29.5.0" + pretty-format "^29.6.1" slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.5.0.tgz#26e2172bcc71d8b0195081ff1f146ac7e1518aed" - integrity sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw== +jest-mock@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.6.1.tgz#049ee26aea8cbf54c764af649070910607316517" + integrity sha512-brovyV9HBkjXAEdRooaTQK42n8usKoSRR3gihzUpYeV/vwqgSoNfrksO7UfSACnPmxasO/8TmHM3w9Hp3G1dgw== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" "@types/node" "*" - jest-util "^29.5.0" + jest-util "^29.6.1" jest-pnp-resolver@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== -jest-regex-util@^29.0.0, jest-regex-util@^29.4.3: +jest-regex-util@^29.4.3: version "29.4.3" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.4.3.tgz#a42616141e0cae052cfa32c169945d00c0aa0bb8" integrity sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg== -jest-resolve-dependencies@^29.1.2: - version "29.1.2" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.1.2.tgz#a6919e58a0c7465582cb8ec2d745b4e64ae8647f" - integrity sha512-44yYi+yHqNmH3OoWZvPgmeeiwKxhKV/0CfrzaKLSkZG9gT973PX8i+m8j6pDrTYhhHoiKfF3YUFg/6AeuHw4HQ== +jest-resolve-dependencies@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.1.tgz#b85b06670f987a62515bbf625d54a499e3d708f5" + integrity sha512-BbFvxLXtcldaFOhNMXmHRWx1nXQO5LoXiKSGQcA1LxxirYceZT6ch8KTE1bK3X31TNG/JbkI7OkS/ABexVahiw== dependencies: - jest-regex-util "^29.0.0" - jest-snapshot "^29.1.2" + jest-regex-util "^29.4.3" + jest-snapshot "^29.6.1" -jest-resolve@28.1.1, jest-resolve@^29, jest-resolve@^29.1.2, jest-resolve@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.5.0.tgz#b053cc95ad1d5f6327f0ac8aae9f98795475ecdc" - integrity sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w== +jest-resolve@^29, jest-resolve@^29.4.1, jest-resolve@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.6.1.tgz#4c3324b993a85e300add2f8609f51b80ddea39ee" + integrity sha512-AeRkyS8g37UyJiP9w3mmI/VXU/q8l/IH52vj/cDAyScDcemRbSBhfX/NMYIGilQgSVwsjxrCHf3XJu4f+lxCMg== dependencies: chalk "^4.0.0" graceful-fs "^4.2.9" - jest-haste-map "^29.5.0" + jest-haste-map "^29.6.1" jest-pnp-resolver "^1.2.2" - jest-util "^29.5.0" - jest-validate "^29.5.0" + jest-util "^29.6.1" + jest-validate "^29.6.1" resolve "^1.20.0" resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^29.1.2, jest-runner@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.5.0.tgz#6a57c282eb0ef749778d444c1d758c6a7693b6f8" - integrity sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ== - dependencies: - "@jest/console" "^29.5.0" - "@jest/environment" "^29.5.0" - "@jest/test-result" "^29.5.0" - "@jest/transform" "^29.5.0" - "@jest/types" "^29.5.0" +jest-runner@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.6.1.tgz#54557087e7972d345540d622ab5bfc3d8f34688c" + integrity sha512-tw0wb2Q9yhjAQ2w8rHRDxteryyIck7gIzQE4Reu3JuOBpGp96xWgF0nY8MDdejzrLCZKDcp8JlZrBN/EtkQvPQ== + dependencies: + "@jest/console" "^29.6.1" + "@jest/environment" "^29.6.1" + "@jest/test-result" "^29.6.1" + "@jest/transform" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" chalk "^4.0.0" emittery "^0.13.1" graceful-fs "^4.2.9" jest-docblock "^29.4.3" - jest-environment-node "^29.5.0" - jest-haste-map "^29.5.0" - jest-leak-detector "^29.5.0" - jest-message-util "^29.5.0" - jest-resolve "^29.5.0" - jest-runtime "^29.5.0" - jest-util "^29.5.0" - jest-watcher "^29.5.0" - jest-worker "^29.5.0" + jest-environment-node "^29.6.1" + jest-haste-map "^29.6.1" + jest-leak-detector "^29.6.1" + jest-message-util "^29.6.1" + jest-resolve "^29.6.1" + jest-runtime "^29.6.1" + jest-util "^29.6.1" + jest-watcher "^29.6.1" + jest-worker "^29.6.1" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@^29.1.2, jest-runtime@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.5.0.tgz#c83f943ee0c1da7eb91fa181b0811ebd59b03420" - integrity sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw== - dependencies: - "@jest/environment" "^29.5.0" - "@jest/fake-timers" "^29.5.0" - "@jest/globals" "^29.5.0" - "@jest/source-map" "^29.4.3" - "@jest/test-result" "^29.5.0" - "@jest/transform" "^29.5.0" - "@jest/types" "^29.5.0" +jest-runtime@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.6.1.tgz#8a0fc9274ef277f3d70ba19d238e64334958a0dc" + integrity sha512-D6/AYOA+Lhs5e5il8+5pSLemjtJezUr+8zx+Sn8xlmOux3XOqx4d8l/2udBea8CRPqqrzhsKUsN/gBDE/IcaPQ== + dependencies: + "@jest/environment" "^29.6.1" + "@jest/fake-timers" "^29.6.1" + "@jest/globals" "^29.6.1" + "@jest/source-map" "^29.6.0" + "@jest/test-result" "^29.6.1" + "@jest/transform" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" chalk "^4.0.0" cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" glob "^7.1.3" graceful-fs "^4.2.9" - jest-haste-map "^29.5.0" - jest-message-util "^29.5.0" - jest-mock "^29.5.0" + jest-haste-map "^29.6.1" + jest-message-util "^29.6.1" + jest-mock "^29.6.1" jest-regex-util "^29.4.3" - jest-resolve "^29.5.0" - jest-snapshot "^29.5.0" - jest-util "^29.5.0" + jest-resolve "^29.6.1" + jest-snapshot "^29.6.1" + jest-util "^29.6.1" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@*, jest-snapshot@^29, jest-snapshot@^29.0.0, jest-snapshot@^29.0.3, jest-snapshot@^29.1.2, jest-snapshot@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.5.0.tgz#c9c1ce0331e5b63cd444e2f95a55a73b84b1e8ce" - integrity sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g== +jest-snapshot@*, jest-snapshot@^29.0.0, jest-snapshot@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.6.1.tgz#0d083cb7de716d5d5cdbe80d598ed2fbafac0239" + integrity sha512-G4UQE1QQ6OaCgfY+A0uR1W2AY0tGXUPQpoUClhWHq1Xdnx1H6JOrC2nH5lqnOEqaDgbHFgIwZ7bNq24HpB180A== dependencies: "@babel/core" "^7.11.6" "@babel/generator" "^7.7.2" "@babel/plugin-syntax-jsx" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" "@babel/types" "^7.3.3" - "@jest/expect-utils" "^29.5.0" - "@jest/transform" "^29.5.0" - "@jest/types" "^29.5.0" - "@types/babel__traverse" "^7.0.6" + "@jest/expect-utils" "^29.6.1" + "@jest/transform" "^29.6.1" + "@jest/types" "^29.6.1" "@types/prettier" "^2.1.5" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^29.5.0" + expect "^29.6.1" graceful-fs "^4.2.9" - jest-diff "^29.5.0" + jest-diff "^29.6.1" jest-get-type "^29.4.3" - jest-matcher-utils "^29.5.0" - jest-message-util "^29.5.0" - jest-util "^29.5.0" + jest-matcher-utils "^29.6.1" + jest-message-util "^29.6.1" + jest-util "^29.6.1" natural-compare "^1.4.0" - pretty-format "^29.5.0" - semver "^7.3.5" + pretty-format "^29.6.1" + semver "^7.5.3" jest-specific-snapshot@*, jest-specific-snapshot@^8.0.0: version "8.0.0" @@ -9131,42 +9544,42 @@ jest-specific-snapshot@*, jest-specific-snapshot@^8.0.0: dependencies: jest-snapshot "^29.0.0" -jest-util@28.1.1, jest-util@^29, jest-util@^29.1.2, jest-util@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.5.0.tgz#24a4d3d92fc39ce90425311b23c27a6e0ef16b8f" - integrity sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ== +jest-util@^29, jest-util@^29.4.1, jest-util@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.6.1.tgz#c9e29a87a6edbf1e39e6dee2b4689b8a146679cb" + integrity sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^29.1.2, jest-validate@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.5.0.tgz#8e5a8f36178d40e47138dc00866a5f3bd9916ffc" - integrity sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ== +jest-validate@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.6.1.tgz#765e684af6e2c86dce950aebefbbcd4546d69f7b" + integrity sha512-r3Ds69/0KCN4vx4sYAbGL1EVpZ7MSS0vLmd3gV78O+NAx3PDQQukRU5hNHPXlyqCgFY8XUk7EuTMLugh0KzahA== dependencies: - "@jest/types" "^29.5.0" + "@jest/types" "^29.6.1" camelcase "^6.2.0" chalk "^4.0.0" jest-get-type "^29.4.3" leven "^3.1.0" - pretty-format "^29.5.0" + pretty-format "^29.6.1" -jest-watcher@^29.1.2, jest-watcher@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.5.0.tgz#cf7f0f949828ba65ddbbb45c743a382a4d911363" - integrity sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA== +jest-watcher@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.6.1.tgz#7c0c43ddd52418af134c551c92c9ea31e5ec942e" + integrity sha512-d4wpjWTS7HEZPaaj8m36QiaP856JthRZkrgcIY/7ISoUWPIillrXM23WPboZVLbiwZBt4/qn2Jke84Sla6JhFA== dependencies: - "@jest/test-result" "^29.5.0" - "@jest/types" "^29.5.0" + "@jest/test-result" "^29.6.1" + "@jest/types" "^29.6.1" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" emittery "^0.13.1" - jest-util "^29.5.0" + jest-util "^29.6.1" string-length "^4.0.1" jest-worker@^26.2.1: @@ -9187,25 +9600,25 @@ jest-worker@^27.4.5, jest-worker@^27.5.1: merge-stream "^2.0.0" supports-color "^8.0.0" -jest-worker@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.5.0.tgz#bdaefb06811bd3384d93f009755014d8acb4615d" - integrity sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA== +jest-worker@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.6.1.tgz#64b015f0e985ef3a8ad049b61fe92b3db74a5319" + integrity sha512-U+Wrbca7S8ZAxAe9L6nb6g8kPdia5hj32Puu5iOqBCMTMWFHXuK6dOV2IFrpedbTV8fjMFLdWNttQTBL6u2MRA== dependencies: "@types/node" "*" - jest-util "^29.5.0" + jest-util "^29.6.1" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.0.3: - version "29.1.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.1.2.tgz#f821a1695ffd6cd0efc3b59d2dfcc70a98582499" - integrity sha512-5wEIPpCezgORnqf+rCaYD1SK+mNN7NsstWzIsuvsnrhR/hSxXWd82oI7DkrbJ+XTD28/eG8SmxdGvukrGGK6Tw== +jest@29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.6.1.tgz#74be1cb719c3abe439f2d94aeb18e6540a5b02ad" + integrity sha512-Nirw5B4nn69rVUZtemCQhwxOBhm0nsp3hmtF4rzCeWD7BkjAXRIji7xWQfnTNbz9g0aVsBX6aZK3n+23LM6uDw== dependencies: - "@jest/core" "^29.1.2" - "@jest/types" "^29.1.2" + "@jest/core" "^29.6.1" + "@jest/types" "^29.6.1" import-local "^3.0.2" - jest-cli "^29.1.2" + jest-cli "^29.6.1" jju@~1.4.0: version "1.4.0" @@ -9223,16 +9636,18 @@ joi@^17.6.0: "@sideway/formula" "^3.0.0" "@sideway/pinpoint" "^2.0.0" -js-sdsl@^4.1.4: - version "4.3.0" - resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.3.0.tgz#aeefe32a451f7af88425b11fdb5f58c90ae1d711" - integrity sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +js-yaml@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.0.0.tgz#f426bc0ff4b4051926cd588c71113183409a121f" + integrity sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q== + dependencies: + argparse "^2.0.1" + js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" @@ -9261,7 +9676,7 @@ jsesc@^3.0.2: jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= + integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA== json-buffer@3.0.0: version "3.0.0" @@ -9278,25 +9693,10 @@ json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== -json-schema-to-typescript@^12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/json-schema-to-typescript/-/json-schema-to-typescript-12.0.0.tgz#62ec4e9632f1d672fd3b4d81cf0d74f6df29bc23" - integrity sha512-Uk/BDIAo8vqepPBhM86UhNMHgCv7JulicNj/BgnQPHE1fGCoej0UTtcEYzXU/uk6lSvbZCf7pccW+dnNMrr5rg== - dependencies: - "@bcherny/json-schema-ref-parser" "10.0.5-fork" - "@types/json-schema" "^7.0.11" - "@types/lodash" "^4.14.182" - "@types/prettier" "^2.6.1" - cli-color "^2.0.2" - get-stdin "^8.0.0" - glob "^7.1.6" - glob-promise "^4.2.2" - is-glob "^4.0.3" - lodash "^4.17.21" - minimist "^1.2.6" - mkdirp "^1.0.4" - mz "^2.7.0" - prettier "^2.6.2" +json-parse-even-better-errors@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.0.tgz#2cb2ee33069a78870a0c7e3da560026b89669cf7" + integrity sha512-iZbGHafX/59r39gPwVPRBGw0QQKnA7tte5pSMrhWOW7swGsVvVTjmfyAV9pNqk8YGT7tRCdxRu8uzcgZwoDooA== json-schema-traverse@^0.4.1: version "0.4.1" @@ -9318,11 +9718,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stringify-nice@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/json-stringify-nice/-/json-stringify-nice-1.1.4.tgz#2c937962b80181d3f317dd39aa323e14f5a60a67" - integrity sha512-5Z5RFW63yxReJ7vANgW6eZFGWaQvnPE3WNmZoOJrSkGju2etKA2L5rrOa1sm877TVTFt57A80BH1bArcmlLfPw== - json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -9335,7 +9730,7 @@ json5@^1.0.2: dependencies: minimist "^1.2.0" -json5@^2.1.2, json5@^2.2.0, json5@^2.2.1, json5@^2.2.2: +json5@^2.1.2, json5@^2.2.0, json5@^2.2.2, json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -9379,15 +9774,10 @@ jsonpointer@^5.0.0: array-includes "^3.1.5" object.assign "^4.1.3" -just-diff-apply@^5.2.0: - version "5.3.1" - resolved "https://registry.yarnpkg.com/just-diff-apply/-/just-diff-apply-5.3.1.tgz#30f40809ffed55ad76dccf73fa9b85a76964c867" - integrity sha512-dgFenZnMsc1xGNqgdtgnh7DK+Oy352CE3VZLbzcbQpsBs9iI2K3M0IRrdgREZ72eItTjbl0suRyvKRdVQa9GbA== - -just-diff@^5.0.1: - version "5.0.2" - resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-5.0.2.tgz#68854c94280c37d28cb266d8f29bdd2cd29f003e" - integrity sha512-uGd6F+eIZ4T95EinP8ubINGkbEy3jrgBym+6LjW+ja1UG1WQIcEcQ6FLeyXtVJZglk+bj7fvEn+Cu2LBxkgiYQ== +just-extend@^4.0.2: + version "4.2.1" + resolved "https://registry.yarnpkg.com/just-extend/-/just-extend-4.2.1.tgz#ef5e589afb61e5d66b24eca749409a8939a8c744" + integrity sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg== keyv@^3.0.0: version "3.1.0" @@ -9418,12 +9808,17 @@ klona@^2.0.5: resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.5.tgz#d166574d90076395d9963aa7a928fabb8d76afbc" integrity sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ== +known-css-properties@^0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.27.0.tgz#82a9358dda5fe7f7bd12b5e7142c0a205393c0c5" + integrity sha512-uMCj6+hZYDoffuvAJjFAPz56E9uoowFHmTkqRtRq5WyC5Q6Cu/fTZKNQpX/RbzChBYLLl3lo8CjFZBAZXq9qFg== + konami-code-js@^0.8.1: version "0.8.1" resolved "https://registry.yarnpkg.com/konami-code-js/-/konami-code-js-0.8.1.tgz#b970ee1aaa7e4136b484d36a2c4e528414feb4de" integrity sha512-bJ0tuWYLYiUueIVTpA0MV4h4Gz1X16uuJggh5TpIWXOQoLv0238SU7Im23z2wYKCCBsOfk5j4HKWB/pqdCgu5Q== -konamimojisplosion@^0.5.1: +konamimojisplosion@^0.5.2: version "0.5.2" resolved "https://registry.yarnpkg.com/konamimojisplosion/-/konamimojisplosion-0.5.2.tgz#9ccc1ad5e727a3934e3a7a0335246c87d6a0de2e" integrity sha512-gPZ+0a720xl9OcfJOUw549fnij0xsP78GupIhl0irnJF6wwIhHSjHEp75qrXNVJb2p9Rtui5yOeJQoUcLy1lvQ== @@ -9450,48 +9845,47 @@ latest-version@^5.1.0: dependencies: package-json "^6.3.0" -lerna@6.5.1: - version "6.5.1" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-6.5.1.tgz#eb89698e5b2891f5681f39d980f63d0519fc464f" - integrity sha512-Va1bysubwWdoWZ1ncKcoTGBXNAu/10/TwELb550TTivXmEWjCCdek4eX0BNLTEYKxu3tpV2UEeqVisUiWGn4WA== +lerna@7.1.3: + version "7.1.3" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-7.1.3.tgz#9aef15620b54038b1e4c5ea620c6b9b7590f26a4" + integrity sha512-LMs9HU0z5fNFMNOyDVinJcf04QaScReJ8Q2pqxO+nPOmbvNsBwykBgMTWLboL1rI1CCR0/WLdMnvObvR52MtTw== dependencies: - "@lerna/child-process" "6.5.1" - "@lerna/create" "6.5.1" - "@npmcli/arborist" "5.3.0" - "@npmcli/run-script" "4.1.7" - "@nrwl/devkit" ">=15.5.2 < 16" + "@lerna/child-process" "7.1.3" + "@lerna/create" "7.1.3" + "@npmcli/run-script" "6.0.2" + "@nx/devkit" ">=16.1.3 < 17" "@octokit/plugin-enterprise-rest" "6.0.1" - "@octokit/rest" "19.0.3" - byte-size "7.0.0" + "@octokit/rest" "19.0.11" + byte-size "8.1.1" chalk "4.1.0" clone-deep "4.0.1" - cmd-shim "5.0.0" + cmd-shim "6.0.1" columnify "1.6.0" - config-chain "1.1.12" - conventional-changelog-angular "5.0.12" - conventional-changelog-core "4.2.4" - conventional-recommended-bump "6.1.0" - cosmiconfig "7.0.0" + conventional-changelog-angular "6.0.0" + conventional-changelog-core "5.0.1" + conventional-recommended-bump "7.0.1" + cosmiconfig "^8.2.0" dedent "0.7.0" - dot-prop "6.0.1" - envinfo "^7.7.4" + envinfo "7.8.1" execa "5.0.0" - fs-extra "9.1.0" + fs-extra "^11.1.1" get-port "5.1.1" get-stream "6.0.0" git-url-parse "13.1.0" glob-parent "5.1.2" globby "11.1.0" - graceful-fs "4.2.10" + graceful-fs "4.2.11" has-unicode "2.0.1" - import-local "^3.0.2" - init-package-json "3.0.2" + import-local "3.1.0" + ini "^1.3.8" + init-package-json "5.0.0" inquirer "^8.2.4" - is-ci "2.0.0" + is-ci "3.0.1" is-stream "2.0.0" - js-yaml "^4.1.0" - libnpmaccess "6.0.3" - libnpmpublish "6.0.4" + jest-diff ">=29.4.3 < 30" + js-yaml "4.1.0" + libnpmaccess "7.0.2" + libnpmpublish "7.3.0" load-json-file "6.2.0" make-dir "3.1.0" minimatch "3.0.5" @@ -9499,35 +9893,34 @@ lerna@6.5.1: node-fetch "2.6.7" npm-package-arg "8.1.1" npm-packlist "5.1.1" - npm-registry-fetch "13.3.0" + npm-registry-fetch "^14.0.5" npmlog "^6.0.2" - nx ">=15.5.2 < 16" + nx ">=16.1.3 < 17" p-map "4.0.0" p-map-series "2.1.0" p-pipe "3.1.0" p-queue "6.6.2" p-reduce "2.1.0" p-waterfall "2.1.1" - pacote "13.6.1" - path-exists "4.0.0" + pacote "^15.2.0" pify "5.0.0" - read-cmd-shim "3.0.0" - read-package-json "5.0.1" + read-cmd-shim "4.0.0" + read-package-json "6.0.4" resolve-from "5.0.0" - rimraf "^3.0.2" - semver "7.3.4" + rimraf "^4.4.1" + semver "^7.3.8" signal-exit "3.0.7" slash "3.0.0" - ssri "9.0.1" + ssri "^9.0.1" strong-log-transformer "2.1.0" tar "6.1.11" temp-dir "1.0.0" - typescript "^3 || ^4" - upath "^2.0.1" - uuid "8.3.2" + typescript ">=3 < 6" + upath "2.0.1" + uuid "^9.0.0" validate-npm-package-license "3.0.4" - validate-npm-package-name "4.0.0" - write-file-atomic "4.0.1" + validate-npm-package-name "5.0.0" + write-file-atomic "5.0.1" write-pkg "4.0.0" yargs "16.2.0" yargs-parser "20.2.4" @@ -9545,26 +9938,27 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -libnpmaccess@6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-6.0.3.tgz#473cc3e4aadb2bc713419d92e45d23b070d8cded" - integrity sha512-4tkfUZprwvih2VUZYMozL7EMKgQ5q9VW2NtRyxWtQWlkLTAWHRklcAvBN49CVqEkhUw7vTX2fNgB5LzgUucgYg== +libnpmaccess@7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-7.0.2.tgz#7f056c8c933dd9c8ba771fa6493556b53c5aac52" + integrity sha512-vHBVMw1JFMTgEk15zRsJuSAg7QtGGHpUSEfnbcRL1/gTBag9iEfJbyjpDmdJmwMhvpoLoNBtdAUCdGnaP32hhw== dependencies: - aproba "^2.0.0" - minipass "^3.1.1" - npm-package-arg "^9.0.1" - npm-registry-fetch "^13.0.0" + npm-package-arg "^10.1.0" + npm-registry-fetch "^14.0.3" -libnpmpublish@6.0.4: - version "6.0.4" - resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-6.0.4.tgz#adb41ec6b0c307d6f603746a4d929dcefb8f1a0b" - integrity sha512-lvAEYW8mB8QblL6Q/PI/wMzKNvIrF7Kpujf/4fGS/32a2i3jzUXi04TNyIBcK6dQJ34IgywfaKGh+Jq4HYPFmg== +libnpmpublish@7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-7.3.0.tgz#2ceb2b36866d75a6cd7b4aa748808169f4d17e37" + integrity sha512-fHUxw5VJhZCNSls0KLNEG0mCD2PN1i14gH5elGOgiVnU3VgTcRahagYP2LKI1m0tFCJ+XrAm0zVYyF5RCbXzcg== dependencies: - normalize-package-data "^4.0.0" - npm-package-arg "^9.0.1" - npm-registry-fetch "^13.0.0" + ci-info "^3.6.1" + normalize-package-data "^5.0.0" + npm-package-arg "^10.1.0" + npm-registry-fetch "^14.0.3" + proc-log "^3.0.0" semver "^7.3.7" - ssri "^9.0.0" + sigstore "^1.4.0" + ssri "^10.0.1" lilconfig@2.1.0, lilconfig@^2.0.3: version "2.1.0" @@ -9588,10 +9982,10 @@ linkify-it@^4.0.1: dependencies: uc.micro "^1.0.1" -lint-staged@^13.0.0: - version "13.2.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.2.0.tgz#b7abaf79c91cd36d824f17b23a4ce5209206126a" - integrity sha512-GbyK5iWinax5Dfw5obm2g2ccUiZXNGtAS4mCbJ0Lv4rq6iEtfBSjOYdcbOtAIFtM114t0vdpViDDetjVTSd8Vw== +lint-staged@^13.2.3: + version "13.2.3" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.2.3.tgz#f899aad6c093473467e9c9e316e3c2d8a28f87a7" + integrity sha512-zVVEXLuQIhr1Y7R7YAWx4TZLdvuzk7DnmrsTNL0fax6Z3jrpFcas+vKbzxhhvp6TA55m1SQuWkpzI1qbfDZbAg== dependencies: chalk "5.2.0" cli-truncate "^3.1.0" @@ -9605,7 +9999,7 @@ lint-staged@^13.0.0: object-inspect "^1.12.3" pidtree "^0.6.0" string-argv "^0.3.1" - yaml "^2.2.1" + yaml "^2.2.2" listr2@^5.0.7: version "5.0.8" @@ -9690,6 +10084,11 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" +lodash-es@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee" + integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw== + lodash.curry@^4.0.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.curry/-/lodash.curry-4.1.1.tgz#248e36072ede906501d75966200a86dab8b23170" @@ -9725,7 +10124,7 @@ lodash.memoize@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= -lodash.merge@^4.6.2: +lodash.merge@4.6.2, lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== @@ -9735,16 +10134,28 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA== +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== + lodash.uniq@4.5.0, lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@~4.17.15: +lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@~4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +log-symbols@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.0.0.tgz#69b3cc46d20f448eccdb75ea1fa733d9e821c920" + integrity sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA== + dependencies: + chalk "^4.0.0" + log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" @@ -9770,6 +10181,13 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3 dependencies: js-tokens "^3.0.0 || ^4.0.0" +loupe@^2.3.1: + version "2.3.6" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" + integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA== + dependencies: + get-func-name "^2.0.0" + lower-case@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28" @@ -9802,23 +10220,19 @@ lru-cache@^6.0.0: yallist "^4.0.0" lru-cache@^7.4.4, lru-cache@^7.5.1, lru-cache@^7.7.1: - version "7.10.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.10.1.tgz#db577f42a94c168f676b638d15da8fb073448cab" - integrity sha512-BQuhQxPuRl79J5zSXRP+uNzPOyZw2oFI9JLRQ80XswSvg21KMKNtQza9eF42rfI/3Z40RvzBdXgziEkudzjo8A== + version "7.18.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-7.18.3.tgz#f793896e0fd0e954a59dfdd82f0773808df6aa89" + integrity sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA== -lru-queue@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/lru-queue/-/lru-queue-0.1.0.tgz#2738bd9f0d3cf4f84490c5736c48699ac632cda3" - integrity sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ== - dependencies: - es5-ext "~0.10.2" +"lru-cache@^9.1.1 || ^10.0.0": + version "10.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.0.0.tgz#b9e2a6a72a129d81ab317202d93c7691df727e61" + integrity sha512-svTf/fzsKHffP42sujkO/Rjs37BCIsQVRCeNYIm9WN8rgT7ffoUnRtZCqU+6BqcSBdv8gwJeTz8knJpgACeQMw== -lzstring.ts@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lzstring.ts/-/lzstring.ts-2.0.2.tgz#1d269bd6ab423713f31e614f67018110ed860129" - integrity sha512-SEDSYQ3gNrGOdqWcXDO6OU/j3E/ff0WfndKOED4WV0oxDzgf4vijuIwbEE/m0f1LGuTbwH3jVHcwrLdRbQqh3A== - dependencies: - tslib "^1.10.0" +lz-string@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941" + integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ== magic-string@^0.25.0, magic-string@^0.25.7: version "0.25.9" @@ -9827,14 +10241,14 @@ magic-string@^0.25.0, magic-string@^0.25.7: dependencies: sourcemap-codec "^1.4.8" -magic-string@^0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.27.0.tgz#e4a3413b4bab6d98d2becffd48b4a257effdbbf3" - integrity sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA== +make-dir@*, make-dir@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== dependencies: - "@jridgewell/sourcemap-codec" "^1.4.13" + semver "^7.5.3" -make-dir@*, make-dir@3.1.0, make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: +make-dir@3.1.0, make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== @@ -9854,7 +10268,7 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== -make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6: +make-fetch-happen@^10.0.3: version "10.1.5" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.1.5.tgz#d975c0a4373de41ea05236d8182f56333511c268" integrity sha512-mucOj2H0Jn/ax7H9K9T1bf0p1nn/mBFa551Os7ed9xRfLEx20aZhZeLslmRYfAaAqXZUGipcs+m5KOKvOH0XKA== @@ -9876,6 +10290,27 @@ make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6: socks-proxy-agent "^6.1.1" ssri "^9.0.0" +make-fetch-happen@^11.0.0, make-fetch-happen@^11.0.1, make-fetch-happen@^11.1.0: + version "11.1.1" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz#85ceb98079584a9523d4bf71d32996e7e208549f" + integrity sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w== + dependencies: + agentkeepalive "^4.2.1" + cacache "^17.0.0" + http-cache-semantics "^4.1.1" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.0" + is-lambda "^1.0.1" + lru-cache "^7.7.1" + minipass "^5.0.0" + minipass-fetch "^3.0.0" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.4" + negotiator "^0.6.3" + promise-retry "^2.0.1" + socks-proxy-agent "^7.0.0" + ssri "^10.0.0" + makeerror@1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" @@ -9888,7 +10323,7 @@ map-obj@^1.0.0: resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" integrity sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0= -map-obj@^4.0.0: +map-obj@^4.0.0, map-obj@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.3.0.tgz#9304f906e93faae70880da102a9f1df0ea8bb05a" integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== @@ -9909,37 +10344,48 @@ markdown-it@13.0.1: mdurl "^1.0.1" uc.micro "^1.0.5" -markdown-table@^3.0.2: +markdown-table@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-3.0.3.tgz#e6331d30e493127e031dd385488b5bd326e4a6bd" integrity sha512-Z1NL3Tb1M9wH4XESsCDEksWoKTdlUafKc4pt0GRwjUyXaCFZ+dc3g2erqB6zm3szA2IUSi7VnPI+o/9jnxh9hw== -markdownlint-cli@^0.33.0: - version "0.33.0" - resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.33.0.tgz#703af1234c32c309ab52fcd0e8bc797a34e2b096" - integrity sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ== +markdownlint-cli@^0.35.0: + version "0.35.0" + resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.35.0.tgz#1a6386777c6f20681e1425c0b7a056cf130bc46f" + integrity sha512-lVIIIV1MrUtjoocgDqXLxUCxlRbn7Ve8rsWppfwciUNwLlNS28AhNiyQ3PU7jjj4Qvj+rWTTvwkqg7AcdG988g== dependencies: - commander "~9.4.1" + commander "~11.0.0" get-stdin "~9.0.0" - glob "~8.0.3" + glob "~10.2.7" ignore "~5.2.4" js-yaml "^4.1.0" jsonc-parser "~3.2.0" - markdownlint "~0.27.0" - minimatch "~5.1.2" + markdownlint "~0.29.0" + minimatch "~9.0.1" run-con "~1.2.11" -markdownlint@~0.27.0: - version "0.27.0" - resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.27.0.tgz#9dabf7710a4999e2835e3c68317f1acd0bc89049" - integrity sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w== +markdownlint-micromark@0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/markdownlint-micromark/-/markdownlint-micromark-0.1.5.tgz#a23400b101be32cd4336f2b6b4c47da31825524c" + integrity sha512-HvofNU4QCvfUCWnocQP1IAWaqop5wpWrB0mKB6SSh0fcpV0PdmQNS6tdUuFew1utpYlUvYYzz84oDkrD76GB9A== + +markdownlint@~0.29.0: + version "0.29.0" + resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.29.0.tgz#9647478b7d5485965c557502fe54ee5a550033f2" + integrity sha512-ASAzqpODstu/Qsk0xW5BPgWnK/qjpBQ4e7IpsSvvFXcfYIjanLTdwFRJK1SIEEh0fGSMKXcJf/qhaZYHyME0wA== dependencies: markdown-it "13.0.1" + markdownlint-micromark "0.1.5" -marked@^4.0.15: - version "4.2.12" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.12.tgz#d69a64e21d71b06250da995dcd065c11083bebb5" - integrity sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw== +marked@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/marked/-/marked-5.1.1.tgz#40b3963bb9da225314f746d5012ba7e34942f636" + integrity sha512-bTmmGdEINWmOMDjnPWDxGPQ4qkDLeYorpYbEtFOXzOruTwUE671q4Guiuchn4N8h/v6NGd7916kXsm3Iz4iUSg== + +mathml-tag-names@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" + integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== mdast-squeeze-paragraphs@^4.0.0: version "4.0.0" @@ -9979,6 +10425,11 @@ mdn-data@2.0.14: resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50" integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow== +mdn-data@2.0.30: + version "2.0.30" + resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc" + integrity sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA== + mdurl@^1.0.0, mdurl@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" @@ -9996,21 +10447,25 @@ memfs@^3.1.2, memfs@^3.4.1: dependencies: fs-monkey "1.0.3" -memoizee@^0.4.15: - version "0.4.15" - resolved "https://registry.yarnpkg.com/memoizee/-/memoizee-0.4.15.tgz#e6f3d2da863f318d02225391829a6c5956555b72" - integrity sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ== - dependencies: - d "^1.0.1" - es5-ext "^0.10.53" - es6-weak-map "^2.0.3" - event-emitter "^0.3.5" - is-promise "^2.2.2" - lru-queue "^0.1.0" - next-tick "^1.1.0" - timers-ext "^0.1.7" - -meow@^8.0.0: +meow@^10.1.5: + version "10.1.5" + resolved "https://registry.yarnpkg.com/meow/-/meow-10.1.5.tgz#be52a1d87b5f5698602b0f32875ee5940904aa7f" + integrity sha512-/d+PQ4GKmGvM9Bee/DPa8z3mXs/pkvJE2KEThngVNOqtmljC6K7NMPxtc2JeZYTmpWb9k/TmxjeL18ez3h7vCw== + dependencies: + "@types/minimist" "^1.2.2" + camelcase-keys "^7.0.0" + decamelize "^5.0.0" + decamelize-keys "^1.1.0" + hard-rejection "^2.1.0" + minimist-options "4.1.0" + normalize-package-data "^3.0.2" + read-pkg-up "^8.0.0" + redent "^4.0.0" + trim-newlines "^4.0.2" + type-fest "^1.2.2" + yargs-parser "^20.2.9" + +meow@^8.1.2: version "8.1.2" resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== @@ -10047,6 +10502,11 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= +micro-api-client@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/micro-api-client/-/micro-api-client-3.3.0.tgz#52dd567d322f10faffe63d19d4feeac4e4ffd215" + integrity sha512-y0y6CUB9RLVsy3kfgayU28746QrNMpSm9O/AYGNsBgOkJr/X/Jk0VLGoO8Ude7Bpa8adywzF+MzXNZRFRsNPhg== + micromatch@^4.0.2, micromatch@^4.0.4, micromatch@^4.0.5: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" @@ -10104,7 +10564,7 @@ mimic-response@^1.0.0, mimic-response@^1.0.1: resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ== -min-indent@^1.0.0: +min-indent@^1.0.0, min-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== @@ -10150,13 +10610,34 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1, minimatch@~5.1.2: +minimatch@^5.0.1: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== dependencies: brace-expansion "^2.0.1" +minimatch@^7.4.2: + version "7.4.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.3.tgz#012cbf110a65134bb354ae9773b55256cdb045a2" + integrity sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^8.0.2: + version "8.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-8.0.3.tgz#0415cb9bb0c1d8ac758c8a673eb1d288e13f5e75" + integrity sha512-tEEvU9TkZgnFDCtpnrEYnPsjT7iUx42aXfs4bzmQ5sMA09/6hZY0jeZcGkXyDagiBOvkUjNo8Viom+Me6+2x7g== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^9.0.0, minimatch@^9.0.1, minimatch@~9.0.1: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -10189,6 +10670,17 @@ minipass-fetch@^2.0.3: optionalDependencies: encoding "^0.1.13" +minipass-fetch@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-3.0.1.tgz#bae3789f668d82ffae3ea47edc6b78b8283b3656" + integrity sha512-t9/wowtf7DYkwz8cfMSt0rMwiyNIBXf5CKZ3S5ZMqRqMYT0oLTp0x1WorMI9WTwvaPg21r1JbFxJMum8JrLGfw== + dependencies: + minipass "^4.0.0" + minipass-sized "^1.0.3" + minizlib "^2.1.2" + optionalDependencies: + encoding "^0.1.13" + minipass-flush@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/minipass-flush/-/minipass-flush-1.0.5.tgz#82e7135d7e89a50ffe64610a787953c4c4cbb373" @@ -10225,6 +10717,26 @@ minipass@^3.0.0, minipass@^3.1.1, minipass@^3.1.6: dependencies: yallist "^4.0.0" +minipass@^4.0.0, minipass@^4.2.4: + version "4.2.5" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-4.2.5.tgz#9e0e5256f1e3513f8c34691dd68549e85b2c8ceb" + integrity sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q== + +minipass@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" + integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== + +"minipass@^5.0.0 || ^6.0.2": + version "6.0.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-6.0.2.tgz#542844b6c4ce95b202c0995b0a471f1229de4c81" + integrity sha512-MzWSV5nYVT7mVyWCwn2o7JH13w2TBRmmSqSRCKzTw+lmft9X4z+3wjvs06Tzijo5z4W/kahUCDpRXTF+ZrmF/w== + +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0": + version "7.0.1" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.1.tgz#dff63464407cd8b83d7f008c0f116fa8c9b77ebf" + integrity sha512-NQ8MCKimInjVlaIqx51RKJJB7mINVkLTJbsZKmto4UAAOC/CWXES8PGaOgoBZyqoUsUA/U3DToGK7GJkkHbjJw== + minizlib@^2.1.1, minizlib@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" @@ -10233,15 +10745,6 @@ minizlib@^2.1.1, minizlib@^2.1.2: minipass "^3.0.0" yallist "^4.0.0" -mkdirp-infer-owner@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/mkdirp-infer-owner/-/mkdirp-infer-owner-2.0.0.tgz#55d3b368e7d89065c38f32fd38e638f0ab61d316" - integrity sha512-sdqtiFt3lkOaYvTXSRIUjkIdPTcxgv5+fgqYE/5qgwdw12cOrAuzzgzvVExIkH/ul1oeHN3bCLOWSG3XOqbKKw== - dependencies: - chownr "^2.0.0" - infer-owner "^1.0.4" - mkdirp "^1.0.3" - mkdirp@^0.5.3: version "0.5.5" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" @@ -10254,15 +10757,46 @@ mkdirp@^1.0.3, mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== -modify-values@^1.0.0: +mocha@^8.3.2: + version "8.4.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff" + integrity sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ== + dependencies: + "@ungap/promise-all-settled" "1.1.2" + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.5.1" + debug "4.3.1" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.1.6" + growl "1.10.5" + he "1.2.0" + js-yaml "4.0.0" + log-symbols "4.0.0" + minimatch "3.0.4" + ms "2.1.3" + nanoid "3.1.20" + serialize-javascript "5.0.1" + strip-json-comments "3.1.1" + supports-color "8.1.1" + which "2.0.2" + wide-align "1.1.3" + workerpool "6.1.0" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + +modify-values@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== -monaco-editor@^0.36.0: - version "0.36.1" - resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.36.1.tgz#aad528c815605307473a1634612946921d8079b5" - integrity sha512-/CaclMHKQ3A6rnzBzOADfwdSJ25BFoFT0Emxsc4zYVyav5SkK9iA6lEtIeuN/oRYbwPgviJT+t3l+sjFa28jYg== +monaco-editor@~0.40.0: + version "0.40.0" + resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.40.0.tgz#d10834e15ad50a15ec61fd01892e508464ebe2fe" + integrity sha512-1wymccLEuFSMBvCk/jT1YDW/GuxMLYwnFwF9CDyYCxoTw2Pt379J3FUhwy9c43j51JdcxVPjwk0jm0EVDsBS2g== ms@2.0.0: version "2.0.0" @@ -10298,24 +10832,25 @@ multimatch@5.0.0: arrify "^2.0.1" minimatch "^3.0.4" -mute-stream@0.0.8, mute-stream@~0.0.4: +mute-stream@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mz@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" - integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== - dependencies: - any-promise "^1.0.0" - object-assign "^4.0.1" - thenify-all "^1.0.0" +mute-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-1.0.0.tgz#e31bd9fe62f0aed23520aa4324ea6671531e013e" + integrity sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA== -nanoid@^3.3.4: - version "3.3.4" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" - integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== +nanoid@3.1.20: + version "3.1.20" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" + integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== + +nanoid@^3.3.6: + version "3.3.6" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" + integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA== natural-compare-lite@^1.4.0: version "1.4.0" @@ -10327,7 +10862,7 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -ncp@^2.0.0: +ncp@*, ncp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" integrity sha1-GVoh1sRuNh0vsSgbo4uR6d9727M= @@ -10342,15 +10877,29 @@ neo-async@^2.6.0, neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -next-tick@1, next-tick@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.1.0.tgz#1836ee30ad56d67ef281b22bd199f709449b35eb" - integrity sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ== +netlify@^13.1.9: + version "13.1.10" + resolved "https://registry.yarnpkg.com/netlify/-/netlify-13.1.10.tgz#27520caf8582bd3c12d961e46b723f614c1d9b28" + integrity sha512-ByFz8S08HWVKd9r/lkTahZX7xSq4IRyPCUvuaduI4GHyQaSWEdVNK1krC05vlhL9W0SzDn8Yjowh0Ru4PKrOYw== + dependencies: + "@netlify/open-api" "^2.19.1" + lodash-es "^4.17.21" + micro-api-client "^3.3.0" + node-fetch "^3.0.0" + omit.js "^2.0.2" + p-wait-for "^4.0.0" + qs "^6.9.6" -nice-try@^1.0.4: - version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" - integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== +nise@^5.1.0: + version "5.1.4" + resolved "https://registry.yarnpkg.com/nise/-/nise-5.1.4.tgz#491ce7e7307d4ec546f5a659b2efe94a18b4bbc0" + integrity sha512-8+Ib8rRJ4L0o3kfmyVCL7gzrohyDe0cMFTBa2d364yIrEGMEoetznKJx899YxjybU6bL9SQkYPSBBs1gyYs8Xg== + dependencies: + "@sinonjs/commons" "^2.0.0" + "@sinonjs/fake-timers" "^10.0.2" + "@sinonjs/text-encoding" "^0.7.1" + just-extend "^4.0.2" + path-to-regexp "^1.7.0" no-case@^3.0.4: version "3.0.4" @@ -10365,6 +10914,11 @@ node-addon-api@^3.2.1: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.2.1.tgz#81325e0a2117789c0128dab65e7e38f07ceba161" integrity sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A== +node-domexception@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + node-emoji@^1.10.0: version "1.11.0" resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-1.11.0.tgz#69a0150e6946e2f115e9d7ea4df7971e2628301c" @@ -10379,13 +10933,22 @@ node-fetch@2.6.7: dependencies: whatwg-url "^5.0.0" -node-fetch@^2.6.7, node-fetch@^2.6.9: - version "2.6.9" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6" - integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg== +node-fetch@^2.6.12, node-fetch@^2.6.7, node-fetch@^2.6.9: + version "2.6.12" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba" + integrity sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g== dependencies: whatwg-url "^5.0.0" +node-fetch@^3.0.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.1.tgz#b3eea7b54b3a48020e46f4f88b9c5a7430d20b2e" + integrity sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow== + dependencies: + data-uri-to-buffer "^4.0.0" + fetch-blob "^3.1.4" + formdata-polyfill "^4.0.10" + node-forge@^1: version "1.3.1" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" @@ -10422,10 +10985,10 @@ node-machine-id@^1.1.12: resolved "https://registry.yarnpkg.com/node-machine-id/-/node-machine-id-1.1.12.tgz#37904eee1e59b320bb9c5d6c0a59f3b469cb6267" integrity sha512-QNABxbrPa3qEIfrE6GOJ7BYIuignnJw7iQ2YPbc3Nla1HzRJjXzZOiikfF8m7eAMfichLt3M4VgLOetqgDmgGQ== -node-releases@^2.0.8: - version "2.0.10" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.10.tgz#c311ebae3b6a148c89b1813fd7c4d3c024ef537f" - integrity sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w== +node-releases@^2.0.12: + version "2.0.13" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.13.tgz#d5ed1627c23e3461e819b02e57b75e4899b1c81d" + integrity sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ== nopt@^5.0.0: version "5.0.0" @@ -10444,7 +11007,7 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-package-data@^3.0.0: +normalize-package-data@^3.0.0, normalize-package-data@^3.0.2, normalize-package-data@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== @@ -10454,12 +11017,12 @@ normalize-package-data@^3.0.0: semver "^7.3.4" validate-npm-package-license "^3.0.1" -normalize-package-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-4.0.0.tgz#1122d5359af21d4cd08718b92b058a658594177c" - integrity sha512-m+GL22VXJKkKbw62ZaBBjv8u6IE3UI4Mh5QakIqs3fWiKe0Xyi6L97hakwZK41/LD4R/2ly71Bayx0NLMwLA/g== +normalize-package-data@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-5.0.0.tgz#abcb8d7e724c40d88462b84982f7cbf6859b4588" + integrity sha512-h9iPVIfrVZ9wVYQnxFgtw1ugSvGEMOlyPWWtm8BMJhnwyEL/FLbYbTY3V3PpjI/BUK67n9PEWDu6eHzu1fB15Q== dependencies: - hosted-git-info "^5.0.0" + hosted-git-info "^6.0.0" is-core-module "^2.8.1" semver "^7.3.5" validate-npm-package-license "^3.0.4" @@ -10484,25 +11047,37 @@ normalize-url@^6.0.1: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== -npm-bundled@^1.1.1, npm-bundled@^1.1.2: +npm-bundled@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.2.tgz#944c78789bd739035b70baa2ca5cc32b8d860bc1" integrity sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ== dependencies: npm-normalize-package-bin "^1.0.1" -npm-install-checks@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/npm-install-checks/-/npm-install-checks-5.0.0.tgz#5ff27d209a4e3542b8ac6b0c1db6063506248234" - integrity sha512-65lUsMI8ztHCxFz5ckCEC44DRvEGdZX5usQFriauxHEwt7upv1FKaQEmAtU0YnOAdwuNWCmk64xYiQABNrEyLA== +npm-bundled@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-3.0.0.tgz#7e8e2f8bb26b794265028491be60321a25a39db7" + integrity sha512-Vq0eyEQy+elFpzsKjMss9kxqb9tG3YHg4dsyWuUENuzvSUWe1TCnW/vV9FkhvBk/brEDoDiVd+M1Btosa6ImdQ== + dependencies: + npm-normalize-package-bin "^3.0.0" + +npm-install-checks@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/npm-install-checks/-/npm-install-checks-6.1.0.tgz#7221210d9d746a40c37bf6c9b6c7a39f85e92998" + integrity sha512-udSGENih/5xKh3Ex+L0PtZcOt0Pa+6ppDLnpG5D49/EhMja3LupaY9E/DtJTxyFBwE09ot7Fc+H4DywnZNWTVA== dependencies: semver "^7.1.1" -npm-normalize-package-bin@^1.0.0, npm-normalize-package-bin@^1.0.1: +npm-normalize-package-bin@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== +npm-normalize-package-bin@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.0.tgz#6097436adb4ef09e2628b59a7882576fe53ce485" + integrity sha512-g+DPQSkusnk7HYXr75NtzkIP4+N81i3RPsGFidF3DzHd9MT9wWngmqoeg/fnHFz5MNdtG4w03s+QnhewSLTT2Q== + npm-package-arg@8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.1.tgz#00ebf16ac395c63318e67ce66780a06db6df1b04" @@ -10512,16 +11087,17 @@ npm-package-arg@8.1.1: semver "^7.0.0" validate-npm-package-name "^3.0.0" -npm-package-arg@^9.0.0, npm-package-arg@^9.0.1: - version "9.0.2" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.0.2.tgz#f3ef7b1b3b02e82564af2d5228b4c36567dcd389" - integrity sha512-v/miORuX8cndiOheW8p2moNuPJ7QhcFh9WGlTorruG8hXSA23vMTEp5hTCmDxic0nD8KHhj/NQgFuySD3GYY3g== +npm-package-arg@^10.0.0, npm-package-arg@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-10.1.0.tgz#827d1260a683806685d17193073cc152d3c7e9b1" + integrity sha512-uFyyCEmgBfZTtrKk/5xDfHp6+MdrqGotX/VoOyEEl3mBwiEE5FlBaePanazJSVMPT7vKepcjYBY2ztg9A3yPIA== dependencies: - hosted-git-info "^5.0.0" + hosted-git-info "^6.0.0" + proc-log "^3.0.0" semver "^7.3.5" - validate-npm-package-name "^4.0.0" + validate-npm-package-name "^5.0.0" -npm-packlist@5.1.1, npm-packlist@^5.1.0: +npm-packlist@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.1.tgz#79bcaf22a26b6c30aa4dd66b976d69cc286800e0" integrity sha512-UfpSvQ5YKwctmodvPPkK6Fwk603aoVsf8AEbmVKAEECrfvL8SSe1A2YIwrJ6xmTHAITKPwwZsWo7WwEbNk0kxw== @@ -10531,28 +11107,35 @@ npm-packlist@5.1.1, npm-packlist@^5.1.0: npm-bundled "^1.1.2" npm-normalize-package-bin "^1.0.1" -npm-pick-manifest@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-7.0.1.tgz#76dda30a7cd6b99be822217a935c2f5eacdaca4c" - integrity sha512-IA8+tuv8KujbsbLQvselW2XQgmXWS47t3CB0ZrzsRZ82DbDfkcFunOaPm4X7qNuhMfq+FmV7hQT4iFVpHqV7mg== +npm-packlist@^7.0.0: + version "7.0.4" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-7.0.4.tgz#033bf74110eb74daf2910dc75144411999c5ff32" + integrity sha512-d6RGEuRrNS5/N84iglPivjaJPxhDbZmlbTwTDX2IbcRHG5bZCdtysYMhwiPvcF4GisXHGn7xsxv+GQ7T/02M5Q== dependencies: - npm-install-checks "^5.0.0" - npm-normalize-package-bin "^1.0.1" - npm-package-arg "^9.0.0" + ignore-walk "^6.0.0" + +npm-pick-manifest@^8.0.0: + version "8.0.1" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-8.0.1.tgz#c6acd97d1ad4c5dbb80eac7b386b03ffeb289e5f" + integrity sha512-mRtvlBjTsJvfCCdmPtiu2bdlx8d/KXtF7yNXNWe7G0Z36qWA9Ny5zXsI2PfBZEv7SXgoxTmNaTzGSbbzDZChoA== + dependencies: + npm-install-checks "^6.0.0" + npm-normalize-package-bin "^3.0.0" + npm-package-arg "^10.0.0" semver "^7.3.5" -npm-registry-fetch@13.3.0, npm-registry-fetch@^13.0.0, npm-registry-fetch@^13.0.1: - version "13.3.0" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-13.3.0.tgz#0ce10fa4a699a1e70685ecf41bbfb4150d74231b" - integrity sha512-10LJQ/1+VhKrZjIuY9I/+gQTvumqqlgnsCufoXETHAPFTS3+M+Z5CFhZRDHGavmJ6rOye3UvNga88vl8n1r6gg== +npm-registry-fetch@^14.0.0, npm-registry-fetch@^14.0.3, npm-registry-fetch@^14.0.5: + version "14.0.5" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-14.0.5.tgz#fe7169957ba4986a4853a650278ee02e568d115d" + integrity sha512-kIDMIo4aBm6xg7jOttupWZamsZRkAqMqwqqbVXnUqstY5+tapvv6bkH/qMR76jdgV+YljEUCyWx3hRYMrJiAgA== dependencies: - make-fetch-happen "^10.0.6" - minipass "^3.1.6" - minipass-fetch "^2.0.3" + make-fetch-happen "^11.0.0" + minipass "^5.0.0" + minipass-fetch "^3.0.0" minipass-json-stream "^1.0.1" minizlib "^2.1.2" - npm-package-arg "^9.0.1" - proc-log "^2.0.0" + npm-package-arg "^10.0.0" + proc-log "^3.0.0" npm-run-path@^4.0.1: version "4.0.1" @@ -10568,10 +11151,10 @@ npm-run-path@^5.1.0: dependencies: path-key "^4.0.0" -npm-to-yarn@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/npm-to-yarn/-/npm-to-yarn-1.0.1.tgz#6cdb95114c4ff0be50a7a2381d4d16131a5f52df" - integrity sha512-bp8T8oNMfLW+N/fE0itFfSu7RReytwhqNd9skbkfHfzGYC+5CCdzS2HnaXz6JiG4AlK2eA0qlT6NJN1SoFvcWQ== +npm-to-yarn@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/npm-to-yarn/-/npm-to-yarn-2.0.0.tgz#59c9c615eca3ba8920308a0b418007b73ffc7492" + integrity sha512-/IbjiJ7vqbxfxJxAZ+QI9CCRjnIbvGxn5KQcSY9xHh0lMKc/Sgqmm7yp7KPmd6TiTZX5/KiSBKlkGHo59ucZbg== npmlog@^6.0.0, npmlog@^6.0.2: version "6.0.2" @@ -10595,16 +11178,82 @@ nth-check@^2.0.0, nth-check@^2.0.1: dependencies: boolbase "^1.0.0" -nx@15.7.2, "nx@>=15.5.2 < 16": - version "15.7.2" - resolved "https://registry.yarnpkg.com/nx/-/nx-15.7.2.tgz#048f8968420f5d56a1f464a83c8c3e84dfc95bf4" - integrity sha512-VRb+CZCji3G4ikdMAGoh6TeU9Q6n5atRwqRSFhUX63er8zhlMvWHLskPMZC4q/81edo/E7RhbmEVUD5MB0JoeA== +nx-cloud@16.1.0: + version "16.1.0" + resolved "https://registry.yarnpkg.com/nx-cloud/-/nx-cloud-16.1.0.tgz#77a57ed50311de7a2124bbd2ac2128e08e938b03" + integrity sha512-2K5OuJ4MEDrn2solje2X+a3UxSCdfR5PIscCRQbBANyvJfl3hGJSTxz0n5xeJJX4cKcQlfAxDQFRH6DHNdTGPQ== + dependencies: + "@nrwl/nx-cloud" "16.1.0" + axios "1.1.3" + chalk "^4.1.0" + dotenv "~10.0.0" + fs-extra "^11.1.0" + node-machine-id "^1.1.12" + open "~8.4.0" + strip-json-comments "^3.1.1" + tar "6.1.11" + yargs-parser ">=21.1.1" + +nx@16.5.1, "nx@>=16.1.3 < 17": + version "16.5.1" + resolved "https://registry.yarnpkg.com/nx/-/nx-16.5.1.tgz#fc0d19090d8faae5f431f9fec199adf95881150c" + integrity sha512-I3hJRE4hG7JWAtncWwDEO3GVeGPpN0TtM8xH5ArZXyDuVeTth/i3TtJzdDzqXO1HHtIoAQN0xeq4n9cLuMil5g== dependencies: - "@nrwl/cli" "15.7.2" - "@nrwl/tao" "15.7.2" + "@nrwl/tao" "16.5.1" + "@parcel/watcher" "2.0.4" + "@yarnpkg/lockfile" "^1.1.0" + "@yarnpkg/parsers" "3.0.0-rc.46" + "@zkochan/js-yaml" "0.0.6" + axios "^1.0.0" + chalk "^4.1.0" + cli-cursor "3.1.0" + cli-spinners "2.6.1" + cliui "^7.0.2" + dotenv "~10.0.0" + enquirer "~2.3.6" + fast-glob "3.2.7" + figures "3.2.0" + flat "^5.0.2" + fs-extra "^11.1.0" + glob "7.1.4" + ignore "^5.0.4" + js-yaml "4.1.0" + jsonc-parser "3.2.0" + lines-and-columns "~2.0.3" + minimatch "3.0.5" + npm-run-path "^4.0.1" + open "^8.4.0" + semver "7.5.3" + string-width "^4.2.3" + strong-log-transformer "^2.1.0" + tar-stream "~2.2.0" + tmp "~0.2.1" + tsconfig-paths "^4.1.2" + tslib "^2.3.0" + v8-compile-cache "2.3.0" + yargs "^17.6.2" + yargs-parser "21.1.1" + optionalDependencies: + "@nx/nx-darwin-arm64" "16.5.1" + "@nx/nx-darwin-x64" "16.5.1" + "@nx/nx-freebsd-x64" "16.5.1" + "@nx/nx-linux-arm-gnueabihf" "16.5.1" + "@nx/nx-linux-arm64-gnu" "16.5.1" + "@nx/nx-linux-arm64-musl" "16.5.1" + "@nx/nx-linux-x64-gnu" "16.5.1" + "@nx/nx-linux-x64-musl" "16.5.1" + "@nx/nx-win32-arm64-msvc" "16.5.1" + "@nx/nx-win32-x64-msvc" "16.5.1" + +nx@16.5.2: + version "16.5.2" + resolved "https://registry.yarnpkg.com/nx/-/nx-16.5.2.tgz#a271513abe73324fdf2924277d5f273d807a6f0e" + integrity sha512-3XAkVBhXuoFgD7r0lASOh2589XSmBUjioevZb13lDjKDN/FHFWedwMZWtmmbzxBGO3EAWjl+3owBS1RIPm1UHw== + dependencies: + "@nrwl/tao" "16.5.2" "@parcel/watcher" "2.0.4" "@yarnpkg/lockfile" "^1.1.0" - "@yarnpkg/parsers" "^3.0.0-rc.18" + "@yarnpkg/parsers" "3.0.0-rc.46" "@zkochan/js-yaml" "0.0.6" axios "^1.0.0" chalk "^4.1.0" @@ -10625,7 +11274,7 @@ nx@15.7.2, "nx@>=15.5.2 < 16": minimatch "3.0.5" npm-run-path "^4.0.1" open "^8.4.0" - semver "7.3.4" + semver "7.5.3" string-width "^4.2.3" strong-log-transformer "^2.1.0" tar-stream "~2.2.0" @@ -10636,17 +11285,18 @@ nx@15.7.2, "nx@>=15.5.2 < 16": yargs "^17.6.2" yargs-parser "21.1.1" optionalDependencies: - "@nrwl/nx-darwin-arm64" "15.7.2" - "@nrwl/nx-darwin-x64" "15.7.2" - "@nrwl/nx-linux-arm-gnueabihf" "15.7.2" - "@nrwl/nx-linux-arm64-gnu" "15.7.2" - "@nrwl/nx-linux-arm64-musl" "15.7.2" - "@nrwl/nx-linux-x64-gnu" "15.7.2" - "@nrwl/nx-linux-x64-musl" "15.7.2" - "@nrwl/nx-win32-arm64-msvc" "15.7.2" - "@nrwl/nx-win32-x64-msvc" "15.7.2" - -object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: + "@nx/nx-darwin-arm64" "16.5.2" + "@nx/nx-darwin-x64" "16.5.2" + "@nx/nx-freebsd-x64" "16.5.2" + "@nx/nx-linux-arm-gnueabihf" "16.5.2" + "@nx/nx-linux-arm64-gnu" "16.5.2" + "@nx/nx-linux-arm64-musl" "16.5.2" + "@nx/nx-linux-x64-gnu" "16.5.2" + "@nx/nx-linux-x64-musl" "16.5.2" + "@nx/nx-win32-arm64-msvc" "16.5.2" + "@nx/nx-win32-x64-msvc" "16.5.2" + +object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= @@ -10719,6 +11369,11 @@ obuf@^1.0.0, obuf@^1.1.2: resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== +omit.js@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/omit.js/-/omit.js-2.0.2.tgz#dd9b8436fab947a5f3ff214cb2538631e313ec2f" + integrity sha512-hJmu9D+bNB40YpL9jYebQl4lsTW6yEHRTroJzNLqQJYHm7c+NQnJGfZmIWh8S3q3KoaxV1aLhV6B3+0N0/kyJg== + on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -10760,10 +11415,10 @@ open@^7.4.2: is-docker "^2.0.0" is-wsl "^2.1.1" -open@^8.0.9, open@^8.4.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/open/-/open-8.4.0.tgz#345321ae18f8138f82565a910fdc6b39e8c244f8" - integrity sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q== +open@^8.0.9, open@^8.4.0, open@~8.4.0: + version "8.4.2" + resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" + integrity sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ== dependencies: define-lazy-prop "^2.0.0" is-docker "^2.1.1" @@ -10774,17 +11429,17 @@ opener@^1.5.2: resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== -optionator@^0.9.1: - version "0.9.1" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.1.tgz#4f236a6373dae0566a6d43e1326674f50c291499" - integrity sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw== +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" deep-is "^0.1.3" fast-levenshtein "^2.0.6" levn "^0.4.1" prelude-ls "^1.2.1" type-check "^0.4.0" - word-wrap "^1.2.3" ora@^5.4.1: version "5.4.1" @@ -10804,7 +11459,7 @@ ora@^5.4.1: os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= + integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== p-cancelable@^1.0.0: version "1.1.0" @@ -10910,6 +11565,11 @@ p-timeout@^3.2.0: dependencies: p-finally "^1.0.0" +p-timeout@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-5.1.0.tgz#b3c691cf4415138ce2d9cfe071dba11f0fee085b" + integrity sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew== + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" @@ -10920,6 +11580,13 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +p-wait-for@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-wait-for/-/p-wait-for-4.1.0.tgz#290f126f49bbd7c84e0cedccb342cd631aaa0f16" + integrity sha512-i8nE5q++9h8oaQHWltS1Tnnv4IoMDOlqN7C0KFG2OdbK0iFJIt6CROZ8wfBM+K4Pxqfnq4C4lkkpXqTEpB5DZw== + dependencies: + p-timeout "^5.0.0" + p-waterfall@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/p-waterfall/-/p-waterfall-2.1.1.tgz#63153a774f472ccdc4eb281cdb2967fcf158b2ee" @@ -10937,31 +11604,28 @@ package-json@^6.3.0: registry-url "^5.0.0" semver "^6.2.0" -pacote@13.6.1, pacote@^13.0.3, pacote@^13.6.1: - version "13.6.1" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.1.tgz#ac6cbd9032b4c16e5c1e0c60138dfe44e4cc589d" - integrity sha512-L+2BI1ougAPsFjXRyBhcKmfT016NscRFLv6Pz5EiNf1CCFJFU0pSKKQwsZTyAQB+sTuUL4TyFyp6J1Ork3dOqw== - dependencies: - "@npmcli/git" "^3.0.0" - "@npmcli/installed-package-contents" "^1.0.7" - "@npmcli/promise-spawn" "^3.0.0" - "@npmcli/run-script" "^4.1.0" - cacache "^16.0.0" - chownr "^2.0.0" - fs-minipass "^2.1.0" - infer-owner "^1.0.4" - minipass "^3.1.6" - mkdirp "^1.0.4" - npm-package-arg "^9.0.0" - npm-packlist "^5.1.0" - npm-pick-manifest "^7.0.0" - npm-registry-fetch "^13.0.1" - proc-log "^2.0.0" +pacote@^15.2.0: + version "15.2.0" + resolved "https://registry.yarnpkg.com/pacote/-/pacote-15.2.0.tgz#0f0dfcc3e60c7b39121b2ac612bf8596e95344d3" + integrity sha512-rJVZeIwHTUta23sIZgEIM62WYwbmGbThdbnkt81ravBplQv+HjyroqnLRNH2+sLJHcGZmLRmhPwACqhfTcOmnA== + dependencies: + "@npmcli/git" "^4.0.0" + "@npmcli/installed-package-contents" "^2.0.1" + "@npmcli/promise-spawn" "^6.0.1" + "@npmcli/run-script" "^6.0.0" + cacache "^17.0.0" + fs-minipass "^3.0.0" + minipass "^5.0.0" + npm-package-arg "^10.0.0" + npm-packlist "^7.0.0" + npm-pick-manifest "^8.0.0" + npm-registry-fetch "^14.0.0" + proc-log "^3.0.0" promise-retry "^2.0.1" - read-package-json "^5.0.0" - read-package-json-fast "^2.0.3" - rimraf "^3.0.2" - ssri "^9.0.0" + read-package-json "^6.0.0" + read-package-json-fast "^3.0.0" + sigstore "^1.3.0" + ssri "^10.0.0" tar "^6.1.11" param-case@^3.0.4: @@ -10986,15 +11650,6 @@ parent-module@^2.0.0: dependencies: callsites "^3.1.0" -parse-conflict-json@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/parse-conflict-json/-/parse-conflict-json-2.0.2.tgz#3d05bc8ffe07d39600dc6436c6aefe382033d323" - integrity sha512-jDbRGb00TAPFsKWCpZZOT93SxVP9nONOSgES3AevqRq/CHvavEBvKAjxX9p5Y5F0RZLxH9Ufd9+RwtCsa+lFDA== - dependencies: - json-parse-even-better-errors "^2.3.1" - just-diff "^5.0.1" - just-diff-apply "^5.2.0" - parse-entities@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8" @@ -11077,35 +11732,36 @@ pascal-case@^3.1.2: no-case "^3.0.4" tslib "^2.0.3" -patch-package@^6.4.7: - version "6.4.7" - resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.4.7.tgz#2282d53c397909a0d9ef92dae3fdeb558382b148" - integrity sha512-S0vh/ZEafZ17hbhgqdnpunKDfzHQibQizx9g8yEf5dcVk3KOflOfdufRXQX8CSEkyOQwuM/bNz1GwKvFj54kaQ== +patch-package@^7.0.0: + version "7.0.2" + resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-7.0.2.tgz#c01589bb6964854b5210506a5845d47900641f5a" + integrity sha512-PMYfL8LXxGIRmxXLqlEaBxzKPu7/SdP13ld6GSfAUJUZRmBDPp8chZs0dpzaAFn9TSPnFiMwkC6PJt6pBiAl8Q== dependencies: "@yarnpkg/lockfile" "^1.1.0" - chalk "^2.4.2" - cross-spawn "^6.0.5" + chalk "^4.1.2" + ci-info "^3.7.0" + cross-spawn "^7.0.3" find-yarn-workspace-root "^2.0.0" - fs-extra "^7.0.1" - is-ci "^2.0.0" + fs-extra "^9.0.0" klaw-sync "^6.0.0" - minimist "^1.2.0" + minimist "^1.2.6" open "^7.4.2" rimraf "^2.6.3" - semver "^5.6.0" + semver "^7.5.3" slash "^2.0.0" tmp "^0.0.33" - -path-exists@4.0.0, path-exists@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" - integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + yaml "^2.2.2" path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -11116,11 +11772,6 @@ path-is-inside@1.0.2: resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= -path-key@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" - integrity sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw== - path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -11136,6 +11787,14 @@ path-parse@^1.0.6, path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.10.1, path-scurry@^1.6.1, path-scurry@^1.7.0: + version "1.10.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698" + integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ== + dependencies: + lru-cache "^9.1.1 || ^10.0.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -11165,6 +11824,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pathval@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" + integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -11180,7 +11844,7 @@ pidtree@^0.6.0: resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c" integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g== -pify@5.0.0, pify@^5.0.0: +pify@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== @@ -11219,10 +11883,10 @@ pkg-up@^3.1.0: dependencies: find-up "^3.0.0" -playwright-core@1.31.2: - version "1.31.2" - resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.31.2.tgz#debf4b215d14cb619adb7e511c164d068075b2ed" - integrity sha512-a1dFgCNQw4vCsG7bnojZjDnPewZcw7tZUNFN0ZkcLYKj+mPmXvg4MpaaKZ5SgqPsOmqIf2YsVRkgqiRDxD+fDQ== +playwright-core@1.36.1: + version "1.36.1" + resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.36.1.tgz#f5f275d70548768ca892583519c89b237a381c77" + integrity sha512-7+tmPuMcEW4xeCL9cp9KxmYpQYHKkyjwoXRnoeTowaeNat8PoBMk/HwCYhqkH2fRkshfKEOiVus/IhID2Pg8kg== pluralize@^8.0.0: version "8.0.0" @@ -11470,10 +12134,20 @@ postcss-reduce-transforms@^5.1.0: dependencies: postcss-value-parser "^4.2.0" -postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.5, postcss-selector-parser@^6.0.9: - version "6.0.9" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.9.tgz#ee71c3b9ff63d9cd130838876c13a2ec1a992b2f" - integrity sha512-UO3SgnZOVTwu4kyLR22UQ1xZh086RyNZppb7lLAKBFK8a32ttG5i87Y/P3+2bRSjZNyJ1B7hfFNo273tKe9YxQ== +postcss-resolve-nested-selector@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/postcss-resolve-nested-selector/-/postcss-resolve-nested-selector-0.1.1.tgz#29ccbc7c37dedfac304e9fff0bf1596b3f6a0e4e" + integrity sha512-HvExULSwLqHLgUy1rl3ANIqCsvMS0WHss2UOsXhXnQaZ9VCc2oBvIpXrl00IUFT5ZDITME0o6oiXeiHr2SAIfw== + +postcss-safe-parser@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz#bb4c29894171a94bc5c996b9a30317ef402adaa1" + integrity sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ== + +postcss-selector-parser@^6.0.13, postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.5, postcss-selector-parser@^6.0.9: + version "6.0.13" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.13.tgz#d05d8d76b1e8e173257ef9d60b706a8e5e99bf1b" + integrity sha512-EaV1Gl4mUEV4ddhDnv/xtj7sxwrwxdetHdWUGnT4VJQf+4d05v6lHYZr8N573k5Z0BViss7BDhfWtKS3+sfAqQ== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" @@ -11485,6 +12159,11 @@ postcss-sort-media-queries@^4.2.1: dependencies: sort-css-media-queries "2.0.4" +postcss-sorting@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/postcss-sorting/-/postcss-sorting-8.0.2.tgz#6393385ece272baf74bee9820fb1b58098e4eeca" + integrity sha512-M9dkSrmU00t/jK7rF6BZSZauA5MAaBW4i5EnJXspMwt4iqTh/L9j6fgMnbElEOfyRyfLfVbIHj/R52zHzAPe1Q== + postcss-svgo@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/postcss-svgo/-/postcss-svgo-5.1.0.tgz#0a317400ced789f233a28826e77523f15857d80d" @@ -11510,12 +12189,12 @@ postcss-zindex@^5.1.0: resolved "https://registry.yarnpkg.com/postcss-zindex/-/postcss-zindex-5.1.0.tgz#4a5c7e5ff1050bd4c01d95b1847dfdcc58a496ff" integrity sha512-fgFMf0OtVSBR1va1JNHYgMxYk73yhn/qb4uQDq1DLGYolz8gHCyr/sesEuGUaYs58E3ZJRcpoGuPVoB7Meiq9A== -postcss@^8.3.11, postcss@^8.4.13, postcss@^8.4.14, postcss@^8.4.7: - version "8.4.14" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" - integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig== +postcss@^8.3.11, postcss@^8.4.13, postcss@^8.4.14, postcss@^8.4.21, postcss@^8.4.24, postcss@^8.4.7: + version "8.4.25" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.25.tgz#4a133f5e379eda7f61e906c3b1aaa9b81292726f" + integrity sha512-7taJ/8t2av0Z+sQEvNzCkpDynl0tX3uJMCODi6nT3PfASC7dYCWV9aQ+uiCf+KBD4SEFcu+GvJdGdwzQ6OSjCw== dependencies: - nanoid "^3.3.4" + nanoid "^3.3.6" picocolors "^1.0.0" source-map-js "^1.0.2" @@ -11529,10 +12208,10 @@ prepend-http@^2.0.0: resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897" integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc= -prettier@*, prettier@2.8.1, prettier@^2.6.2: - version "2.8.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc" - integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg== +prettier@*, prettier@^2.8.4: + version "2.8.4" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3" + integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw== pretty-bytes@^5.3.0: version "5.6.0" @@ -11547,12 +12226,12 @@ pretty-error@^4.0.0: lodash "^4.17.20" renderkid "^3.0.0" -pretty-format@*, pretty-format@^29, pretty-format@^29.0.0, pretty-format@^29.0.3, pretty-format@^29.1.2, pretty-format@^29.5.0: - version "29.5.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a" - integrity sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw== +pretty-format@*, pretty-format@^29, pretty-format@^29.0.0, pretty-format@^29.6.1: + version "29.6.1" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.6.1.tgz#ec838c288850b7c4f9090b867c2d4f4edbfb0f3e" + integrity sha512-7jRj+yXO0W7e4/tSJKoR7HRIHLPPjtNaUGG2xxKQnGvPNRkgWcQ0AZX6P4KBRJN4FcTBWb3sa7DVUJmocYuoog== dependencies: - "@jest/schemas" "^29.4.3" + "@jest/schemas" "^29.6.0" ansi-styles "^5.0.0" react-is "^18.0.0" @@ -11571,26 +12250,16 @@ prismjs@^1.28.0: resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.28.0.tgz#0d8f561fa0f7cf6ebca901747828b149147044b6" integrity sha512-8aaXdYvl1F7iC7Xm1spqSaY/OJBpYW3v+KJ+F17iYxvdc8sfjW194COK5wVhMZX45tGteiBQgdvD/nhxcRwylw== -proc-log@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-2.0.1.tgz#8f3f69a1f608de27878f91f5c688b225391cb685" - integrity sha512-Kcmo2FhfDTXdcbfDH76N7uBYHINxc/8GW7UAVuVP9I+Va3uHSerrnKV6dLooga/gh7GlgzuCCr/eoldnL1muGw== +proc-log@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-3.0.0.tgz#fb05ef83ccd64fd7b20bbe9c8c1070fc08338dd8" + integrity sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A== process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -promise-all-reject-late@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/promise-all-reject-late/-/promise-all-reject-late-1.0.1.tgz#f8ebf13483e5ca91ad809ccc2fcf25f26f8643c2" - integrity sha512-vuf0Lf0lOxyQREH7GDIOUMLS7kz+gs8i6B+Yi8dC68a2sychGrHTJYghMBD6k7eUcH0H5P73EckCA48xijWqXw== - -promise-call-limit@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/promise-call-limit/-/promise-call-limit-1.0.1.tgz#4bdee03aeb85674385ca934da7114e9bcd3c6e24" - integrity sha512-3+hgaa19jzCGLuSCbieeRsu5C2joKfYn8pY6JAuXFRVfF4IO+L7UPpFWNTeWT9pM7uhskvbPPd/oEOktCn317Q== - promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" @@ -11619,12 +12288,12 @@ prompts@^2.0.1, prompts@^2.4.2: kleur "^3.0.3" sisteransi "^1.0.5" -promzard@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/promzard/-/promzard-0.3.0.tgz#26a5d6ee8c7dee4cb12208305acfb93ba382a9ee" - integrity sha1-JqXW7ox97kyxIggwWs+5O6OCqe4= +promzard@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/promzard/-/promzard-1.0.0.tgz#3246f8e6c9895a77c0549cefb65828ac0f6c006b" + integrity sha512-KQVDEubSUHGSt5xLakaToDFrSoZhStB8dXLzk2xvwR67gJktrHFvpR63oZgHyK19WKbHFLXJqCPXdVR3aBP8Ig== dependencies: - read "1" + read "^2.0.0" prop-types@^15.5.4, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" @@ -11642,11 +12311,6 @@ property-information@^5.0.0, property-information@^5.3.0: dependencies: xtend "^4.0.0" -proto-list@~1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" - integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= - protocols@^2.0.0, protocols@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/protocols/-/protocols-2.0.1.tgz#8f155da3fc0f32644e83c5782c8e8212ccf70a86" @@ -11700,11 +12364,6 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.1.tgz#31207dddd15d43f299fdcdb2f572df65030c19af" integrity sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg== -q@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" - integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= - qs@6.10.3: version "6.10.3" resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.3.tgz#d6cde1b2ffca87b5aa57889816c5f81535e22e8e" @@ -11712,6 +12371,13 @@ qs@6.10.3: dependencies: side-channel "^1.0.4" +qs@^6.9.6: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -11729,6 +12395,11 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== +quick-lru@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" + integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -11756,6 +12427,14 @@ raw-body@2.5.1: iconv-lite "0.4.24" unpipe "1.0.0" +raw-loader@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/raw-loader/-/raw-loader-4.0.2.tgz#1aac6b7d1ad1501e66efdac1522c73e59a584eb6" + integrity sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA== + dependencies: + loader-utils "^2.0.0" + schema-utils "^3.0.0" + rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -11806,7 +12485,7 @@ react-dev-utils@^12.0.1: strip-ansi "^6.0.1" text-table "^0.2.0" -react-dom@^18.1.0: +react-dom@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== @@ -11928,35 +12607,35 @@ react-textarea-autosize@^8.3.2: use-composed-ref "^1.0.0" use-latest "^1.0.0" -react@^18.1.0: +react@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== dependencies: loose-envify "^1.1.0" -read-cmd-shim@3.0.0, read-cmd-shim@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-3.0.0.tgz#62b8c638225c61e6cc607f8f4b779f3b8238f155" - integrity sha512-KQDVjGqhZk92PPNRj9ZEXEuqg8bUobSKRw+q0YQ3TKI5xkce7bUJobL4Z/OtiEbAAv70yEpYIXp4iQ9L8oPVog== +read-cmd-shim@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-4.0.0.tgz#640a08b473a49043e394ae0c7a34dd822c73b9bb" + integrity sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q== -read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz#323ca529630da82cb34b36cc0b996693c98c2b83" - integrity sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ== +read-package-json-fast@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz#394908a9725dc7a5f14e70c8e7556dff1d2b1049" + integrity sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw== dependencies: - json-parse-even-better-errors "^2.3.0" - npm-normalize-package-bin "^1.0.1" + json-parse-even-better-errors "^3.0.0" + npm-normalize-package-bin "^3.0.0" -read-package-json@5.0.1, read-package-json@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-5.0.1.tgz#1ed685d95ce258954596b13e2e0e76c7d0ab4c26" - integrity sha512-MALHuNgYWdGW3gKzuNMuYtcSSZbGQm94fAp16xt8VsYTLBjUSc55bLMKe6gzpWue0Tfi6CBgwCSdDAqutGDhMg== +read-package-json@6.0.4, read-package-json@^6.0.0: + version "6.0.4" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-6.0.4.tgz#90318824ec456c287437ea79595f4c2854708836" + integrity sha512-AEtWXYfopBj2z5N5PbkAOeNHRPUg5q+Nen7QLxV8M2zJq1ym6/lCz3fYNTCXe19puu2d06jfHhrP7v/S2PtMMw== dependencies: - glob "^8.0.1" - json-parse-even-better-errors "^2.3.1" - normalize-package-data "^4.0.0" - npm-normalize-package-bin "^1.0.1" + glob "^10.2.2" + json-parse-even-better-errors "^3.0.0" + normalize-package-data "^5.0.0" + npm-normalize-package-bin "^3.0.0" read-pkg-up@^3.0.0: version "3.0.0" @@ -11975,6 +12654,15 @@ read-pkg-up@^7.0.1: read-pkg "^5.2.0" type-fest "^0.8.1" +read-pkg-up@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-8.0.0.tgz#72f595b65e66110f43b052dd9af4de6b10534670" + integrity sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ== + dependencies: + find-up "^5.0.0" + read-pkg "^6.0.0" + type-fest "^1.0.1" + read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" @@ -11994,21 +12682,22 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -read@1, read@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" - integrity sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ= +read-pkg@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-6.0.0.tgz#a67a7d6a1c2b0c3cd6aa2ea521f40c458a4a504c" + integrity sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q== dependencies: - mute-stream "~0.0.4" + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^3.0.2" + parse-json "^5.2.0" + type-fest "^1.0.1" -readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== +read@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/read/-/read-2.1.0.tgz#69409372c54fe3381092bc363a00650b6ac37218" + integrity sha512-bvxi1QLJHcaywCAEsAk4DG3nVoqiY2Csps3qzWalhj5hFqRn1d/OixkFXtLO1PrgHUcAP0FNaSY/5GYNfENFFQ== dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" + mute-stream "~1.0.0" readable-stream@^2.0.1, readable-stream@~2.3.6: version "2.3.7" @@ -12023,15 +12712,21 @@ readable-stream@^2.0.1, readable-stream@~2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readdir-scoped-modules@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309" - integrity sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw== +readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== dependencies: - debuglog "^1.0.1" - dezalgo "^1.0.0" - graceful-fs "^4.1.2" - once "^1.3.0" + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readdirp@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e" + integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ== + dependencies: + picomatch "^2.2.1" readdirp@~3.6.0: version "3.6.0" @@ -12067,10 +12762,18 @@ redent@^3.0.0: indent-string "^4.0.0" strip-indent "^3.0.0" -regenerate-unicode-properties@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz#7f442732aa7934a3740c779bb9b3340dccc1fb56" - integrity sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw== +redent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/redent/-/redent-4.0.0.tgz#0c0ba7caabb24257ab3bb7a4fd95dd1d5c5681f9" + integrity sha512-tYkDkVVtYkSVhuQ4zBgfvciymHaeuel+zFKXShfDnFP5SyVEP7qo70Rf1jTOTCx3vGNAbnEi/xFkcfQVMIBWag== + dependencies: + indent-string "^5.0.0" + strip-indent "^4.0.0" + +regenerate-unicode-properties@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c" + integrity sha512-d1VudCLoIGitcU/hEg2QqvyGZQmdC0Lf8BqdOMXGFSvJP4bNV1+XqbPQeHHLD51Jh4QJJ225dlIFvY4Ly6MXmQ== dependencies: regenerate "^1.4.2" @@ -12084,17 +12787,17 @@ regenerator-runtime@^0.13.11, regenerator-runtime@^0.13.4: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== -regenerator-transform@^0.15.0: - version "0.15.0" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.0.tgz#cbd9ead5d77fae1a48d957cf889ad0586adb6537" - integrity sha512-LsrGtPmbYg19bcPHwdtmXwbW+TqNvtY4riE3P83foeHRroMbH6/2ddFBfab3t7kbzc7v7p4wbkIecHImqt0QNg== +regenerator-transform@^0.15.1: + version "0.15.1" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.15.1.tgz#f6c4e99fc1b4591f780db2586328e4d9a9d8dc56" + integrity sha512-knzmNAcuyxV+gQCufkYcvOqX/qIIfHLv0u5x79kRxuGojfYVky1f15TzZEu2Avte8QGepvUNTnLskf8E6X6Vyg== dependencies: "@babel/runtime" "^7.8.4" regexp-tree@^0.1.24, regexp-tree@~0.1.1: - version "0.1.24" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.24.tgz#3d6fa238450a4d66e5bc9c4c14bb720e2196829d" - integrity sha512-s2aEVuLhvnVJW6s/iPgEGK6R+/xngd2jNQ+xy4bXNDKxZKJH6jpPHY6kVeVv1IeLCHgswRj+Kl3ELaDjG6V1iw== + version "0.1.27" + resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.27.tgz#2198f0ef54518ffa743fe74d983b56ffd631b6cd" + integrity sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA== regexp.prototype.flags@^1.4.3: version "1.4.3" @@ -12105,17 +12808,17 @@ regexp.prototype.flags@^1.4.3: define-properties "^1.1.3" functions-have-names "^1.2.2" -regexpu-core@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.1.0.tgz#2f8504c3fd0ebe11215783a41541e21c79942c6d" - integrity sha512-bb6hk+xWd2PEOkj5It46A16zFMs2mv86Iwpdu94la4S3sJ7C973h2dHpYKwIBGaWSO7cIRJ+UX0IeMaWcO4qwA== +regexpu-core@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.2.tgz#11a2b06884f3527aec3e93dbbf4a3b958a95546b" + integrity sha512-RAM5FlZz+Lhmo7db9L298p2vHP5ZywrVXmVXpmAD9GuL5MPH6t9ROw1iA/wfHkQ76Qe7AaPF0nGuim96/IrQMQ== dependencies: + "@babel/regjsgen" "^0.8.0" regenerate "^1.4.2" - regenerate-unicode-properties "^10.0.1" - regjsgen "^0.6.0" - regjsparser "^0.8.2" + regenerate-unicode-properties "^10.1.0" + regjsparser "^0.9.1" unicode-match-property-ecmascript "^2.0.0" - unicode-match-property-value-ecmascript "^2.0.0" + unicode-match-property-value-ecmascript "^2.1.0" registry-auth-token@^4.0.0: version "4.2.1" @@ -12131,15 +12834,10 @@ registry-url@^5.0.0: dependencies: rc "^1.2.8" -regjsgen@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.6.0.tgz#83414c5354afd7d6627b16af5f10f41c4e71808d" - integrity sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA== - -regjsparser@^0.8.2: - version "0.8.4" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.8.4.tgz#8a14285ffcc5de78c5b95d62bbf413b6bc132d5f" - integrity sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA== +regjsparser@^0.10.0: + version "0.10.0" + resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.10.0.tgz#b1ed26051736b436f22fdec1c8f72635f9f44892" + integrity sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA== dependencies: jsesc "~0.5.0" @@ -12239,7 +12937,7 @@ repeat-string@^1.5.4, repeat-string@^1.6.1: require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" - integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== require-from-string@^2.0.2: version "2.0.2" @@ -12291,16 +12989,16 @@ resolve.exports@1.1.0: integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== resolve.exports@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.1.tgz#cee884cd4e3f355660e501fa3276b27d7ffe5a20" - integrity sha512-OEJWVeimw8mgQuj3HfkNl4KqRevH7lzeQNaWRPfx0PPse7Jk6ozcsG4FKVgtzDsC1KUF+YlTHh17NcgHOPykLw== + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.14.2, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.3.2, resolve@~1.22.1: - version "1.22.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" - integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.22.1, resolve@^1.3.2, resolve@~1.22.1: + version "1.22.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.2.tgz#0ed0943d4e301867955766c9f3e1ae6d01c6845f" + integrity sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g== dependencies: - is-core-module "^2.9.0" + is-core-module "^2.11.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" @@ -12356,10 +13054,12 @@ rfdc@^1.3.0: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== -rimraf@*, rimraf@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-4.1.1.tgz#ec29817863e5d82d22bca82f9dc4325be2f1e72b" - integrity sha512-Z4Y81w8atcvaJuJuBB88VpADRH66okZAuEm+Jtaufa+s7rZmIz+Hik2G53kGaNytE7lsfXyWktTmfVz0H9xuDg== +rimraf@*, rimraf@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.1.tgz#0881323ab94ad45fec7c0221f27ea1a142f3f0d0" + integrity sha512-OfFZdwtd3lZ+XZzYP/6gTACubwFcHdLRqS9UX3UwpU2dnGQYkPFISRwvM3w9IiB2w7bW5qGo/uAwE4SmXXSKvg== + dependencies: + glob "^10.2.5" rimraf@^2.6.3: version "2.7.1" @@ -12375,6 +13075,13 @@ rimraf@^3.0.0, rimraf@^3.0.2: dependencies: glob "^7.1.3" +rimraf@^4.4.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-4.4.1.tgz#bd33364f67021c5b79e93d7f4fa0568c7c21b755" + integrity sha512-Gk8NlF062+T9CqNGn6h4tls3k6T1+/nXdOcSZVikNVtlRdYpA7wRJJMoXmuvOnLW844rPjdQ7JgXCYM6PPC/og== + dependencies: + glob "^9.2.0" + rollup-plugin-terser@^7.0.0: version "7.0.2" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" @@ -12385,7 +13092,7 @@ rollup-plugin-terser@^7.0.0: serialize-javascript "^4.0.0" terser "^5.0.0" -rollup@^2.43.1, rollup@^2.75.4: +rollup@^2.43.1: version "2.79.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7" integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw== @@ -12429,17 +13136,10 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" -rxjs@^6.5.4: - version "6.6.7" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" - integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== - dependencies: - tslib "^1.9.0" - rxjs@^7.5.4, rxjs@^7.5.5, rxjs@^7.8.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" - integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg== + version "7.8.1" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.1.tgz#6f6f3d99ea8044291efd92e7c7fcf562c4057543" + integrity sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg== dependencies: tslib "^2.1.0" @@ -12504,10 +13204,10 @@ schema-utils@^2.6.5: ajv "^6.12.4" ajv-keywords "^3.5.2" -schema-utils@^3.0.0, schema-utils@^3.1.0, schema-utils@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.1.1.tgz#bc74c4b6b6995c1d88f76a8b77bea7219e0c8281" - integrity sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw== +schema-utils@^3.0.0, schema-utils@^3.1.1, schema-utils@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" + integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== dependencies: "@types/json-schema" "^7.0.8" ajv "^6.12.5" @@ -12550,24 +13250,31 @@ semver-diff@^3.1.1: dependencies: semver "^6.3.0" -"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@7.3.4: - version "7.3.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" - integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== +semver@7.5.3: + version "7.5.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" + integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== + +semver@^7.0.0, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" -semver@^7.0.0, semver@^7.1.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@~7.3.0: +semver@~7.3.0: version "7.3.8" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== @@ -12593,6 +13300,13 @@ send@0.18.0: range-parser "~1.2.1" statuses "2.0.1" +serialize-javascript@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-5.0.1.tgz#7886ec848049a462467a97d3d918ebb2aaf934f4" + integrity sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA== + dependencies: + randombytes "^2.1.0" + serialize-javascript@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" @@ -12600,10 +13314,10 @@ serialize-javascript@^4.0.0: dependencies: randombytes "^2.1.0" -serialize-javascript@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== +serialize-javascript@^6.0.0, serialize-javascript@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.1.tgz#b206efb27c3da0b0ab6b52f48d170b7996458e5c" + integrity sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w== dependencies: randombytes "^2.1.0" @@ -12676,13 +13390,6 @@ shallowequal@^1.1.0: resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== -shebang-command@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" - integrity sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg== - dependencies: - shebang-regex "^1.0.0" - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -12690,11 +13397,6 @@ shebang-command@^2.0.0: dependencies: shebang-regex "^3.0.0" -shebang-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" - integrity sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ== - shebang-regex@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" @@ -12728,6 +13430,33 @@ signal-exit@3.0.7, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.0.2.tgz#ff55bb1d9ff2114c13b400688fa544ac63c36967" + integrity sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q== + +sigstore@^1.3.0, sigstore@^1.4.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/sigstore/-/sigstore-1.6.0.tgz#887a4007c6ee83f3ef3fd844be1a0840e849c301" + integrity sha512-QODKff/qW/TXOZI6V/Clqu74xnInAS6it05mufj4/fSewexLtfEntgLZZcBtUK44CDQyUE5TUXYy1ARYzlfG9g== + dependencies: + "@sigstore/protobuf-specs" "^0.1.0" + "@sigstore/tuf" "^1.0.0" + make-fetch-happen "^11.0.1" + tuf-js "^1.1.3" + +sinon@^11.0.0: + version "11.1.2" + resolved "https://registry.yarnpkg.com/sinon/-/sinon-11.1.2.tgz#9e78850c747241d5c59d1614d8f9cbe8840e8674" + integrity sha512-59237HChms4kg7/sXhiRcUzdSkKuydDeTiamT/jesUVHshBgL8XAmhgFo0GfK6RruMDM/iRSij1EybmMog9cJw== + dependencies: + "@sinonjs/commons" "^1.8.3" + "@sinonjs/fake-timers" "^7.1.2" + "@sinonjs/samsam" "^6.0.2" + diff "^5.0.0" + nise "^5.1.0" + supports-color "^7.2.0" + sirv@^1.0.7: version "1.0.18" resolved "https://registry.yarnpkg.com/sirv/-/sirv-1.0.18.tgz#105fab52fb656ce8a2bebbf36b11052005952899" @@ -12798,11 +13527,6 @@ smart-buffer@^4.2.0: resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.2.0.tgz#6e1d71fa4f18c05f7d0ff216dd16a481d0e8d9ae" integrity sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg== -smob@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/smob/-/smob-0.0.6.tgz#09b268fea916158a2781c152044c6155adbb8aa1" - integrity sha512-V21+XeNni+tTyiST1MHsa84AQhT1aFZipzPpOFAVB8DkHzwJyjjAmt9bgwnuZiZWnIbMo2duE29wybxv/7HWUw== - sockjs@^0.3.24: version "0.3.24" resolved "https://registry.yarnpkg.com/sockjs/-/sockjs-0.3.24.tgz#c9bc8995f33a111bea0395ec30aa3206bdb5ccce" @@ -12821,6 +13545,15 @@ socks-proxy-agent@^6.1.1: debug "^4.3.3" socks "^2.6.2" +socks-proxy-agent@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz#dc069ecf34436621acb41e3efa66ca1b5fed15b6" + integrity sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww== + dependencies: + agent-base "^6.0.2" + debug "^4.3.3" + socks "^2.6.2" + socks@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/socks/-/socks-2.6.2.tgz#ec042d7960073d40d94268ff3bb727dc685f111a" @@ -12841,7 +13574,7 @@ sort-keys@^2.0.0: dependencies: is-plain-obj "^1.0.0" -source-map-js@^1.0.2: +source-map-js@^1.0.1, source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== @@ -12854,6 +13587,14 @@ source-map-support@0.5.13: buffer-from "^1.0.0" source-map "^0.6.0" +source-map-support@0.5.19: + version "0.5.19" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" + integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + source-map-support@^0.5.21, source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -12890,9 +13631,9 @@ space-separated-tokens@^1.0.0: integrity sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA== spdx-correct@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" - integrity sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w== + version "3.2.0" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.2.0.tgz#4f5ab0668f0059e34f9c00dce331784a12de4e9c" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== dependencies: spdx-expression-parse "^3.0.0" spdx-license-ids "^3.0.0" @@ -12911,9 +13652,9 @@ spdx-expression-parse@^3.0.0: spdx-license-ids "^3.0.0" spdx-license-ids@^3.0.0: - version "3.0.10" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.10.tgz#0d9becccde7003d6c658d487dd48a32f0bf3014b" - integrity sha512-oie3/+gKf7QtpitB0LYLETe+k8SifzsX4KixvpOsbI6S0kRiRQ5MKOio8eMSAKQ17N06+wdEOXRiId+zOxo0hA== + version "3.0.13" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.13.tgz#7189a474c46f8d47c7b0da4b987bb45e908bd2d5" + integrity sha512-XkD+zwiqXHikFZm4AX/7JSCXA98U5Db4AFd5XUg/+9UNtnH75+Z9KxtpYiJZx36mUDVOwH83pl7yvCer6ewM3w== spdy-transport@^3.0.0: version "3.0.0" @@ -12938,14 +13679,14 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" -split2@^3.0.0: +split2@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== dependencies: readable-stream "^3.0.0" -split@^1.0.0: +split@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== @@ -12957,7 +13698,14 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -ssri@9.0.1, ssri@^9.0.0: +ssri@^10.0.0, ssri@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-10.0.1.tgz#c61f85894bbc6929fc3746f05e31cf5b44c030d5" + integrity sha512-WVy6di9DlPOeBWEjMScpNipeSX2jIZBGEn5Uuo8Q7aIuFEuDX0pw8RxcOjlD1TWP4obi24ki7m/13+nFpcbXrw== + dependencies: + minipass "^4.0.0" + +ssri@^9.0.0, ssri@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/ssri/-/ssri-9.0.1.tgz#544d4c357a8d7b71a19700074b6883fcb4eae057" integrity sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q== @@ -13016,7 +13764,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -13025,7 +13773,15 @@ string-length@^4.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^5.0.0, string-width@^5.0.1: +"string-width@^1.0.2 || 2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== @@ -13098,13 +13854,20 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow== + dependencies: + ansi-regex "^3.0.0" + strip-ansi@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" @@ -13149,7 +13912,14 @@ strip-indent@^3.0.0: dependencies: min-indent "^1.0.0" -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: +strip-indent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-4.0.0.tgz#b41379433dd06f5eae805e21d631e07ee670d853" + integrity sha512-mnVSV2l+Zv6BLpSD/8V87CW/y9EmmbYzGCIavsnsI6/nwn26DwffM/yztm30Z/I2DY9wdS3vXVCMnHDgZaVNoA== + dependencies: + min-indent "^1.0.1" + +strip-json-comments@3.1.1, strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -13168,6 +13938,11 @@ strong-log-transformer@2.1.0, strong-log-transformer@^2.1.0: minimist "^1.2.0" through "^2.3.4" +style-search@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/style-search/-/style-search-0.1.0.tgz#7958c793e47e32e07d2b5cafe5c0bf8e12e77902" + integrity sha512-Dj1Okke1C3uKKwQcetra4jSuk0DqbzbYtXipzFlFMZtowbF1x7BKJwB9AayVMyFARvU8EDrZdcax4At/452cAg== + style-to-object@0.3.0, style-to-object@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-0.3.0.tgz#b1b790d205991cc783801967214979ee19a76e46" @@ -13183,6 +13958,79 @@ stylehacks@^5.1.0: browserslist "^4.16.6" postcss-selector-parser "^6.0.4" +stylelint-config-recommended@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-13.0.0.tgz#c48a358cc46b629ea01f22db60b351f703e00597" + integrity sha512-EH+yRj6h3GAe/fRiyaoO2F9l9Tgg50AOFhaszyfov9v6ayXJ1IkSHwTxd7lB48FmOeSGDPLjatjO11fJpmarkQ== + +stylelint-config-standard@^34.0.0: + version "34.0.0" + resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-34.0.0.tgz#309f3c48118a02aae262230c174282e40e766cf4" + integrity sha512-u0VSZnVyW9VSryBG2LSO+OQTjN7zF9XJaAJRX/4EwkmU0R2jYwmBSN10acqZisDitS0CLiEiGjX7+Hrq8TAhfQ== + dependencies: + stylelint-config-recommended "^13.0.0" + +stylelint-order@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/stylelint-order/-/stylelint-order-6.0.3.tgz#160b78650bd90463241b992581efee7159baefc2" + integrity sha512-1j1lOb4EU/6w49qZeT2SQVJXm0Ht+Qnq9GMfUa3pMwoyojIWfuA+JUDmoR97Bht1RLn4ei0xtLGy87M7d29B1w== + dependencies: + postcss "^8.4.21" + postcss-sorting "^8.0.2" + +stylelint@^15.10.1: + version "15.10.1" + resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-15.10.1.tgz#93f189958687e330c106b010cbec0c41dcae506d" + integrity sha512-CYkzYrCFfA/gnOR+u9kJ1PpzwG10WLVnoxHDuBA/JiwGqdM9+yx9+ou6SE/y9YHtfv1mcLo06fdadHTOx4gBZQ== + dependencies: + "@csstools/css-parser-algorithms" "^2.3.0" + "@csstools/css-tokenizer" "^2.1.1" + "@csstools/media-query-list-parser" "^2.1.2" + "@csstools/selector-specificity" "^3.0.0" + balanced-match "^2.0.0" + colord "^2.9.3" + cosmiconfig "^8.2.0" + css-functions-list "^3.1.0" + css-tree "^2.3.1" + debug "^4.3.4" + fast-glob "^3.3.0" + fastest-levenshtein "^1.0.16" + file-entry-cache "^6.0.1" + global-modules "^2.0.0" + globby "^11.1.0" + globjoin "^0.1.4" + html-tags "^3.3.1" + ignore "^5.2.4" + import-lazy "^4.0.0" + imurmurhash "^0.1.4" + is-plain-object "^5.0.0" + known-css-properties "^0.27.0" + mathml-tag-names "^2.1.3" + meow "^10.1.5" + micromatch "^4.0.5" + normalize-path "^3.0.0" + picocolors "^1.0.0" + postcss "^8.4.24" + postcss-resolve-nested-selector "^0.1.1" + postcss-safe-parser "^6.0.0" + postcss-selector-parser "^6.0.13" + postcss-value-parser "^4.2.0" + resolve-from "^5.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + style-search "^0.1.0" + supports-hyperlinks "^3.0.0" + svg-tags "^1.0.0" + table "^6.8.1" + write-file-atomic "^5.0.1" + +supports-color@8.1.1, supports-color@^8.0.0: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -13190,19 +14038,20 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.0.0, supports-color@^7.1.0, supports-color@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== +supports-hyperlinks@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-3.0.0.tgz#c711352a5c89070779b4dad54c05a2f14b15c94b" + integrity sha512-QBDPHyPQDRTy9ku4URNGY5Lah8PAaXs6tAAwp55sL5WCsSW7GIfdf6W5ixfziW+t7wh3GVvHyHHyQ1ESsoRvaA== dependencies: has-flag "^4.0.0" + supports-color "^7.0.0" supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" @@ -13214,6 +14063,11 @@ svg-parser@^2.0.2: resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ== +svg-tags@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/svg-tags/-/svg-tags-1.0.0.tgz#58f71cee3bd519b59d4b2a843b6c7de64ac04764" + integrity sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA== + svgo@^2.5.0, svgo@^2.7.0: version "2.8.0" resolved "https://registry.yarnpkg.com/svgo/-/svgo-2.8.0.tgz#4ff80cce6710dc2795f0c7c74101e6764cfccd24" @@ -13227,6 +14081,17 @@ svgo@^2.5.0, svgo@^2.7.0: picocolors "^1.0.0" stable "^0.1.8" +table@^6.8.1: + version "6.8.1" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.1.tgz#ea2b71359fe03b017a5fbc296204471158080bdf" + integrity sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + tapable@^1.0.0: version "1.1.3" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.1.3.tgz#a1fccc06b58db61fd7a45da2da44f5f3a3e67ba2" @@ -13280,24 +14145,24 @@ tempy@^0.6.0: type-fest "^0.16.0" unique-string "^2.0.0" -terser-webpack-plugin@^5.1.3, terser-webpack-plugin@^5.3.3: - version "5.3.3" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.3.tgz#8033db876dd5875487213e87c627bca323e5ed90" - integrity sha512-Fx60G5HNYknNTNQnzQ1VePRuu89ZVYWfjRAeT5rITuCY/1b08s49e5kSQwHDirKZWuoKOBRFS98EUUoZ9kLEwQ== +terser-webpack-plugin@^5.3.3, terser-webpack-plugin@^5.3.7: + version "5.3.7" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.7.tgz#ef760632d24991760f339fe9290deb936ad1ffc7" + integrity sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw== dependencies: - "@jridgewell/trace-mapping" "^0.3.7" + "@jridgewell/trace-mapping" "^0.3.17" jest-worker "^27.4.5" schema-utils "^3.1.1" - serialize-javascript "^6.0.0" - terser "^5.7.2" + serialize-javascript "^6.0.1" + terser "^5.16.5" -terser@^5.0.0, terser@^5.10.0, terser@^5.15.1, terser@^5.7.2: - version "5.16.5" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.16.5.tgz#1c285ca0655f467f92af1bbab46ab72d1cb08e5a" - integrity sha512-qcwfg4+RZa3YvlFh0qjifnzBHjKGNbtDo9yivMqMFDy9Q6FSaQWSB/j1xKhsoUFJIqDOM3TsN6D5xbrMrFcHbg== +terser@^5.0.0, terser@^5.10.0, terser@^5.16.5: + version "5.18.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.18.0.tgz#dc811fb8e3481a875d545bda247c8730ee4dc76b" + integrity sha512-pdL757Ig5a0I+owA42l6tIuEycRuM7FPY4n62h44mRLRfnOxJkkOHd6i89dOpwZlpF6JXBwaAHF6yWzFrt+QyA== dependencies: - "@jridgewell/source-map" "^0.3.2" - acorn "^8.5.0" + "@jridgewell/source-map" "^0.3.3" + acorn "^8.8.2" commander "^2.20.0" source-map-support "~0.5.20" @@ -13320,20 +14185,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -thenify-all@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" - integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== - dependencies: - thenify ">= 3.1.0 < 4" - -"thenify@>= 3.1.0 < 4": - version "3.3.1" - resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" - integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== - dependencies: - any-promise "^1.0.0" - through2@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -13342,13 +14193,6 @@ through2@^2.0.0: readable-stream "~2.3.6" xtend "~4.0.1" -through2@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/through2/-/through2-4.0.2.tgz#a7ce3ac2a7a8b0b966c80e7c49f0484c3b239764" - integrity sha512-iOqSav00cVxEEICeD7TjLB1sueEL+81Wpzp2bY17uZjZN0pWZPuo4suZ/61VujxmqSGFfgOcNuTZ85QJwNZQpw== - dependencies: - readable-stream "3" - through@2, "through@>=2.2.7 <3", through@^2.3.4, through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" @@ -13359,14 +14203,6 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== -timers-ext@^0.1.7: - version "0.1.7" - resolved "https://registry.yarnpkg.com/timers-ext/-/timers-ext-0.1.7.tgz#6f57ad8578e07a3fb9f91d9387d65647555e25c6" - integrity sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ== - dependencies: - es5-ext "~0.10.46" - next-tick "1" - tiny-invariant@^1.0.2: version "1.2.0" resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.2.0.tgz#a1141f86b672a9148c72e978a19a73b9b94a15a9" @@ -13442,16 +14278,16 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -treeverse@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/treeverse/-/treeverse-2.0.0.tgz#036dcef04bc3fd79a9b79a68d4da03e882d8a9ca" - integrity sha512-N5gJCkLu1aXccpOTtqV6ddSEi6ZmGkh3hjmbu1IjcavJK4qyOVQmi0myQKM7z5jVGmD68SJoliaVrMmVObhj6A== - trim-newlines@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144" integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== +trim-newlines@^4.0.2: + version "4.1.1" + resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-4.1.1.tgz#28c88deb50ed10c7ba6dc2474421904a00139125" + integrity sha512-jRKj0n0jXWo6kh62nA5TEh3+4igKDXLvzBJcPpiizP7oOolUrYIxmVBG9TOtHYFHoddUk6YvAkGeGoSVTXfQXQ== + trim-trailing-lines@^1.0.0: version "1.1.4" resolved "https://registry.yarnpkg.com/trim-trailing-lines/-/trim-trailing-lines-1.1.4.tgz#bd4abbec7cc880462f10b2c8b5ce1d8d1ec7c2c0" @@ -13467,11 +14303,35 @@ trough@^1.0.0: resolved "https://registry.yarnpkg.com/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406" integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA== +ts-api-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.1.tgz#8144e811d44c749cd65b2da305a032510774452d" + integrity sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A== + ts-essentials@^2.0.3: version "2.0.12" resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-2.0.12.tgz#c9303f3d74f75fa7528c3d49b80e089ab09d8745" integrity sha512-3IVX4nI6B5cc31/GFFE+i8ey/N2eA0CZDbo6n0yrz0zDX8ZJ8djmU1p+XRz7G3is0F3bB3pu2pAroFdAWQKU3w== +ts-node@*: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + ts-node@10.7.0: version "10.7.0" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" @@ -13510,12 +14370,12 @@ tsconfig-paths@^4.1.2: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.13.0, tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0: +tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1: version "2.5.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf" integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg== @@ -13553,10 +14413,10 @@ tsutils@^3.21.0: dependencies: tslib "^1.8.1" -tsx@^3.12.1: - version "3.12.5" - resolved "https://registry.yarnpkg.com/tsx/-/tsx-3.12.5.tgz#6d60d3c9ca2c5f9b8d2cef2cf099867591244264" - integrity sha512-/TLj30xF1zcN9JkoFCyROtIQUi8cRQG+AFchsg5YkWou3+RXxTZS/ffWB3nCxyZPoBqF2+8ohs07N815dNb1wQ== +tsx@^3.12.7: + version "3.12.7" + resolved "https://registry.yarnpkg.com/tsx/-/tsx-3.12.7.tgz#b3b8b0fc79afc8260d1e14f9e995616c859a91e9" + integrity sha512-C2Ip+jPmqKd1GWVQDvz/Eyc6QJbGfE7NrR3fx5BpEHMZsEHoIxHL1j+lKdGobr8ovEyqeNkPLSKp6SCSOt7gmw== dependencies: "@esbuild-kit/cjs-loader" "^2.4.2" "@esbuild-kit/core-utils" "^3.0.0" @@ -13564,6 +14424,19 @@ tsx@^3.12.1: optionalDependencies: fsevents "~2.3.2" +tuf-js@^1.1.3: + version "1.1.5" + resolved "https://registry.yarnpkg.com/tuf-js/-/tuf-js-1.1.5.tgz#ad82a18c5db42f142d2d2e15d6d25655e30c03c3" + integrity sha512-inqodgxdsmuxrtQVbu6tPNgRKWD1Boy3VB6GO7KczJZpAHiTukwhSzXUSzvDcw5pE2Jo8ua+e1ykpHv7VdPVlQ== + dependencies: + "@tufjs/models" "1.0.4" + make-fetch-happen "^11.1.0" + +tunnel@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" + integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -13571,7 +14444,7 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" -type-detect@4.0.8: +type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5, type-detect@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== @@ -13611,6 +14484,11 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^1.0.1, type-fest@^1.2.1, type-fest@^1.2.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1" + integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA== + type-fest@^2.5.0: version "2.12.1" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.12.1.tgz#d2be8f50bf5f8f0a5fd916d29bf3e98c17e960be" @@ -13624,16 +14502,6 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/type/-/type-2.6.0.tgz#3ca6099af5981d36ca86b78442973694278a219f" - integrity sha512-eiDBDOmkih5pMbo9OqsqPRGMljLodLcwd5XD5JbtNB0o89xZAwynY9EdCDsJU7LtcVCClu9DvM7/0Ep1hYX3EQ== - typed-array-length@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" @@ -13655,10 +14523,10 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@*, "typescript@>=3.3.1 <5.1.0", "typescript@^3 || ^4", typescript@next, typescript@~4.8.4, typescript@~5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.2.tgz#891e1a90c5189d8506af64b9ef929fca99ba1ee5" - integrity sha512-wVORMBGO/FAs/++blGNeAVdbNKtIh1rbBL2EyQ1+J9lClJ93KiiKe8PmFIVdXhHcyv44SL9oglmfeSsndo0jRw== +typescript@*, typescript@5.1.6, "typescript@>=3 < 6", "typescript@>=4.3.5 <5.2.0", typescript@next, typescript@~5.0.4: + version "5.1.6" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274" + integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA== ua-parser-js@^0.7.30: version "0.7.31" @@ -13706,10 +14574,10 @@ unicode-match-property-ecmascript@^2.0.0: unicode-canonical-property-names-ecmascript "^2.0.0" unicode-property-aliases-ecmascript "^2.0.0" -unicode-match-property-value-ecmascript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz#1a01aa57247c14c568b89775a54938788189a714" - integrity sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw== +unicode-match-property-value-ecmascript@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.1.0.tgz#cb5fffdcd16a05124f5a4b0bf7c3770208acbbe0" + integrity sha512-qxkjQt6qjg/mYscYMC0XKRn3Rh0wFPlfxB0xkt9CfyTvpX1Ra0+rAmdX2QyAobptSEvuy4RtpPRui6XkV+8wjA== unicode-property-aliases-ecmascript@^2.0.0: version "2.0.0" @@ -13747,6 +14615,13 @@ unique-filename@^1.1.1: dependencies: unique-slug "^2.0.0" +unique-filename@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-3.0.0.tgz#48ba7a5a16849f5080d26c760c86cf5cf05770ea" + integrity sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g== + dependencies: + unique-slug "^4.0.0" + unique-slug@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" @@ -13754,6 +14629,13 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +unique-slug@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-4.0.0.tgz#6bae6bb16be91351badd24cdce741f892a6532e3" + integrity sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ== + dependencies: + imurmurhash "^0.1.4" + unique-string@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/unique-string/-/unique-string-2.0.0.tgz#39c6451f81afb2749de2b233e3f7c5e8843bd89d" @@ -13839,20 +14721,20 @@ unpipe@1.0.0, unpipe@~1.0.0: resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw= +upath@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b" + integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== + upath@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== -upath@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b" - integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w== - -update-browserslist-db@^1.0.10: - version "1.0.10" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz#0f54b876545726f17d00cd9a2561e6dade943ff3" - integrity sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ== +update-browserslist-db@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz#9a2a641ad2907ae7b3616506f4b977851db5b940" + integrity sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA== dependencies: escalade "^3.1.1" picocolors "^1.0.0" @@ -13919,6 +14801,11 @@ use-latest@^1.0.0: dependencies: use-isomorphic-layout-effect "^1.0.0" +use-sync-external-store@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" + integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== + util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -13939,15 +14826,20 @@ utils-merge@1.0.1: resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" integrity sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM= -uuid@8.3.2, uuid@^8.3.2: +uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-compile-cache-lib@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" - integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== +uuid@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5" + integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg== + +v8-compile-cache-lib@^3.0.0, v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== v8-compile-cache@2.3.0: version "2.3.0" @@ -13971,10 +14863,10 @@ validate-npm-package-license@3.0.4, validate-npm-package-license@^3.0.1, validat spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -validate-npm-package-name@4.0.0, validate-npm-package-name@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-4.0.0.tgz#fe8f1c50ac20afdb86f177da85b3600f0ac0d747" - integrity sha512-mzR0L8ZDktZjpX4OB46KT+56MAhl4EIazWP/+G/HPGuvfdaqg4YsCdtOm6U9+LOFyYDoh4dpnpxZRB9MQQns5Q== +validate-npm-package-name@5.0.0, validate-npm-package-name@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz#f16afd48318e6f90a1ec101377fa0384cfc8c713" + integrity sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ== dependencies: builtins "^5.0.0" @@ -14044,11 +14936,6 @@ wait-on@^6.0.1: minimist "^1.2.5" rxjs "^7.5.4" -walk-up-path@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/walk-up-path/-/walk-up-path-1.0.0.tgz#d4745e893dd5fd0dbb58dd0a4c6a33d9c9fec53e" - integrity sha512-hwj/qMDUEjCU5h0xr90KGCf0tg0/LgJbmOWgrWKYlcJZM7XvquvUJZ0G/HMGr7F7OQMOUuPHWP9JpriinkAlkg== - walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" @@ -14083,6 +14970,11 @@ web-namespaces@^1.0.0: resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.4.tgz#bc98a3de60dadd7faefc403d1076d529f5e030ec" integrity sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw== +web-streams-polyfill@^3.0.3: + version "3.2.1" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" + integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -14167,22 +15059,22 @@ webpack-sources@^3.2.2, webpack-sources@^3.2.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.73.0, webpack@^5.74.0: - version "5.74.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.74.0.tgz#02a5dac19a17e0bb47093f2be67c695102a55980" - integrity sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA== +webpack@^5.73.0, webpack@^5.88.1: + version "5.88.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.88.1.tgz#21eba01e81bd5edff1968aea726e2fbfd557d3f8" + integrity sha512-FROX3TxQnC/ox4N+3xQoWZzvGXSuscxR32rbzjpXgEzWudJFEJBpdlkkob2ylrv5yzzufD1zph1OoFsLtm6stQ== dependencies: "@types/eslint-scope" "^3.7.3" - "@types/estree" "^0.0.51" - "@webassemblyjs/ast" "1.11.1" - "@webassemblyjs/wasm-edit" "1.11.1" - "@webassemblyjs/wasm-parser" "1.11.1" + "@types/estree" "^1.0.0" + "@webassemblyjs/ast" "^1.11.5" + "@webassemblyjs/wasm-edit" "^1.11.5" + "@webassemblyjs/wasm-parser" "^1.11.5" acorn "^8.7.1" - acorn-import-assertions "^1.7.6" + acorn-import-assertions "^1.9.0" browserslist "^4.14.5" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.10.0" - es-module-lexer "^0.9.0" + enhanced-resolve "^5.15.0" + es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0" glob-to-regexp "^0.4.1" @@ -14191,9 +15083,9 @@ webpack@^5.73.0, webpack@^5.74.0: loader-runner "^4.2.0" mime-types "^2.1.27" neo-async "^2.6.2" - schema-utils "^3.1.0" + schema-utils "^3.2.0" tapable "^2.1.1" - terser-webpack-plugin "^5.1.3" + terser-webpack-plugin "^5.3.7" watchpack "^2.4.0" webpack-sources "^3.2.3" @@ -14271,20 +15163,34 @@ which-typed-array@^1.1.9: has-tostringtag "^1.0.0" is-typed-array "^1.1.10" -which@^1.2.9, which@^1.3.1: +which@2.0.2, which@^2.0.1, which@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" -which@^2.0.1, which@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" - integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== +which@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/which/-/which-3.0.0.tgz#a9efd016db59728758a390d23f1687b6e8f59f8e" + integrity sha512-nla//68K9NU6yRiwDY/Q8aU6siKlSs64aEC7+IV56QoAuyQT2ovsJcgGYGyqMOmI/CGN1BOR6mM5EN0FBO+zyQ== dependencies: isexe "^2.0.0" +wide-align@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" + integrity sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA== + dependencies: + string-width "^1.0.2 || 2" + wide-align@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" @@ -14311,11 +15217,6 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== -word-wrap@^1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== - wordwrap@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" @@ -14479,28 +15380,33 @@ workbox-window@6.5.4, workbox-window@^6.5.3: "@types/trusted-types" "^2.0.2" workbox-core "6.5.4" -wrap-ansi@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" - integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== +workerpool@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.0.tgz#a8e038b4c94569596852de7a8ea4228eefdeb37b" + integrity sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg== + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: ansi-styles "^4.0.0" string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== dependencies: ansi-styles "^4.0.0" string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^8.0.1: - version "8.0.1" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.0.1.tgz#2101e861777fec527d0ea90c57c6b03aac56a5b3" - integrity sha512-QFF+ufAqhoYHvoHdajT/Po7KoXVBPXS2bgjIam5isfWJPfIOnQZ50JtUiVvCv/sjgacf3yRrt2ZKUZ/V4itN4g== +wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== dependencies: ansi-styles "^6.1.0" string-width "^5.0.1" @@ -14511,13 +15417,13 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.1.tgz#9faa33a964c1c85ff6f849b80b42a88c2c537c8f" - integrity sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ== +write-file-atomic@5.0.1, write-file-atomic@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" + integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== dependencies: imurmurhash "^0.1.4" - signal-exit "^3.0.7" + signal-exit "^4.0.1" write-file-atomic@^2.4.2: version "2.4.3" @@ -14538,7 +15444,7 @@ write-file-atomic@^3.0.0: signal-exit "^3.0.2" typedarray-to-buffer "^3.1.5" -write-file-atomic@^4.0.0, write-file-atomic@^4.0.2: +write-file-atomic@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== @@ -14614,26 +15520,36 @@ yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.1.tgz#3014bf0482dcd15147aa8e56109ce8632cd60ce4" - integrity sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw== +yaml@^2.2.2: + version "2.3.1" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.3.1.tgz#02fe0975d23cd441242aa7204e09fc28ac2ac33b" + integrity sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ== yargs-parser@20.2.4: version "20.2.4" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== -yargs-parser@21.1.1, yargs-parser@>=21.0.1, yargs-parser@^21.1.1: +yargs-parser@21.1.1, yargs-parser@>=21.1.1, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs-parser@^20.2.2, yargs-parser@^20.2.3: +yargs-parser@^20.2.2, yargs-parser@^20.2.3, yargs-parser@^20.2.9: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + yargs@16.2.0, yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" @@ -14648,9 +15564,9 @@ yargs@16.2.0, yargs@^16.2.0: yargs-parser "^20.2.2" yargs@^17.3.1, yargs@^17.6.2: - version "17.6.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541" - integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw== + version "17.7.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.1.tgz#34a77645201d1a8fc5213ace787c220eabbd0967" + integrity sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw== dependencies: cliui "^8.0.1" escalade "^3.1.1"
Rule - ✅{'\n'}🔒 - - 🔧{'\n'}💡 - - 💭 - ConfigFixerTyped